@pob/eslint-config 67.10.0 → 67.11.0

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/lib/index.js CHANGED
@@ -142,6 +142,21 @@ export const createOxlintConfigs = (additionalOxlintConfigs = []) => {
142
142
  ];
143
143
  };
144
144
 
145
+ // Without the TypeScript program, a type-aware rule crashes eslint. Computed
146
+ // from the installed typescript-eslint, not from oxlint/typescript.json: a rule
147
+ // added by a newer version is off until moved to oxlint, instead of crashing.
148
+ const typeAwareRuleNames = new Set(
149
+ oxlintTypescript
150
+ ? Object.entries(
151
+ /** @type {{ rules?: Record<string, { meta?: { docs?: { requiresTypeChecking?: boolean } } }> }} */ (
152
+ tseslint.plugin
153
+ ).rules ?? {},
154
+ )
155
+ .filter(([, rule]) => rule.meta?.docs?.requiresTypeChecking)
156
+ .map(([ruleName]) => `@typescript-eslint/${ruleName}`)
157
+ : [],
158
+ );
159
+
145
160
  const oxlintConfigs = [
146
161
  ...createOxlintConfigs(),
147
162
  // oxlint runs every type-aware rule: eslint no longer needs to build the
@@ -154,11 +169,26 @@ const oxlintConfigs = [
154
169
  languageOptions: {
155
170
  parserOptions: { project: false, projectService: false },
156
171
  },
172
+ rules: Object.fromEntries(
173
+ [...typeAwareRuleNames].map((ruleName) => [ruleName, "off"]),
174
+ ),
157
175
  },
158
176
  ]
159
177
  : []),
160
178
  ];
161
179
 
180
+ // n/process-exit-as-throw only feeds eslint's code path analysis, used by rules
181
+ // checked by oxlint (no-unreachable, array-callback-return, ...)
182
+ const oxlintNodeConfigs = oxlintrc
183
+ ? [
184
+ {
185
+ name: "@pob/eslint-config/oxlint-node",
186
+ files: ["**/*.{js,cjs,mjs,ts,cts,mts,tsx}"],
187
+ rules: { "n/process-exit-as-throw": "off" },
188
+ },
189
+ ]
190
+ : [];
191
+
162
192
  /**
163
193
  * Removes the rules checked by oxlint from configs applied after
164
194
  * `oxlintConfigs`, like the overrides a project selects. Their oxlint
@@ -176,7 +206,9 @@ const withoutOxlintRules = (configs) =>
176
206
  ...config,
177
207
  rules: Object.fromEntries(
178
208
  Object.entries(config.rules).filter(
179
- ([ruleName]) => !oxlintEslintRuleNames.has(ruleName),
209
+ ([ruleName]) =>
210
+ !oxlintEslintRuleNames.has(ruleName) &&
211
+ !typeAwareRuleNames.has(ruleName),
180
212
  ),
181
213
  ),
182
214
  }
@@ -320,10 +352,10 @@ export default {
320
352
  ...oxlintConfigs,
321
353
  ],
322
354
  /** @deprecated */
323
- nodeModule: [...nodeModule, ...oxlintConfigs],
355
+ nodeModule: [...nodeModule, ...oxlintNodeConfigs, ...oxlintConfigs],
324
356
  /** @deprecated */
325
- nodeCommonjs: [...nodeCommonjs, ...oxlintConfigs],
326
- node: [...nodeModule, ...oxlintConfigs],
357
+ nodeCommonjs: [...nodeCommonjs, ...oxlintNodeConfigs, ...oxlintConfigs],
358
+ node: [...nodeModule, ...oxlintNodeConfigs, ...oxlintConfigs],
327
359
 
