@foray1010/eslint-config 12.4.0 → 13.0.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [13.0.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@13.0.0...@foray1010/eslint-config@13.0.1) (2024-08-27)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **eslint-config:** fix errors when uses with eslint v9 ([9e2bc51](https://github.com/foray1010/common-presets/commit/9e2bc512f84b91963955e0558b7346bb27ba1365))
11
+
12
+ ## [13.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@12.4.0...@foray1010/eslint-config@13.0.0) (2024-08-27)
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ - **eslint-config:** require node `^18.18.0 || >=20.9.0`
17
+
18
+ ### Features
19
+
20
+ - **eslint-config:** require eslint v9 ([198866f](https://github.com/foray1010/common-presets/commit/198866f67ec6f9d534d71878c4a72e8af517d1f0))
21
+
22
+ ### Bug Fixes
23
+
24
+ - **deps:** update dependency eslint-plugin-functional to v7 ([3762aa6](https://github.com/foray1010/common-presets/commit/3762aa6819c8efe24b6426b75d385c1991b0e8c4))
25
+ - **deps:** update dependency eslint-plugin-import-x to v4 ([8e5d140](https://github.com/foray1010/common-presets/commit/8e5d140f6e7b8541f17d25a6f47ea75070ffbdd5))
26
+ - **eslint-config:** replace eslint-plugin-deprecation by typescript-eslint ([7b1e637](https://github.com/foray1010/common-presets/commit/7b1e637d55f54f5996451025112257327a6905cf))
27
+
6
28
  ## [12.4.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@12.3.1...@foray1010/eslint-config@12.4.0) (2024-08-20)
7
29
 
8
30
  ### Features
package/bases/base.mjs CHANGED
@@ -23,8 +23,7 @@ async function generateTypeScriptConfig() {
23
23
 
24
24
  // eslint-disable-next-line import-x/no-unresolved
25
25
  const tseslint = (await import('typescript-eslint')).default
26
- const eslintPluginDeprecation = (await import('eslint-plugin-deprecation'))
27
- .default
26
+ // eslint-disable-next-line import-x/no-unresolved
28
27
  const eslintPluginFunctional = (await import('eslint-plugin-functional'))
29
28
  .default
30
29
 
@@ -52,7 +51,6 @@ async function generateTypeScriptConfig() {
52
51
  },
53
52
  },
54
53
  plugins: {
55
- deprecation: eslintPluginDeprecation,
56
54
  functional: eslintPluginFunctional,
57
55
  },
58
56
  rules: {
@@ -91,6 +89,8 @@ async function generateTypeScriptConfig() {
91
89
  ],
92
90
  // sometimes auto detect can provide a better and narrower type
93
91
  '@typescript-eslint/explicit-module-boundary-types': 'off',
92
+ // do not allow usage of deprecated code
93
+ '@typescript-eslint/no-deprecated': 'error',
94
94
  // disallow duplicated value in enum as it is error-prone
95
95
  '@typescript-eslint/no-duplicate-enum-values': 'error',
96
96
  // need empty function for react context default value
@@ -150,8 +150,6 @@ async function generateTypeScriptConfig() {
150
150
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
151
151
  // ignore static function as those are not supposed to use `this`
152
152
  '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
153
- // do not allow usage of deprecated code
154
- 'deprecation/deprecation': 'error',
155
153
  // use with functional/type-declaration-immutability
156
154
  'functional/prefer-immutable-types': [
157
155
  'error',
@@ -256,48 +254,13 @@ const baseConfig = [
256
254
  js.configs.recommended,
257
255
  eslintPluginRegexp.configs['flat/recommended'],
258
256
  {
259
- languageOptions: {
260
- ecmaVersion: 2023,
261
- globals: {
262
- ...globals.es2023,
263
- /* Not using `node` to explicitly import node.js only built-in modules, e.g.
264
- * import { Buffer } from 'node:buffer'
265
- * import process from 'node:process'
266
- */
267
- ...globals['shared-node-browser'],
268
- },
269
- },
270
- plugins: {
271
- '@eslint-community/eslint-comments': eslintPluginEslintComments,
272
- // @ts-expect-error Type is not compact with flat config
273
- 'import-x': eslintPluginImportX,
274
- unicorn: eslintPluginUnicorn,
275
- },
257
+ ...eslintPluginImportX.flatConfigs.recommended,
276
258
  rules: {
277
- ...eslintPluginEslintComments.configs['recommended']?.rules,
278
- ...eslintPluginImportX.configs['recommended']?.rules,
279
- ...Object.fromEntries(
280
- Object.entries(
281
- eslintPluginUnicorn.configs['flat/recommended']?.rules ?? {},
282
- ).filter(([ruleName]) => {
283
- // only use a subset of recommended rules as other rules are too strict
284
- return (
285
- ruleName.startsWith('unicorn/no-useless-') ||
286
- ruleName.startsWith('unicorn/prefer-')
287
- )
288
- }),
289
- ),
290
- // allow disable eslint rules for whole file without re-enable it in the end of the file
291
- '@eslint-community/eslint-comments/disable-enable-pair': [
292
- 'error',
293
- { allowWholeFile: true },
294
- ],
295
- // make sure every eslint-disable comments are in use
296
- '@eslint-community/eslint-comments/no-unused-disable': 'error',
297
- // always use named function for easier to debug via stack trace
298
- 'func-names': ['error', 'as-needed'],
259
+ ...eslintPluginImportX.flatConfigs.recommended.rules,
299
260
  // this rule doesn't support commonjs, some dependencies are using commonjs
300
261
  'import-x/default': 'off',
262
+ // Does not work after upgrading to eslint-plugin-import-x v4, got this error message: `sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options. (undefined:undefined)`
263
+ 'import-x/export': 'off',
301
264
  // enforce extensions for both cjs and esm
302
265
  'import-x/extensions': [
303
266
  'error',
@@ -365,6 +328,46 @@ const baseConfig = [
365
328
  'import-x/namespace': 'off',
366
329
  'import-x/no-named-as-default': 'off',
367
330
  'import-x/no-named-as-default-member': 'off',
331
+ },
332
+ },
333
+ {
334
+ languageOptions: {
335
+ ecmaVersion: 2023,
336
+ globals: {
337
+ ...globals.es2023,
338
+ /* Not using `node` to explicitly import node.js only built-in modules, e.g.
339
+ * import { Buffer } from 'node:buffer'
340
+ * import process from 'node:process'
341
+ */
342
+ ...globals['shared-node-browser'],
343
+ },
344
+ },
345
+ plugins: {
346
+ '@eslint-community/eslint-comments': eslintPluginEslintComments,
347
+ unicorn: eslintPluginUnicorn,
348
+ },
349
+ rules: {
350
+ ...eslintPluginEslintComments.configs['recommended']?.rules,
351
+ ...Object.fromEntries(
352
+ Object.entries(
353
+ eslintPluginUnicorn.configs['flat/recommended']?.rules ?? {},
354
+ ).filter(([ruleName]) => {
355
+ // only use a subset of recommended rules as other rules are too strict
356
+ return (
357
+ ruleName.startsWith('unicorn/no-useless-') ||
358
+ ruleName.startsWith('unicorn/prefer-')
359
+ )
360
+ }),
361
+ ),
362
+ // allow disable eslint rules for whole file without re-enable it in the end of the file
363
+ '@eslint-community/eslint-comments/disable-enable-pair': [
364
+ 'error',
365
+ { allowWholeFile: true },
366
+ ],
367
+ // make sure every eslint-disable comments are in use
368
+ '@eslint-community/eslint-comments/no-unused-disable': 'error',
369
+ // always use named function for easier to debug via stack trace
370
+ 'func-names': ['error', 'as-needed'],
368
371
  // prefer explicitly convert type for readability
369
372
  'no-implicit-coercion': 'error',
370
373
  // make sure private class members are in-use
package/bases/browser.mjs CHANGED
@@ -1,7 +1,7 @@
1
+ import { fixupPluginRules } from '@eslint/compat'
1
2
  import { hasDep } from '@foray1010/common-presets-utils'
2
3
  import restrictedGlobals from 'confusing-browser-globals'
3
4
  import eslintPluginCompat from 'eslint-plugin-compat'
4
- import eslintPluginImportX from 'eslint-plugin-import-x'
5
5
  import eslintPluginTestingLibrary from 'eslint-plugin-testing-library'
6
6
  import globals from 'globals'
7
7
 
@@ -37,8 +37,6 @@ const browserConfig = [
37
37
  },
38
38
  plugins: {
39
39
  compat: eslintPluginCompat,
40
- // @ts-expect-error Type is not compact with flat config
41
- 'import-x': eslintPluginImportX,
42
40
  },
43
41
  rules: {
44
42
  'compat/compat': 'error',
@@ -50,7 +48,12 @@ const browserConfig = [
50
48
  ...(await generateJestDomConfig()),
51
49
  {
52
50
  files: testFileGlobs,
53
- ...eslintPluginTestingLibrary.configs['flat/dom'],
51
+ plugins: {
52
+ 'testing-library': fixupPluginRules(eslintPluginTestingLibrary),
53
+ },
54
+ rules: {
55
+ ...eslintPluginTestingLibrary.configs['flat/dom']?.rules,
56
+ },
54
57
  },
55
58
  {
56
59
  files: testFileGlobs,
package/bases/react.mjs CHANGED
@@ -61,7 +61,10 @@ const reactConfig = [
61
61
  },
62
62
  {
63
63
  files: testFileGlobs,
64
- ...eslintPluginTestingLibrary.configs['flat/react'],
64
+ rules: {
65
+ // Do not use flat config directly as eslint v9 does not support duplicated plugins (already defined in browser.mjs)
66
+ ...eslintPluginTestingLibrary.configs['flat/react']?.rules,
67
+ },
65
68
  },
66
69
  {
67
70
  files: testFileGlobs,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@foray1010/eslint-config",
4
- "version": "12.4.0",
4
+ "version": "13.0.1",
5
5
  "homepage": "https://github.com/foray1010/common-presets/tree/master/packages/eslint-config#readme",
6
6
  "bugs": "https://github.com/foray1010/common-presets/issues",
7
7
  "repository": {
@@ -20,37 +20,37 @@
20
20
  "type:check": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
24
- "@eslint/js": "^8.53.0",
23
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
24
+ "@eslint/compat": "^1.1.1",
25
+ "@eslint/js": "^9.9.1",
25
26
  "@foray1010/common-presets-utils": "^8.0.0",
26
27
  "confusing-browser-globals": "^1.0.11",
27
28
  "eslint-config-prettier": "^9.1.0",
28
- "eslint-import-resolver-typescript": "^3.6.1",
29
+ "eslint-import-resolver-typescript": "^3.6.3",
29
30
  "eslint-plugin-compat": "^6.0.0",
30
- "eslint-plugin-deprecation": "^3.0.0",
31
- "eslint-plugin-functional": "^6.0.0",
32
- "eslint-plugin-import-x": "^3.0.1",
33
- "eslint-plugin-jest": "^28.6.0",
31
+ "eslint-plugin-functional": "^7.0.2",
32
+ "eslint-plugin-import-x": "^4.1.0",
33
+ "eslint-plugin-jest": "^28.8.0",
34
34
  "eslint-plugin-jest-dom": "^5.4.0",
35
- "eslint-plugin-n": "^17.0.0",
35
+ "eslint-plugin-n": "^17.10.2",
36
36
  "eslint-plugin-prettier": "^5.2.1",
37
37
  "eslint-plugin-react": "^7.35.0",
38
- "eslint-plugin-react-hooks": "^4.6.0",
38
+ "eslint-plugin-react-hooks": "^4.6.2",
39
39
  "eslint-plugin-regexp": "^2.6.0",
40
- "eslint-plugin-simple-import-sort": "^12.0.0",
40
+ "eslint-plugin-simple-import-sort": "^12.1.1",
41
41
  "eslint-plugin-testing-library": "^6.3.0",
42
42
  "eslint-plugin-unicorn": "^55.0.0",
43
- "globals": "^15.4.0",
44
- "typescript-eslint": "^8.0.0"
43
+ "globals": "^15.9.0",
44
+ "typescript-eslint": "^8.3.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/confusing-browser-globals": "1.0.3",
48
- "@types/eslint": "8.56.11",
48
+ "@types/eslint": "9.6.1",
49
49
  "@types/eslint__js": "8.42.3"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@testing-library/dom": "^10.0.0",
53
- "eslint": "^8.52.0",
53
+ "eslint": "^9.0.0",
54
54
  "prettier": "^3.0.0",
55
55
  "typescript": "^5.0.2"
56
56
  },
@@ -63,10 +63,10 @@
63
63
  }
64
64
  },
65
65
  "engines": {
66
- "node": "^18.12.0 || >=20.9.0"
66
+ "node": "^18.18.0 || >=20.9.0"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "fae1085ef22d08177b22034905e40dd23a80b95a"
71
+ "gitHead": "96a15140fa887ba923ba9706b55e1cf1c3af48d9"
72
72
  }