@foray1010/eslint-config 8.0.1 → 9.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 +31 -0
- package/{index.js → index.cjs} +1 -1
- package/package.json +15 -15
- package/presets/{base.js → base.cjs} +19 -2
- package/presets/{browser.js → browser.cjs} +0 -0
- package/presets/{node.js → node.cjs} +2 -2
- package/presets/{react.js → react.cjs} +1 -1
- package/presets/utils/{testUtil.js → testUtil.cjs} +0 -0
- package/react.cjs +9 -0
- package/react.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
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
|
+
## [9.0.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@9.0.0...@foray1010/eslint-config@9.0.1) (2022-11-07)
|
|
7
|
+
|
|
8
|
+
### Reverts
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** does not report error when importing ts files without extension ([faeee28](https://github.com/foray1010/common-presets/commit/faeee281cd40ba6b22835ae5b8c9cd6d69d3815e))
|
|
11
|
+
|
|
12
|
+
## [9.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@8.0.1...@foray1010/eslint-config@9.0.0) (2022-11-07)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
- drop nodejs 14.17 and 18.11
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **eslint-config:** disallow builtins to be created without `new` operator ([1c0c1a8](https://github.com/foray1010/common-presets/commit/1c0c1a86bbaf8a7c2bfcbd7998041418329fc8e2))
|
|
21
|
+
- **eslint-config:** disallow duplicated value in enum as it is error-prone ([5795a82](https://github.com/foray1010/common-presets/commit/5795a82945eaeec967a8403e167defbe587b4583))
|
|
22
|
+
- **eslint-config:** enable @typescript-eslint/no-unsafe-declaration-merging ([1b4abe2](https://github.com/foray1010/common-presets/commit/1b4abe27a5322729321b61f5d406cf9af7aaf51a))
|
|
23
|
+
- **eslint-config:** make sure functions which return a promise will just return a rejected promise ([06603f4](https://github.com/foray1010/common-presets/commit/06603f42098f5492037c0114ecc50fac623a11c3))
|
|
24
|
+
- **eslint-config:** prefer node protocol ([204e5c1](https://github.com/foray1010/common-presets/commit/204e5c168aacaa020d2481306489724dfd6da7bc))
|
|
25
|
+
- **eslint-config:** require switch-case statements to be exhaustive with union type ([2b13aa6](https://github.com/foray1010/common-presets/commit/2b13aa60c1622a75f4a84133b3bf31b90b676057))
|
|
26
|
+
- **eslint-config:** separate type exports which allow certain optimizations within compilers ([bbc6b9b](https://github.com/foray1010/common-presets/commit/bbc6b9b9a83fecf552ed85be838693ec04c8b149))
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
- **deps:** update dependency eslint-import-resolver-typescript to v3 ([0ff474e](https://github.com/foray1010/common-presets/commit/0ff474ef79193b53a29ea0ad7026e3cc12e1227e))
|
|
31
|
+
- **eslint-config:** does not report error when importing ts files without extension ([aea8307](https://github.com/foray1010/common-presets/commit/aea83079cae7967c405a38599b2ad63169cf8be6))
|
|
32
|
+
|
|
33
|
+
### Miscellaneous Chores
|
|
34
|
+
|
|
35
|
+
- drop nodejs 14.17 and 18.11 ([8e5c967](https://github.com/foray1010/common-presets/commit/8e5c9677b89d38c88de465f069bb5de683a8a40b))
|
|
36
|
+
|
|
6
37
|
## [8.0.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@8.0.0...@foray1010/eslint-config@8.0.1) (2022-10-22)
|
|
7
38
|
|
|
8
39
|
### Bug Fixes
|
package/{index.js → index.cjs}
RENAMED
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": "9.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": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"exports": {
|
|
14
|
-
".": "./index.
|
|
15
|
-
"./react": "./react.
|
|
14
|
+
".": "./index.cjs",
|
|
15
|
+
"./react": "./react.cjs"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"**/*.{cjs,js,json,mjs}",
|
|
@@ -23,41 +23,41 @@
|
|
|
23
23
|
"type:check": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@foray1010/common-presets-utils": "^
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
26
|
+
"@foray1010/common-presets-utils": "^6.0.0",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
28
|
+
"@typescript-eslint/parser": "^5.42.1",
|
|
29
29
|
"confusing-browser-globals": "^1.0.10",
|
|
30
30
|
"eslint-config-prettier": "^8.3.0",
|
|
31
|
-
"eslint-import-resolver-typescript": "^
|
|
31
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
32
32
|
"eslint-plugin-compat": "^4.0.0",
|
|
33
33
|
"eslint-plugin-deprecation": "^1.3.2",
|
|
34
34
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
35
35
|
"eslint-plugin-functional": "^4.4.1",
|
|
36
36
|
"eslint-plugin-import": "^2.22.1",
|
|
37
|
-
"eslint-plugin-jest": "^27.
|
|
37
|
+
"eslint-plugin-jest": "^27.1.3",
|
|
38
38
|
"eslint-plugin-jest-dom": "^4.0.0",
|
|
39
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
39
|
+
"eslint-plugin-jsdoc": "^39.3.25",
|
|
40
40
|
"eslint-plugin-n": "^15.3.0",
|
|
41
41
|
"eslint-plugin-prettier": "^4.0.0",
|
|
42
|
-
"eslint-plugin-react": "^7.31.
|
|
42
|
+
"eslint-plugin-react": "^7.31.10",
|
|
43
43
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
44
44
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
45
|
-
"eslint-plugin-testing-library": "^5.
|
|
46
|
-
"eslint-plugin-unicorn": "^
|
|
45
|
+
"eslint-plugin-testing-library": "^5.9.1",
|
|
46
|
+
"eslint-plugin-unicorn": "^44.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/confusing-browser-globals": "1.0.0",
|
|
50
|
-
"@types/eslint": "8.4.
|
|
50
|
+
"@types/eslint": "8.4.10"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"eslint": "^8.0.0",
|
|
54
54
|
"prettier": "^2.0.0"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": "^14.
|
|
57
|
+
"node": "^14.18.0 || ^16.13.0 || >=18.12.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "fb5476d1436d6a3c2295fa4753999c7e0bd00133"
|
|
63
63
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// @ts-expect-error
|
|
4
4
|
const { hasDep, isESM } = require('@foray1010/common-presets-utils')
|
|
5
5
|
|
|
6
|
-
const { testFileGlobs } = require('./utils/testUtil.
|
|
6
|
+
const { testFileGlobs } = require('./utils/testUtil.cjs')
|
|
7
7
|
|
|
8
8
|
/** @type {import('eslint').Linter.BaseConfig} */
|
|
9
9
|
const cjsConfig = {
|
|
@@ -78,7 +78,7 @@ module.exports = {
|
|
|
78
78
|
'always',
|
|
79
79
|
{
|
|
80
80
|
pattern: {
|
|
81
|
-
//
|
|
81
|
+
// eslint-plugin-import does not support checking es modules in typescript files
|
|
82
82
|
cts: 'never',
|
|
83
83
|
mts: 'never',
|
|
84
84
|
ts: 'never',
|
|
@@ -139,8 +139,15 @@ module.exports = {
|
|
|
139
139
|
'jsdoc/valid-types': 'off',
|
|
140
140
|
// avoid assigning anonymous function to object key which is harder to trace when debug
|
|
141
141
|
'object-shorthand': ['error', 'always'],
|
|
142
|
+
// use with `unicorn/throw-new-error`
|
|
143
|
+
// disallow builtins to be created without `new` operator, to be consistent with es6 class syntax
|
|
144
|
+
'unicorn/new-for-builtins': 'error',
|
|
145
|
+
// prefer `import from 'node:xxx'`
|
|
146
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
142
147
|
// prefer Number static properties over global ones
|
|
143
148
|
'unicorn/prefer-number-properties': 'error',
|
|
149
|
+
// use with `unicorn/new-for-builtins`
|
|
150
|
+
'unicorn/throw-new-error': 'error',
|
|
144
151
|
},
|
|
145
152
|
overrides: [
|
|
146
153
|
{
|
|
@@ -210,6 +217,8 @@ module.exports = {
|
|
|
210
217
|
extendDefaults: true,
|
|
211
218
|
},
|
|
212
219
|
],
|
|
220
|
+
// separate type exports which allow certain optimizations within compilers
|
|
221
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
213
222
|
// separate type imports which allow certain optimizations within compilers
|
|
214
223
|
'@typescript-eslint/consistent-type-imports': [
|
|
215
224
|
'error',
|
|
@@ -233,6 +242,8 @@ module.exports = {
|
|
|
233
242
|
],
|
|
234
243
|
// sometimes auto detect can provide a better and narrower type
|
|
235
244
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
245
|
+
// disallow duplicated value in enum as it is error-prone
|
|
246
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
236
247
|
// need empty function for react context default value
|
|
237
248
|
'@typescript-eslint/no-empty-function': 'off',
|
|
238
249
|
// encourage to check error type before use in catch clauses
|
|
@@ -244,6 +255,8 @@ module.exports = {
|
|
|
244
255
|
'error',
|
|
245
256
|
{ checksVoidReturn: false },
|
|
246
257
|
],
|
|
258
|
+
// declaration merging between classes and interfaces is unsafe
|
|
259
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
247
260
|
// do not block functions referring to other functions
|
|
248
261
|
'@typescript-eslint/no-use-before-define': [
|
|
249
262
|
'error',
|
|
@@ -265,6 +278,8 @@ module.exports = {
|
|
|
265
278
|
// use with functional/prefer-readonly-type
|
|
266
279
|
// mark class variables as readonly if it is not mutated
|
|
267
280
|
'@typescript-eslint/prefer-readonly': 'error',
|
|
281
|
+
// make sure functions which return a promise will just return a rejected promise instead of throwing an error
|
|
282
|
+
'@typescript-eslint/promise-function-async': 'error',
|
|
268
283
|
// allow primitive value in template string
|
|
269
284
|
'@typescript-eslint/restrict-template-expressions': [
|
|
270
285
|
'error',
|
|
@@ -276,6 +291,8 @@ module.exports = {
|
|
|
276
291
|
allowRegExp: true,
|
|
277
292
|
},
|
|
278
293
|
],
|
|
294
|
+
// avoid missed switch-case by requiring switch-case statements to be exhaustive with union type
|
|
295
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
279
296
|
// ignore static function as those are not supposed to use `this`
|
|
280
297
|
'@typescript-eslint/unbound-method': [
|
|
281
298
|
'error',
|
|
File without changes
|
|
@@ -39,10 +39,10 @@ module.exports = {
|
|
|
39
39
|
'n/prefer-global/text-decoder': ['error', 'always'],
|
|
40
40
|
// prefer global `TextEncoder` to be isomorphic
|
|
41
41
|
'n/prefer-global/text-encoder': ['error', 'always'],
|
|
42
|
-
// prefer global `URLSearchParams` to be isomorphic
|
|
43
|
-
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
44
42
|
// prefer global `URL` to be isomorphic
|
|
45
43
|
'n/prefer-global/url': ['error', 'always'],
|
|
44
|
+
// prefer global `URLSearchParams` to be isomorphic
|
|
45
|
+
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
46
46
|
// make `process.exit()` expressions the same code path as `throw`
|
|
47
47
|
'n/process-exit-as-throw': 'error',
|
|
48
48
|
// enforce shebang on the entry bin file
|
|
File without changes
|
package/react.cjs
ADDED