328
360
  allowImplicitReturnType: applyTs({
329
361
  configs: withoutOxlintRules([allowImplicitReturnTypeConfig]),
@@ -19,7 +19,7 @@ export default [
19
19
  // lint JSONC files
20
20
  {
21
21
  // name: "@pob/eslint-config/base/languages/json/jsonc",
22
- files: ["**/*.jsonc", "**/tsconfig.json", ".vscode/*.json"],
22
+ files: ["**/*.jsonc", "**/tsconfig*.json", ".vscode/*.json"],
23
23
  language: "json/jsonc",
24
24
  languageOptions: {
25
25
  allowTrailingCommas: true,
@@ -0,0 +1,23 @@
1
+ // JS plugin of oxlint/*.json, see ./regexp.js. eslint core rules without
2
+ // oxlint equivalent, or whose oxlint version differs. Named "eslint-js":
3
+ // "eslint" is reserved for oxlint's native rules.
4
+ import { builtinRules } from "eslint/use-at-your-own-risk";
5
+
6
+ const ruleNames = [
7
+ "camelcase",
8
+ "dot-notation",
9
+ "no-lone-blocks",
10
+ "no-restricted-syntax",
11
+ "no-undef-init",
12
+ ];
13
+
14
+ export default {
15
+ meta: { name: "eslint-js" },
16
+ rules: Object.fromEntries(
17
+ ruleNames.map((ruleName) => {
18
+ const rule = builtinRules.get(ruleName);
19
+ if (!rule) throw new Error(`Unknown eslint rule "${ruleName}"`);
20
+ return [ruleName, rule];
21
+ }),
22
+ ),
23
+ };
@@ -0,0 +1,3 @@
1
+ // JS plugin of oxlint/*.json, see ./regexp.js. Named "node-js": "node" is
2
+ // reserved for oxlint's native plugin.
3
+ export { default } from "eslint-plugin-n";
@@ -0,0 +1,3 @@
1
+ // JS plugin of oxlint/*.json, see ./regexp.js. Named "unicorn-js": "unicorn"
2
+ // is reserved for oxlint's native plugin.
3
+ export { default } from "eslint-plugin-unicorn";
@@ -12,6 +12,8 @@ import {
12
12
  * - enabled: in oxlint/*.json
13
13
  * - migrate: enabled in eslint, to move to oxlint (docs/oxlint-migration.md)
14
14
  * - eslint: kept in eslint
15
+ * - js-plugin: checked by the eslint rule run as an oxlint JS plugin, as the
16
+ * oxlint rule differs (docs/oxlint-migration.md)
15
17
  * - evaluate: not used today, to evaluate (Phase 4 of the migration)
16
18
  * - rejected: not wanted
17
19
  */
@@ -31,6 +33,7 @@ const decisions = new Set([
31
33
  "enabled",
32
34
  "migrate",
33
35
  "eslint",
36
+ "js-plugin",
34
37
  "evaluate",
35
38
  "rejected",
36
39
  ]);
@@ -15,6 +15,9 @@ export default [
15
15
  "unicorn/filename-case": "off",
16
16
 
17
17
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-abusive-eslint-disable.md
18
+ // kept in eslint: oxlint's version reports rule names with more than one
19
+ // slash, like n/no-unsupported-features/node-builtins, as not specifying
20
+ // any rule (1.85, https://github.com/oxc-project/oxc/issues/27364)
18
21
  "unicorn/no-abusive-eslint-disable": "error",
19
22
 
20
23
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md
@@ -136,8 +136,9 @@ export default {
136
136
  "no-global-assign": "error",
137
137
 
138
138
  // https://eslint.org/docs/rules/no-implicit-globals
139
- // TODO to enable
140
- "no-implicit-globals": "warn",
139
+ // only reports in scripts: ES modules have their own scope, and node wraps
140
+ // CommonJS files in a function
141
+ "no-implicit-globals": "off",
141
142
 
142
143
  // https://eslint.org/docs/rules/no-implied-eval
143
144
  "no-implied-eval": "error",
@@ -12,6 +12,11 @@ const eslintRulePrefixes = new Map([
12
12
  // JS plugins: the eslint plugins themselves, loaded by oxlint
13
13
  ["regexp", "regexp/"],
14
14
  ["@pob", "@pob/"],
15
+ // named "<plugin>-js" when the name is reserved for a native plugin
16
+ ["eslint-js", ""],
17
+ ["unicorn-js", "unicorn/"],
18
+ ["node-js", "n/"],
19
+ ["react-js", "react/"],
15
20
  ]);
16
21
 
17
22
  /** oxlint plugins without eslint equivalent in @pob/eslint-config */
@@ -105,6 +105,11 @@ describe("oxlintToEslintRuleNames", () => {
105
105
  ["react/jsx-key", ["react/jsx-key"]],
106
106
  ["react/rules-of-hooks", ["react-hooks/rules-of-hooks"]],
107
107
  ["react/exhaustive-deps", ["react-hooks/exhaustive-deps"]],
108
+ ["react-js/jsx-no-leaked-render", ["react/jsx-no-leaked-render"]],
109
+ ["eslint-js/camelcase", ["camelcase"]],
110
+ ["eslint-js/dot-notation", ["dot-notation"]],
111
+ ["unicorn-js/prefer-switch", ["unicorn/prefer-switch"]],
112
+ ["node-js/no-deprecated-api", ["n/no-deprecated-api"]],
108
113
  ["oxc/no-map-spread", []],
109
114
  ["promise/valid-params", []],
110
115
  ["vitest/no-focused-tests", []],
package/oxlint/base.json CHANGED
@@ -5,7 +5,9 @@
5
5
  "plugins": ["import"],
6
6
  "jsPlugins": [
7
7
  { "name": "@pob", "specifier": "../lib/oxlint-plugins/pob.js" },
8
- { "name": "regexp", "specifier": "../lib/oxlint-plugins/regexp.js" }
8
+ { "name": "regexp", "specifier": "../lib/oxlint-plugins/regexp.js" },
9
+ { "name": "eslint-js", "specifier": "../lib/oxlint-plugins/eslint.js" },
10
+ { "name": "unicorn-js", "specifier": "../lib/oxlint-plugins/unicorn.js" }
9
11
  ],
10
12
  "rules": {
11
13
  "array-callback-return": [
@@ -732,7 +734,6 @@
732
734
  }
733
735
  ],
734
736
  "unicorn/new-for-builtins": "error",
735
- "unicorn/no-abusive-eslint-disable": "error",
736
737
  "unicorn/no-accessor-recursion": "error",
737
738
  "unicorn/no-array-method-this-argument": "error",
738
739
  "unicorn/no-array-reduce": [
@@ -881,6 +882,40 @@
881
882
  ],
882
883
  "unicorn/throw-new-error": "error",
883
884
  "@pob/forbid-non-native-fetch-import": "error",
885
+ "eslint-js/camelcase": [
886
+ "error",
887
+ {
888
+ "allow": [],
889
+ "ignoreDestructuring": false,
890
+ "ignoreGlobals": false,
891
+ "ignoreImports": false,
892
+ "properties": "always"
893
+ }
894
+ ],
895
+ "eslint-js/dot-notation": [
896
+ "error",
897
+ {
898
+ "allowKeywords": true,
899
+ "allowPattern": ""
900
+ }
901
+ ],
902
+ "eslint-js/no-lone-blocks": "error",
903
+ "eslint-js/no-restricted-syntax": [
904
+ "error",
905
+ {
906
+ "selector": "ForInStatement",
907
+ "message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
908
+ },
909
+ {
910
+ "selector": "LabeledStatement",
911
+ "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
912
+ },
913
+ {
914
+ "selector": "WithStatement",
915
+ "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
916
+ }
917
+ ],
918
+ "eslint-js/no-undef-init": "error",
884
919
  "regexp/confusing-quantifier": "warn",
885
920
  "regexp/control-character-escape": "error",
886
921
  "regexp/match-any": "error",
@@ -941,6 +976,31 @@
941
976
  "regexp/sort-flags": "error",
942
977
  "regexp/strict": "error",
943
978
  "regexp/use-ignore-case": "error",
979
+ "unicorn-js/expiring-todo-comments": [
980
+ "error",
981
+ {
982
+ "terms": ["todo", "fixme", "xxx"],
983
+ "ignore": [],
984
+ "ignoreDates": false,
985
+ "ignoreDatesOnPullRequests": true,
986
+ "allowWarningComments": true
987
+ }
988
+ ],
989
+ "unicorn-js/no-unnecessary-polyfills": "error",
990
+ "unicorn-js/prefer-add-event-listener": [
991
+ "error",
992
+ {
993
+ "excludedPackages": ["koa", "sax"]
994
+ }
995
+ ],
996
+ "unicorn-js/prefer-json-parse-buffer": "error",
997
+ "unicorn-js/prefer-switch": [
998
+ "error",
999
+ {
1000
+ "minimumCases": 3,
1001
+ "emptyDefaultCase": "no-default-comment"
1002
+ }
1003
+ ],
944
1004
  "use-isnan": [
945
1005
  "error",
946
1006
  {
@@ -1004,6 +1064,7 @@
1004
1064
  "no-with": "off",
1005
1065
  "prefer-promise-reject-errors": "off",
1006
1066
  "require-await": "off",
1067
+ "eslint-js/dot-notation": "off",
1007
1068
  "import/named": "off",
1008
1069
  "import/no-anonymous-default-export": [
1009
1070
  "error",
package/oxlint/node.json CHANGED
@@ -1,11 +1,23 @@
1
1
  {
2
2
  "plugins": ["node"],
3
3
  "jsPlugins": [
4
- { "name": "@pob", "specifier": "../lib/oxlint-plugins/pob.js" }
4
+ { "name": "@pob", "specifier": "../lib/oxlint-plugins/pob.js" },
5
+ { "name": "node-js", "specifier": "../lib/oxlint-plugins/n.js" }
5
6
  ],
6
7
  "rules": {
7
8
  "@pob/forbid-non-native-node-imports": "error",
8
- "node/no-exports-assign": "error"
9
+ "node/no-exports-assign": "error",
10
+ "node-js/no-deprecated-api": "error",
11
+ "node-js/no-unpublished-bin": "error",
12
+ "node-js/no-unsupported-features/es-builtins": "error",
13
+ "node-js/no-unsupported-features/es-syntax": [
14
+ "error",
15
+ { "ignores": ["modules"] }
16
+ ],
17
+ "node-js/no-unsupported-features/node-builtins": [
18
+ "error",
19
+ { "ignores": ["localStorage", "sessionStorage", "Storage"] }
20
+ ]
9
21
  },
10
22
  "overrides": [
11
23
  {
@@ -18,7 +30,11 @@
18
30
  "files": ["**/*.{cjs,cts}"],
19
31
  "rules": {
20
32
  "node/no-new-require": "error",
21
- "node/no-path-concat": "error"
33
+ "node/no-path-concat": "error",
34
+ "node-js/no-unsupported-features/es-syntax": [
35
+ "error",
36
+ { "ignores": [] }
37
+ ]
22
38
  }
23
39
  },
24
40
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-config",
3
- "version": "67.10.0",
3
+ "version": "67.11.0",
4
4
  "description": "eslint config files",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/christophehurpeau/pob",
@@ -52,6 +52,7 @@
52
52
  "dependencies": {
53
53
  "@eslint/js": "^10.0.1",
54
54
  "@eslint/json": "^1.2.0",
55
+ "@pob/eslint-plugin": "66.5.0",
55
56
  "@typescript-eslint/eslint-plugin": "8.63.0",
56
57
  "@typescript-eslint/parser": "8.63.0",
57
58
  "check-package-dependencies": "^13.2.0",
@@ -60,11 +61,10 @@
60
61
  "eslint-plugin-n": "^17.24.0",
61
62
  "eslint-plugin-regexp": "^3.1.0",
62
63
  "eslint-plugin-unicorn": "^64.0.0",
63
- "typescript-eslint": "^8.63.0",
64
- "@pob/eslint-plugin": "66.4.0"
64
+ "typescript-eslint": "^8.63.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@types/node": "24.13.3",
67
+ "@types/node": "24.19.1",
68
68
  "eslint": "10.8.1",
69
69
  "eslint-plugin-import-x": "4.17.1",
70
70
  "eslint-plugin-n": "17.24.0",