diff --git a/.changeset/eslint-config-peer-deps.md b/.changeset/eslint-config-peer-deps.md new file mode 100644 index 0000000..efef96f --- /dev/null +++ b/.changeset/eslint-config-peer-deps.md @@ -0,0 +1,15 @@ +--- +'@fingerprintjs/eslint-config-dx-team': major +--- + +Move `eslint` and `typescript-eslint` to peer dependencies + +Under strict package managers (pnpm v10+), transitive dependencies are no longer exposed at the project root, which broke `eslint` bin resolution and `import ... from 'typescript-eslint'` in consuming projects. Declaring them as peers guarantees a single, project-controlled instance of each and avoids "multiple ESLint instances" errors. + +**Breaking change:** consumers must now install `eslint` and `typescript-eslint` themselves (plus `typescript`, which `typescript-eslint` requires as a peer): + +```bash +pnpm install -D eslint typescript-eslint typescript +``` + +The redundant `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` direct dependencies were also removed (they are provided by the `typescript-eslint` umbrella package). `eslint-config-prettier`, `eslint-plugin-prettier`, and `globals` remain bundled. diff --git a/.github/actions/update-sdk-schema/update-schema.test.ts b/.github/actions/update-sdk-schema/update-schema.test.ts index a061a12..9c46b80 100644 --- a/.github/actions/update-sdk-schema/update-schema.test.ts +++ b/.github/actions/update-sdk-schema/update-schema.test.ts @@ -28,7 +28,7 @@ const orgFetch = globalThis.fetch describe('Update schema', () => { let pkg: ReturnType - + beforeEach(() => { jest.clearAllMocks() diff --git a/package.json b/package.json index 390e496..c05f499 100644 --- a/package.json +++ b/package.json @@ -35,10 +35,11 @@ "human-id": "^4.1.1", "husky": "^8.0.3", "jest": "^29.7.0", - "prettier": "^2.8.8", + "prettier": "^3.2.4", "ts-jest": "^29.1.2", "tsup": "^8.2.4", "typescript": "^5.4.2", + "typescript-eslint": "^8.60.0", "unzipper": "^0.12.3" }, "dependencies": { diff --git a/packages/eslint-config-dx-team/README.md b/packages/eslint-config-dx-team/README.md index d7af465..8a41d84 100644 --- a/packages/eslint-config-dx-team/README.md +++ b/packages/eslint-config-dx-team/README.md @@ -4,14 +4,17 @@ This package provides a custom preset for [eslint](https://github.com/eslint/esl ## Requirements -- Prettier v3+ +- ESLint v10 +- `typescript-eslint` v8 +- TypeScript v5 (peer dependency of `typescript-eslint`) +- Prettier v3 ## Installation -To install this package, use the following command: +`eslint`, `typescript-eslint`, `typescript`, and `prettier` are peer dependencies, so install them alongside the config: ```bash -pnpm install -D @fingerprintjs/eslint-config-dx-team prettier +pnpm install -D @fingerprintjs/eslint-config-dx-team eslint typescript-eslint typescript prettier ``` ## Configuration @@ -78,15 +81,18 @@ export default [ ## Dependencies -To simplify dependencies update in project this package has eslint and eslint packages as a dependencies. Please don't add any of them as a dependencies for you project: +`eslint` and `typescript-eslint` are declared as **peer dependencies**. Your project imports both directly (ESLint provides the CLI/bin you run, and your `eslint.config` typically imports `typescript-eslint`), and both need to resolve to a single instance to avoid "multiple ESLint instances" errors — so you must install them in your project: -- `@typescript-eslint/eslint-plugin` -- `@typescript-eslint/parser` - `eslint` +- `typescript-eslint` (which in turn requires `typescript`) + +Everything else is bundled by this package — **don't** add these to your project: + - `eslint-config-prettier` - `eslint-plugin-prettier` - `globals` -- `typescript-eslint` + +> **Note:** Under strict package managers such as pnpm v10+, transitive dependencies are no longer hoisted to the project root, which is why `eslint` and `typescript-eslint` must be declared as peers rather than bundled. ## License diff --git a/packages/eslint-config-dx-team/package.json b/packages/eslint-config-dx-team/package.json index 83c3242..54f1c1a 100644 --- a/packages/eslint-config-dx-team/package.json +++ b/packages/eslint-config-dx-team/package.json @@ -23,16 +23,14 @@ "type-checked.js" ], "dependencies": { - "@typescript-eslint/eslint-plugin": "^8.60.0", - "@typescript-eslint/parser": "^8.60.0", - "eslint": "10.4.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", - "globals": "^15.0.0", - "typescript-eslint": "^8.60.0" + "globals": "^15.0.0" }, "peerDependencies": { - "prettier": ">=3" + "eslint": "^10.0.0", + "typescript-eslint": "^8.0.0", + "prettier": "^3.0.0" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d9bb507..a63ff26 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,8 +88,8 @@ importers: specifier: ^29.7.0 version: 29.7.0(@types/node@20.11.27)(ts-node@10.9.2(@types/node@20.11.27)(typescript@5.4.2)) prettier: - specifier: ^2.8.8 - version: 2.8.8 + specifier: ^3.2.4 + version: 3.2.4 ts-jest: specifier: ^29.1.2 version: 29.1.2(@babel/core@7.24.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.0))(esbuild@0.23.1)(jest@29.7.0(@types/node@20.11.27)(ts-node@10.9.2(@types/node@20.11.27)(typescript@5.4.2)))(typescript@5.4.2) @@ -99,6 +99,9 @@ importers: typescript: specifier: ^5.4.2 version: 5.4.2 + typescript-eslint: + specifier: ^8.60.0 + version: 8.61.0(eslint@10.4.1)(typescript@5.4.2) unzipper: specifier: ^0.12.3 version: 0.12.3 @@ -123,14 +126,8 @@ importers: packages/eslint-config-dx-team: dependencies: - '@typescript-eslint/eslint-plugin': - specifier: ^8.60.0 - version: 8.61.0(@typescript-eslint/parser@8.61.0(eslint@10.4.1)(typescript@5.4.2))(eslint@10.4.1)(typescript@5.4.2) - '@typescript-eslint/parser': - specifier: ^8.60.0 - version: 8.61.0(eslint@10.4.1)(typescript@5.4.2) eslint: - specifier: 10.4.1 + specifier: ^10.0.0 version: 10.4.1 eslint-config-prettier: specifier: ^9.1.0 @@ -142,10 +139,10 @@ importers: specifier: ^15.0.0 version: 15.15.0 prettier: - specifier: '>=3' + specifier: ^3.0.0 version: 3.2.4 typescript-eslint: - specifier: ^8.60.0 + specifier: ^8.0.0 version: 8.61.0(eslint@10.4.1)(typescript@5.4.2) packages/prettier-config-dx-team: