@foray1010/eslint-config 16.1.0 → 17.0.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/CHANGELOG.md +26 -0
- package/README.md +75 -76
- package/bases/base.mjs +10 -2
- package/constants.mjs +0 -1
- package/package.json +21 -20
- package/tsconfig.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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
|
+
## [17.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@16.1.0...@foray1010/eslint-config@17.0.0) (2026-05-17)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- drop node v20 and v25
|
|
11
|
+
- **deps:** require typescript `^6.0.3`
|
|
12
|
+
- **eslint-config:** require eslint `^10.3.0`
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **eslint-config:** encourage to use named parameters
|
|
17
|
+
- **eslint-config:** require eslint `^10.3.0`
|
|
18
|
+
- **eslint-config:** update eslint-plugin-unicorn to v64 (major)
|
|
19
|
+
- support es2024
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **eslint-config:** update eslint-plugin-compat to v7 (major)
|
|
24
|
+
- **eslint-config:** update eslint-plugin-n to v18 (major)
|
|
25
|
+
- **eslint-config:** update eslint-plugin-simple-import-sort to v13 (major)
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
- **deps:** require typescript `^6.0.3`
|
|
30
|
+
- drop node v20 and v25
|
|
31
|
+
|
|
6
32
|
## [16.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@16.0.1...@foray1010/eslint-config@16.1.0) (2026-01-24)
|
|
7
33
|
|
|
8
34
|
### Features
|
package/README.md
CHANGED
|
@@ -21,86 +21,85 @@ Z for looser rules
|
|
|
21
21
|
1. `yarn add -DE @foray1010/eslint-config eslint prettier`
|
|
22
22
|
|
|
23
23
|
2. Create an `eslint.config.js` in the project root
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
24
|
+
- For general purpose or Node.js project (support TypeScript)
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import {
|
|
28
|
+
eslintIgnoresConfig,
|
|
29
|
+
eslintNodeConfig,
|
|
30
|
+
} from '@foray1010/eslint-config'
|
|
31
|
+
import { defineConfig } from 'eslint/config'
|
|
32
|
+
|
|
33
|
+
const config = defineConfig(eslintIgnoresConfig, eslintNodeConfig)
|
|
34
|
+
export default config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- For general frontend projects (support TypeScript)
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import {
|
|
41
|
+
eslintIgnoresConfig,
|
|
42
|
+
eslintBrowserConfig,
|
|
43
|
+
} from '@foray1010/eslint-config'
|
|
44
|
+
import { defineConfig } from 'eslint/config'
|
|
45
|
+
|
|
46
|
+
const config = defineConfig(eslintIgnoresConfig, eslintBrowserConfig)
|
|
47
|
+
export default config
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- For frontend React projects (support TypeScript)
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import {
|
|
54
|
+
eslintIgnoresConfig,
|
|
55
|
+
eslintReactConfig,
|
|
56
|
+
} from '@foray1010/eslint-config'
|
|
57
|
+
import { defineConfig } from 'eslint/config'
|
|
58
|
+
|
|
59
|
+
const config = defineConfig(eslintIgnoresConfig, eslintReactConfig)
|
|
60
|
+
export default config
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- You can apply config per different directories
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import {
|
|
67
|
+
eslintIgnoresConfig,
|
|
68
|
+
eslintNodeConfig,
|
|
69
|
+
eslintReactConfig,
|
|
70
|
+
} from '@foray1010/eslint-config'
|
|
71
|
+
import { defineConfig } from 'eslint/config'
|
|
72
|
+
|
|
73
|
+
const config = defineConfig(
|
|
74
|
+
eslintIgnoresConfig,
|
|
75
|
+
{
|
|
76
|
+
ignores: ['src/**'],
|
|
77
|
+
extends: [eslintNodeConfig],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
files: ['src/**'],
|
|
81
|
+
extends: [eslintReactConfig],
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
export default config
|
|
85
|
+
```
|
|
87
86
|
|
|
88
87
|
3. If the project support ES Modules, you can directly use `eslint` command with the following setting in `package.json`.
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"type": "module"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
95
94
|
|
|
96
95
|
4. If the project does not support ES Modules, you have to put the config in `eslint.config.mjs` instead, and use the following npm script in `package.json`. Note that your editor may not support custom eslint config path and may not work properly.
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"scripts": {
|
|
100
|
+
"eslint": "ESLINT_USE_FLAT_CONFIG=true eslint --config eslint.config.mjs"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
then use `npm run eslint` or `yarn eslint` to replace `eslint`
|
package/bases/base.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import js from '@eslint/js'
|
|
3
3
|
import eslintPluginEslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
4
4
|
import { hasDep, isESM } from '@foray1010/common-presets-utils'
|
|
5
|
+
import eslintPluginFoxglove from '@foxglove/eslint-plugin'
|
|
5
6
|
import { defineConfig } from 'eslint/config'
|
|
6
7
|
import eslintPluginImportX from 'eslint-plugin-import-x'
|
|
7
8
|
import eslintPluginJest from 'eslint-plugin-jest'
|
|
@@ -31,6 +32,9 @@ async function generateTypeScriptConfig() {
|
|
|
31
32
|
eslintPluginImportX.configs['typescript'],
|
|
32
33
|
esmConfig,
|
|
33
34
|
],
|
|
35
|
+
plugins: {
|
|
36
|
+
'@foxglove': eslintPluginFoxglove,
|
|
37
|
+
},
|
|
34
38
|
languageOptions: {
|
|
35
39
|
parserOptions: {
|
|
36
40
|
// faster linting on cli
|
|
@@ -41,6 +45,8 @@ async function generateTypeScriptConfig() {
|
|
|
41
45
|
},
|
|
42
46
|
},
|
|
43
47
|
rules: {
|
|
48
|
+
// promote named parameters by disallowing boolean parameters (boolean trap)
|
|
49
|
+
'@foxglove/no-boolean-parameters': 'error',
|
|
44
50
|
// separate type exports which allow certain optimizations within compilers
|
|
45
51
|
'@typescript-eslint/consistent-type-exports': [
|
|
46
52
|
'error',
|
|
@@ -305,9 +311,9 @@ const baseConfig = defineConfig(
|
|
|
305
311
|
reportUnusedInlineConfigs: 'error',
|
|
306
312
|
},
|
|
307
313
|
languageOptions: {
|
|
308
|
-
ecmaVersion:
|
|
314
|
+
ecmaVersion: 2024,
|
|
309
315
|
globals: {
|
|
310
|
-
...globals.
|
|
316
|
+
...globals.es2024,
|
|
311
317
|
/* Not using `node` to explicitly import node.js only built-in modules, e.g.
|
|
312
318
|
* import { Buffer } from 'node:buffer'
|
|
313
319
|
* import process from 'node:process'
|
|
@@ -318,6 +324,8 @@ const baseConfig = defineConfig(
|
|
|
318
324
|
rules: {
|
|
319
325
|
// always use named function for easier to debug via stack trace
|
|
320
326
|
'func-names': ['error', 'as-needed'],
|
|
327
|
+
// promote named parameters by limiting function parameters
|
|
328
|
+
'max-params': ['error', { max: 3, countThis: 'never' }],
|
|
321
329
|
// prefer explicitly convert type for readability
|
|
322
330
|
'no-implicit-coercion': 'error',
|
|
323
331
|
// make sure private class members are in-use
|
package/constants.mjs
CHANGED
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": "
|
|
4
|
+
"version": "17.0.0",
|
|
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,36 +20,37 @@
|
|
|
20
20
|
"type:check": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
24
|
-
"@eslint/js": "^
|
|
25
|
-
"@foray1010/common-presets-utils": "^
|
|
23
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
24
|
+
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@foray1010/common-presets-utils": "^10.0.0",
|
|
26
|
+
"@foxglove/eslint-plugin": "^2.1.2",
|
|
26
27
|
"confusing-browser-globals": "^1.0.11",
|
|
27
28
|
"eslint-config-prettier": "^10.1.8",
|
|
28
29
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
29
|
-
"eslint-plugin-compat": "^
|
|
30
|
-
"eslint-plugin-import-x": "^4.16.
|
|
31
|
-
"eslint-plugin-jest": "^29.
|
|
30
|
+
"eslint-plugin-compat": "^7.0.2",
|
|
31
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
32
|
+
"eslint-plugin-jest": "^29.15.2",
|
|
32
33
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
33
34
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
34
|
-
"eslint-plugin-n": "^
|
|
35
|
-
"eslint-plugin-prettier": "^5.5.
|
|
35
|
+
"eslint-plugin-n": "^18.0.1",
|
|
36
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
36
37
|
"eslint-plugin-react": "^7.37.5",
|
|
37
|
-
"eslint-plugin-react-hooks": "^7.
|
|
38
|
-
"eslint-plugin-regexp": "^3.
|
|
39
|
-
"eslint-plugin-simple-import-sort": "^
|
|
40
|
-
"eslint-plugin-testing-library": "^7.
|
|
41
|
-
"eslint-plugin-unicorn": "^
|
|
42
|
-
"globals": "^17.
|
|
43
|
-
"typescript-eslint": "^8.
|
|
38
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
39
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
40
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
41
|
+
"eslint-plugin-testing-library": "^7.16.2",
|
|
42
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
43
|
+
"globals": "^17.6.0",
|
|
44
|
+
"typescript-eslint": "^8.59.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/confusing-browser-globals": "1.0.3"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@testing-library/dom": "^10.4.1",
|
|
50
|
-
"eslint": "^
|
|
51
|
+
"eslint": "^10.3.0",
|
|
51
52
|
"prettier": "^3.6.2",
|
|
52
|
-
"typescript": "^
|
|
53
|
+
"typescript": "^6.0.3"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
56
|
"@testing-library/dom": {
|
|
@@ -60,10 +61,10 @@
|
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
|
-
"node": "^
|
|
64
|
+
"node": "^22.12.0 || ^24.11.0 || >=26"
|
|
64
65
|
},
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b0dcdf4522afb97a5ee7088c20299aad17738056"
|
|
69
70
|
}
|