@foray1010/eslint-config 7.4.0 → 7.5.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 +12 -0
- package/package.json +12 -12
- package/presets/base.js +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [7.5.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.4.1...@foray1010/eslint-config@7.5.0) (2022-09-28)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** prefer readonly types ([4996d63](https://github.com/foray1010/common-presets/commit/4996d63dc356ffd904ae931f2dbd32fd3312ec50))
|
|
11
|
+
|
|
12
|
+
## [7.4.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.4.0...@foray1010/eslint-config@7.4.1) (2022-09-23)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **eslint-config:** allow es2020 globals ([f5d8e61](https://github.com/foray1010/common-presets/commit/f5d8e61a9f22572d3523e833671a1c9b24dff568))
|
|
17
|
+
|
|
6
18
|
## [7.4.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.3.4...@foray1010/eslint-config@7.4.0) (2022-09-22)
|
|
7
19
|
|
|
8
20
|
### Features
|
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": "7.
|
|
4
|
+
"version": "7.5.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": {
|
|
@@ -23,28 +23,28 @@
|
|
|
23
23
|
"type:check": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@foray1010/common-presets-utils": "^5.0.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
26
|
+
"@foray1010/common-presets-utils": "^5.0.4",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
|
28
|
+
"@typescript-eslint/parser": "^5.38.1",
|
|
29
29
|
"confusing-browser-globals": "^1.0.10",
|
|
30
30
|
"eslint-config-prettier": "^8.3.0",
|
|
31
31
|
"eslint-plugin-compat": "^4.0.0",
|
|
32
32
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
33
|
+
"eslint-plugin-functional": "^4.4.0",
|
|
33
34
|
"eslint-plugin-import": "^2.22.1",
|
|
34
|
-
"eslint-plugin-jest": "^27.0.
|
|
35
|
+
"eslint-plugin-jest": "^27.0.4",
|
|
35
36
|
"eslint-plugin-jest-dom": "^4.0.0",
|
|
36
|
-
"eslint-plugin-jsdoc": "^39.
|
|
37
|
-
"eslint-plugin-n": "^15.
|
|
37
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
38
|
+
"eslint-plugin-n": "^15.3.0",
|
|
38
39
|
"eslint-plugin-prettier": "^4.0.0",
|
|
39
|
-
"eslint-plugin-react": "^7.
|
|
40
|
+
"eslint-plugin-react": "^7.31.8",
|
|
40
41
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
41
42
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
42
|
-
"eslint-plugin-testing-library": "^5.
|
|
43
|
+
"eslint-plugin-testing-library": "^5.7.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@types/confusing-browser-globals": "1.0.0",
|
|
46
|
-
"@types/eslint": "8.4.6"
|
|
47
|
-
"typescript": "4.8.3"
|
|
47
|
+
"@types/eslint": "8.4.6"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"eslint": "^8.0.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "32f909d569229f0358d66f7c8295a1d15e5c3de3"
|
|
60
60
|
}
|
package/presets/base.js
CHANGED
|
@@ -50,6 +50,8 @@ module.exports = {
|
|
|
50
50
|
'eslint-plugin-simple-import-sort',
|
|
51
51
|
],
|
|
52
52
|
env: {
|
|
53
|
+
// should align with parserOptions.ecmaVersion
|
|
54
|
+
es2020: true,
|
|
53
55
|
/* Not using `node` to explicitly import node.js only built-in modules, e.g.
|
|
54
56
|
* import { Buffer } from 'node:buffer'
|
|
55
57
|
* import process from 'node:process'
|
|
@@ -157,7 +159,10 @@ module.exports = {
|
|
|
157
159
|
project: ['./tsconfig*.json', './packages/*/tsconfig*.json'],
|
|
158
160
|
sourceType: 'module',
|
|
159
161
|
},
|
|
160
|
-
plugins: [
|
|
162
|
+
plugins: [
|
|
163
|
+
'@typescript-eslint/eslint-plugin',
|
|
164
|
+
'eslint-plugin-functional',
|
|
165
|
+
],
|
|
161
166
|
rules: {
|
|
162
167
|
// extend existing rule
|
|
163
168
|
'@typescript-eslint/ban-types': [
|
|
@@ -227,6 +232,9 @@ module.exports = {
|
|
|
227
232
|
typedefs: false,
|
|
228
233
|
},
|
|
229
234
|
],
|
|
235
|
+
// use with functional/prefer-readonly-type
|
|
236
|
+
// mark class variables as readonly if it is not mutated
|
|
237
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
230
238
|
// fault alarms in 4.29.3
|
|
231
239
|
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
232
240
|
// allow primitive value in template string
|
|
@@ -245,6 +253,18 @@ module.exports = {
|
|
|
245
253
|
'error',
|
|
246
254
|
{ ignoreStatic: true },
|
|
247
255
|
],
|
|
256
|
+
// use with @typescript-eslint/prefer-readonly
|
|
257
|
+
'functional/prefer-readonly-type': [
|
|
258
|
+
'error',
|
|
259
|
+
{
|
|
260
|
+
// sometimes it is easier to mutate, it should be fine to mutate within local scope
|
|
261
|
+
allowLocalMutation: true,
|
|
262
|
+
// don't force library consumer to use readonly type
|
|
263
|
+
allowMutableReturnType: true,
|
|
264
|
+
// allow mutating class variables
|
|
265
|
+
ignoreClass: 'fieldsOnly',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
248
268
|
},
|
|
249
269
|
overrides: [
|
|
250
270
|
{
|