@zukhruf/eslint 0.3.58 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ You need ESLint 9.30 or later.
22
22
  npm install --save-dev @zukhruf/eslint
23
23
  ```
24
24
 
25
- Its peers are `eslint`, `@eslint/js`, `typescript-eslint`, `typescript`, `eslint-plugin-import-x`, `eslint-plugin-functional` and `jsonc-eslint-parser`. `@zukhruf/eslint/nx` also needs `@nx/eslint-plugin`, and `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. npm installs the peers for you. With `legacy-peer-deps=true` in `.npmrc`, npm does not, so add them to your devDependencies.
25
+ Its peers are `eslint`, `@eslint/js`, `typescript-eslint`, `typescript`, `eslint-plugin-import-x`, `eslint-plugin-functional` and `jsonc-eslint-parser`. `@zukhruf/eslint/nx` also needs `@nx/eslint-plugin`, `@zukhruf/eslint/react` needs `@nx/eslint-plugin` and the 4 plugins in [React](#react), and `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. npm installs the peers for you. With `legacy-peer-deps=true` in `.npmrc`, npm does not, so add them to your devDependencies.
26
26
 
27
27
  ```js
28
28
  // eslint.config.mjs
@@ -36,7 +36,7 @@ export default defineConfig({
36
36
  });
37
37
  ```
38
38
 
39
- Put framework presets (for example Nx's `flat/react`) **before** the zukhruf configs. The package's own checks survive any order. But `base` also changes some third-party rules, for example it turns `@typescript-eslint/no-unused-vars` off, and a preset that comes later sets them again.
39
+ Put framework presets (for example [`@zukhruf/eslint/react`](#react), which is Nx's `flat/react`) **before** the zukhruf configs. The package's own checks survive any order. But `base` also changes some third-party rules, for example it turns `@typescript-eslint/no-unused-vars` off, and a preset that comes later sets them again.
40
40
 
41
41
  ## Configs
42
42
 
@@ -201,6 +201,30 @@ The rule decides each manifest's options itself, so your options add to the shar
201
201
 
202
202
  `manifest/recommended` also has `manifest/no-truncated-description`. The npm registry keeps only the first 255 characters of a package's `description`. `npm view` and the npm search do not show the rest. The rule reports a `description` that is longer than 255 characters. It does not check a manifest with `"private": true`, because npm does not publish it. Put the key fact in the description, and put the details in the README.
203
203
 
204
+ ## React
205
+
206
+ `@zukhruf/eslint/react` is Nx's `flat/react` config from `@nx/eslint-plugin`, with no changes. Use it in place of `nx.configs['flat/react']` in the `eslint.config.mjs` of a React project. Put it first, and then the root config, as before:
207
+
208
+ ```js
209
+ import react from '@zukhruf/eslint/react';
210
+
211
+ import baseConfig from '../../eslint.config.mjs';
212
+
213
+ export default [...react, ...baseConfig];
214
+ ```
215
+
216
+ `flat/react` loads `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react` and `eslint-plugin-react-hooks`. Install these 4 plugins in the React workspace. They are optional peers of this package, because `@nx/eslint-plugin` (checked at 24.0.2) does not declare them. With the peers, npm writes the lockfile edges from `@zukhruf/eslint` to the 4 plugins, so a lint input on `@zukhruf/eslint` also hashes the plugins.
217
+
218
+ The peer ranges of `eslint-plugin-import`, `eslint-plugin-jsx-a11y` and `eslint-plugin-react` stop at ESLint 9. On ESLint 10, add an `overrides` entry for each of the 3 to `package.json`, as factory and whatisgoingon do:
219
+
220
+ ```json
221
+ "overrides": {
222
+ "eslint-plugin-import": { "eslint": "$eslint" },
223
+ "eslint-plugin-jsx-a11y": { "eslint": "$eslint" },
224
+ "eslint-plugin-react": { "eslint": "$eslint" }
225
+ }
226
+ ```
227
+
204
228
  ## React Native: Hermes
205
229
 
206
230
  `@zukhruf/eslint/react-native` needs `eslint-plugin-es-x`. es-x 10 needs ESLint 10.6 or later; on ESLint 9, install `eslint-plugin-es-x@9`. `hermes/recommended` checks the code that ships in the app, and leaves tests, config files and scripts alone, because those run in Node:
@@ -0,0 +1,3 @@
1
+ declare const _default: import("typescript-eslint").FlatConfig.ConfigArray;
2
+ export default _default;
3
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";AAOA,wBAAwC"}
package/dist/react.js ADDED
@@ -0,0 +1,8 @@
1
+ import nx from '@nx/eslint-plugin';
2
+ // @nx/eslint-plugin (checked 24.0.2) requires eslint-plugin-import,
3
+ // eslint-plugin-jsx-a11y, eslint-plugin-react and eslint-plugin-react-hooks in
4
+ // flat/react, but declares none of them. This package declares them as optional
5
+ // peers, so npm writes the lockfile edges that Nx hashes for a lint input on
6
+ // @zukhruf/eslint. Delete the peers when @nx/eslint-plugin declares them.
7
+ export default nx.configs['flat/react'];
8
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,oEAAoE;AACpE,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,0EAA0E;AAC1E,eAAe,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/eslint",
3
- "version": "0.3.58",
3
+ "version": "0.4.1",
4
4
  "description": "ESLint rules and configs shared across workspaces. Every check is its own named rule, so a repo's own config cannot silently erase it.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,6 +38,12 @@
38
38
  "types": "./dist/react-native.d.ts",
39
39
  "import": "./dist/react-native.js",
40
40
  "default": "./dist/react-native.js"
41
+ },
42
+ "./react": {
43
+ "@zukhruf/source": "./src/react.ts",
44
+ "types": "./dist/react.d.ts",
45
+ "import": "./dist/react.js",
46
+ "default": "./dist/react.js"
41
47
  }
42
48
  },
43
49
  "files": [
@@ -56,7 +62,7 @@
56
62
  "ts-api-utils": "^2.5.0"
57
63
  },
58
64
  "devDependencies": {
59
- "@zukhruf/testing": "^0.3.58"
65
+ "@zukhruf/testing": "^0.4.1"
60
66
  },
61
67
  "peerDependencies": {
62
68
  "@eslint/js": "^9.30.0 || ^10.0.0",
@@ -65,7 +71,11 @@
65
71
  "eslint": "^9.30.0 || ^10.0.0",
66
72
  "eslint-plugin-es-x": "^9.7.0 || ^10.0.0",
67
73
  "eslint-plugin-functional": "^10.0.0",
74
+ "eslint-plugin-import": "^2.31.0",
68
75
  "eslint-plugin-import-x": "^4.16.0",
76
+ "eslint-plugin-jsx-a11y": "^6.10.1",
77
+ "eslint-plugin-react": "^7.35.0",
78
+ "eslint-plugin-react-hooks": "^5.0.0 || ^7.0.0",
69
79
  "jsonc-eslint-parser": "^2.4.0 || ^3.0.0",
70
80
  "typescript": ">=5.8.0 <6.1.0",
71
81
  "typescript-eslint": "^8.47.0"
@@ -79,6 +89,18 @@
79
89
  },
80
90
  "eslint-plugin-es-x": {
81
91
  "optional": true
92
+ },
93
+ "eslint-plugin-import": {
94
+ "optional": true
95
+ },
96
+ "eslint-plugin-jsx-a11y": {
97
+ "optional": true
98
+ },
99
+ "eslint-plugin-react": {
100
+ "optional": true
101
+ },
102
+ "eslint-plugin-react-hooks": {
103
+ "optional": true
82
104
  }
83
105
  }
84
106
  }