@foray1010/eslint-config 10.0.5 → 10.2.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 +20 -0
- package/bases/base.mjs +15 -1
- package/bases/node.mjs +12 -0
- package/bases/react.mjs +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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
|
+
## [10.2.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.1.0...@foray1010/eslint-config@10.2.0) (2023-03-29)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- enable @typescript-eslint/no-unused-vars ([ff31b94](https://github.com/foray1010/common-presets/commit/ff31b94884796f00723f396469d53ea747109ff9))
|
|
11
|
+
- **eslint-config:** enable n/no-process-exit ([9e9ddce](https://github.com/foray1010/common-presets/commit/9e9ddce3d43dad54fc9570e7f99bf7a6d3be009e))
|
|
12
|
+
- **eslint-config:** enable react/jsx-no-leaked-render ([d65d8b4](https://github.com/foray1010/common-presets/commit/d65d8b4a83c50b050ce2ab68701c691b9c885cbf))
|
|
13
|
+
- **eslint-config:** enable react/no-object-type-as-default-prop ([79c1639](https://github.com/foray1010/common-presets/commit/79c163963a3eaac503e79376ccf880b0165e6556))
|
|
14
|
+
- **eslint-config:** prefer inline exports ([2a9de59](https://github.com/foray1010/common-presets/commit/2a9de5940a042607bc9556989937647d98236f86))
|
|
15
|
+
|
|
16
|
+
### Reverts
|
|
17
|
+
|
|
18
|
+
- Revert "fix(eslint-config): disable n/prefer-global hacks as they do not work with flat config" ([1e02034](https://github.com/foray1010/common-presets/commit/1e02034f6a5ec5d7d19230ddebcbcbf64e682022))
|
|
19
|
+
|
|
20
|
+
## [10.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.0.5...@foray1010/eslint-config@10.1.0) (2023-03-27)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- **eslint-config:** use inline type imports to avoid duplicate imports ([b6741bb](https://github.com/foray1010/common-presets/commit/b6741bbe0a95a579d1ae85ee32a1c75c309d20a9))
|
|
25
|
+
|
|
6
26
|
## [10.0.5](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.0.4...@foray1010/eslint-config@10.0.5) (2023-03-24)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
package/bases/base.mjs
CHANGED
|
@@ -79,12 +79,19 @@ async function generateTypeScriptConfig() {
|
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
// separate type exports which allow certain optimizations within compilers
|
|
82
|
-
'@typescript-eslint/consistent-type-exports':
|
|
82
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
83
|
+
'error',
|
|
84
|
+
{
|
|
85
|
+
fixMixedExportsWithInlineTypeSpecifier: true,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
83
88
|
'@typescript-eslint/consistent-type-imports': [
|
|
84
89
|
'error',
|
|
85
90
|
{
|
|
86
91
|
// separate type imports which allow certain optimizations within compilers
|
|
87
92
|
prefer: 'type-imports',
|
|
93
|
+
// Use inline type imports to avoid duplicate imports, but can be overridden by @typescript-eslint/no-import-type-side-effects
|
|
94
|
+
fixStyle: 'inline-type-imports',
|
|
88
95
|
},
|
|
89
96
|
],
|
|
90
97
|
// disable the base rule as it can report incorrect errors, use @typescript-eslint/dot-notation instead
|
|
@@ -122,6 +129,13 @@ async function generateTypeScriptConfig() {
|
|
|
122
129
|
],
|
|
123
130
|
// declaration merging between classes and interfaces is unsafe
|
|
124
131
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
132
|
+
'@typescript-eslint/no-unused-vars': [
|
|
133
|
+
'error',
|
|
134
|
+
{
|
|
135
|
+
// error is optional now
|
|
136
|
+
caughtErrors: 'all',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
125
139
|
// do not block functions referring to other functions
|
|
126
140
|
'@typescript-eslint/no-use-before-define': [
|
|
127
141
|
'error',
|
package/bases/node.mjs
CHANGED
|
@@ -20,11 +20,23 @@ const nodeConfig = [
|
|
|
20
20
|
plugins: {
|
|
21
21
|
n: eslintPluginN,
|
|
22
22
|
},
|
|
23
|
+
languageOptions: {
|
|
24
|
+
globals: {
|
|
25
|
+
// hack to mute no-undef error, and show n/prefer-global/buffer error instead
|
|
26
|
+
// @ts-expect-error
|
|
27
|
+
Buffer: 'writable',
|
|
28
|
+
// hack to mute no-undef error, and show n/prefer-global/process error instead
|
|
29
|
+
// @ts-expect-error
|
|
30
|
+
process: 'writable',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
23
33
|
rules: {
|
|
24
34
|
// disallow deprecated node APIs
|
|
25
35
|
'n/no-deprecated-api': 'error',
|
|
26
36
|
// disallow the assignment to `exports`
|
|
27
37
|
'n/no-exports-assign': 'error',
|
|
38
|
+
// use process.exitCode instead
|
|
39
|
+
'n/no-process-exit': 'error',
|
|
28
40
|
// disallow `bin` files that npm ignores
|
|
29
41
|
'n/no-unpublished-bin': 'error',
|
|
30
42
|
// disallow unsupported Node.js built-in APIs on the specified version
|
package/bases/react.mjs
CHANGED
|
@@ -31,6 +31,8 @@ const reactConfig = [
|
|
|
31
31
|
...eslintPluginReactHooks.configs['recommended']?.rules,
|
|
32
32
|
// avoid unexpected form submits
|
|
33
33
|
'react/button-has-type': 'error',
|
|
34
|
+
// avoid displaying unexpected value, and align coding style with react native
|
|
35
|
+
'react/jsx-no-leaked-render': 'error',
|
|
34
36
|
'react/jsx-no-useless-fragment': [
|
|
35
37
|
'error',
|
|
36
38
|
{
|
|
@@ -50,6 +52,8 @@ const reactConfig = [
|
|
|
50
52
|
shorthandLast: false,
|
|
51
53
|
},
|
|
52
54
|
],
|
|
55
|
+
// avoid unexpected react hook dead loops
|
|
56
|
+
'react/no-object-type-as-default-prop': 'error',
|
|
53
57
|
// rely on typescript instead, and it does not work well with types that are imported from elsewhere
|
|
54
58
|
'react/prop-types': 'off',
|
|
55
59
|
// avoid unnecessary closing tags
|
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": "10.0
|
|
4
|
+
"version": "10.2.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": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
|
|
24
24
|
"@eslint/js": "^8.36.0",
|
|
25
|
-
"@foray1010/common-presets-utils": "^7.0.
|
|
25
|
+
"@foray1010/common-presets-utils": "^7.0.2",
|
|
26
26
|
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
27
27
|
"@typescript-eslint/parser": "^5.56.0",
|
|
28
28
|
"confusing-browser-globals": "^1.0.10",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "d413c514ed4534c77b3ca52b11b7bdd2084f0185"
|
|
68
68
|
}
|