diff --git a/.changeset/optional-react-router-group.md b/.changeset/optional-react-router-group.md deleted file mode 100644 index f223ccc..0000000 --- a/.changeset/optional-react-router-group.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -"@gaia-react/lint": major ---- - -React Router relaxations move out of `react` into a new opt-in `reactRouter` block. - -`react` shipped a block scoped to `**/routes/**/*.tsx` that turned `no-empty-pattern` off. That glob is not unique to React Router: TanStack Router uses a `routes/` directory too, so a project on any other file-based router had the rule silently disabled across its whole route tree, with nothing in the composed config explaining why. - -The relaxation now ships as its own block. Spread it after `react` if you run React Router in framework mode: - -```js -...lint.react, -...lint.reactRouter, -``` - -**Breaking for React Router consumers.** Without that line, `no-empty-pattern` reports every route module that destructures nothing from its typed props (`({}: Route.ComponentProps)`). Adding the spread restores the previous behavior exactly; there is no other migration step. A project that never writes that shape sees no new errors either way, so the upgrade may well be a no-op in practice. - -Projects on another router should omit it and keep the rule enabled. They will most likely also want to ignore their generated route tree: - -```js -...lint.ignores({extra: ['**/routeTree.gen.ts']}), -``` - -The `/.react-router/**` glob stays in the `ignores` defaults. It names a directory that only exists in a React Router project, so it costs other projects nothing, while moving it would break React Router consumers who miss the new spread. - -A new suite asks ESLint what the composed config resolves to on both sides of the opt-in, so a future change that folds the block back into `react`, or widens its glob, fails a test instead of quietly relaxing a rule. - -Two dead config entries are removed in the same pass. Neither changes any effective rule: - -- `react/display-name` was set to `off` in the route block, but `airbnb/config/react` already sets it to `off` for every file. -- The `typescript/only-throw-error` block disabled `@typescript-eslint/only-throw-error` for `hooks/`, `routes/`, and `sessions.server/`, but the `typescript/config` block already disables that rule globally for `**/*.ts?(x)`. diff --git a/CHANGELOG.md b/CHANGELOG.md index a6e8baa..9741f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # @gaia-react/lint +## 2.0.0 + +### Major Changes + +- [#42](https://github.com/gaia-react/lint/pull/42) [`b364e99`](https://github.com/gaia-react/lint/commit/b364e995699dc4417637e19c79f91a958a3949b2) Thanks [@stevensacks](https://github.com/stevensacks)! - React Router relaxations move out of `react` into a new opt-in `reactRouter` block. + + `react` shipped a block scoped to `**/routes/**/*.tsx` that turned `no-empty-pattern` off. That glob is not unique to React Router: TanStack Router uses a `routes/` directory too, so a project on any other file-based router had the rule silently disabled across its whole route tree, with nothing in the composed config explaining why. + + The relaxation now ships as its own block. Spread it after `react` if you run React Router in framework mode: + + ```js + ...lint.react, + ...lint.reactRouter, + ``` + + **Breaking for React Router consumers.** Without that line, `no-empty-pattern` reports every route module that destructures nothing from its typed props (`({}: Route.ComponentProps)`). Adding the spread restores the previous behavior exactly; there is no other migration step. A project that never writes that shape sees no new errors either way, so the upgrade may well be a no-op in practice. + + Projects on another router should omit it and keep the rule enabled. They will most likely also want to ignore their generated route tree: + + ```js + ...lint.ignores({extra: ['**/routeTree.gen.ts']}), + ``` + + The `/.react-router/**` glob stays in the `ignores` defaults. It names a directory that only exists in a React Router project, so it costs other projects nothing, while moving it would break React Router consumers who miss the new spread. + + A new suite asks ESLint what the composed config resolves to on both sides of the opt-in, so a future change that folds the block back into `react`, or widens its glob, fails a test instead of quietly relaxing a rule. + + Two dead config entries are removed in the same pass. Neither changes any effective rule: + - `react/display-name` was set to `off` in the route block, but `airbnb/config/react` already sets it to `off` for every file. + - The `typescript/only-throw-error` block disabled `@typescript-eslint/only-throw-error` for `hooks/`, `routes/`, and `sessions.server/`, but the `typescript/config` block already disables that rule globally for `**/*.ts?(x)`. + ## 1.11.0 ### Minor Changes diff --git a/package.json b/package.json index 35b8330..e33c8a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gaia-react/lint", - "version": "1.11.0", + "version": "2.0.0", "description": "GAIA's opinionated lint configuration.", "type": "module", "main": "./dist/index.js",