Skip to content

Commit 1286dde

Browse files
fix(eslint-config): top-level export; move plugins to peerDeps (#9)
1 parent 9facba9 commit 1286dde

File tree

4 files changed

+71
-21
lines changed

4 files changed

+71
-21
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@mikecbrant/eslint-config": major
3+
---
4+
5+
Breaking change: adopt Option B dependency model. Only the following are required as peer dependencies for consumers:
6+
7+
- `eslint`
8+
- `typescript`
9+
10+
All ESLint plugin/config packages are now regular dependencies of `@mikecbrant/eslint-config` and will be installed transitively by consumers (no need to add them directly):
11+
12+
- `@typescript-eslint/parser`
13+
- `@typescript-eslint/eslint-plugin`
14+
- `eslint-config-xo-typescript`
15+
- `eslint-plugin-import`
16+
- `eslint-import-resolver-typescript`
17+
- `eslint-plugin-unicorn`
18+
- `eslint-plugin-sonarjs`
19+
- `eslint-plugin-unused-imports`
20+
21+
Development policy: this package’s `devDependencies` now use caret ranges to track current tooling (no pinning to exact lockfile resolutions).

packages/eslint-config/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ ESLint 9 flat config for ESM-only Node 22/24 projects.
66
- ESM-only: no `.cjs`, no eslintrc format
77
- CJS (`*.cjs`, `*.cts`) files are ignored by default
88

9+
## Peer dependencies
10+
11+
This package requires the following peers in your project:
12+
13+
- `eslint` (^9.0.0)
14+
- `typescript` (^5.0.0)
15+
16+
All ESLint plugins/configs used by this shareable config are regular dependencies and install transitively with `@mikecbrant/eslint-config`.
17+
918
## Install
1019

1120
```bash
12-
pnpm add -D eslint @mikecbrant/eslint-config
21+
pnpm add -D eslint typescript @mikecbrant/eslint-config
1322
```
1423

15-
This shareable config brings along the necessary plugins/configs internally (XO + TypeScript, import resolver, SonarJS, unicorn, and unused-imports). Your project only needs `eslint` and this package.
24+
This installs the two peers alongside the shared config. The plugin/config packages (XO TypeScript, import resolver, SonarJS, unicorn, and unused-imports) are bundled as dependencies of this package—you do not need to add them yourself.
1625

1726
## Usage
1827

@@ -23,6 +32,18 @@ import config from '@mikecbrant/eslint-config'
2332
export default config
2433
```
2534

35+
### Avoid duplicated config values
36+
37+
When using the flat config exported by this package, do not re-declare the same plugins/configs or duplicate rules in your local `eslint.config.*`. This config already registers:
38+
39+
- `@typescript-eslint`
40+
- `eslint-plugin-import`
41+
- `eslint-plugin-unicorn`
42+
- `eslint-plugin-sonarjs`
43+
- `eslint-plugin-unused-imports`
44+
45+
Re-declaring these can lead to duplicate plugin instances or conflicting rules (an issue we hit in a recent PR). If you need project-specific tweaks, place additional overrides after the imported config without re-adding the same plugins/configs.
46+
2647
Key strict rules (all error):
2748

2849
- `max-lines-per-function` = 60 (skip comments/blank lines)

packages/eslint-config/package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@
88
"engines": {
99
"node": ">=22 <25"
1010
},
11-
"dependencies": {
11+
"peerDependencies": {
1212
"eslint": "^9.0.0",
13-
"eslint-config-xo-typescript": "^8.0.0",
14-
"@typescript-eslint/parser": "^8.0.0",
15-
"@typescript-eslint/eslint-plugin": "^8.0.0",
16-
"eslint-plugin-import": "^2.29.0",
17-
"eslint-import-resolver-typescript": "^3.6.0",
13+
"typescript": "^5.0.0"
14+
},
15+
"dependencies": {
16+
"@typescript-eslint/parser": "^8.41.0",
17+
"@typescript-eslint/eslint-plugin": "^8.41.0",
18+
"eslint-config-xo-typescript": "^8.0.2",
19+
"eslint-plugin-import": "^2.32.0",
20+
"eslint-import-resolver-typescript": "^3.10.1",
1821
"eslint-plugin-unicorn": "^52.0.0",
19-
"eslint-plugin-sonarjs": "^3.0.2",
20-
"eslint-plugin-unused-imports": "^4.0.0"
22+
"eslint-plugin-sonarjs": "^3.0.5",
23+
"eslint-plugin-unused-imports": "^4.2.0"
2124
},
2225
"devDependencies": {
23-
"@mikecbrant/prettier-config": "workspace:*"
26+
"@mikecbrant/prettier-config": "workspace:*",
27+
"eslint": "^9.34.0",
28+
"typescript": "^5.9.2"
2429
},
2530
"publishConfig": {
2631
"access": "public"

pnpm-lock.yaml

Lines changed: 13 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)