@foray1010/eslint-config 7.7.3 → 7.9.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 CHANGED
@@ -3,6 +3,23 @@
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.9.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.8.0...@foray1010/eslint-config@7.9.0) (2022-10-07)
7
+
8
+ ### Features
9
+
10
+ - use indexed syntax for accessing undefined fields ([7c1f9d6](https://github.com/foray1010/common-presets/commit/7c1f9d63349f0b34b00aa8608d6908763d964c3e))
11
+
12
+ ### Bug Fixes
13
+
14
+ - **eslint-config:** enforce accessibility modifier in constructor in TS ([7cb3f2b](https://github.com/foray1010/common-presets/commit/7cb3f2b9f5de215255b1a541bac3cc1bd731589c))
15
+
16
+ ## [7.8.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.7.3...@foray1010/eslint-config@7.8.0) (2022-10-03)
17
+
18
+ ### Features
19
+
20
+ - **eslint-config:** prefer Number static properties over global ones ([532df43](https://github.com/foray1010/common-presets/commit/532df43987f464ea3f3cfe1e5507b1077e14bced))
21
+ - **eslint-config:** re-enable functional/prefer-tacit ([9f312cc](https://github.com/foray1010/common-presets/commit/9f312cc3ac05429a969f271c46e02d915bf44e41))
22
+
6
23
  ## [7.7.3](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.7.2...@foray1010/eslint-config@7.7.3) (2022-10-02)
7
24
 
8
25
  ### Bug Fixes
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.7.3",
4
+ "version": "7.9.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,14 +23,14 @@
23
23
  "type:check": "tsc"
24
24
  },
25
25
  "dependencies": {
26
- "@foray1010/common-presets-utils": "^5.0.4",
26
+ "@foray1010/common-presets-utils": "^5.1.0",
27
27
  "@typescript-eslint/eslint-plugin": "^5.38.1",
28
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
+ "eslint-plugin-functional": "^4.4.1",
34
34
  "eslint-plugin-import": "^2.22.1",
35
35
  "eslint-plugin-jest": "^27.0.4",
36
36
  "eslint-plugin-jest-dom": "^4.0.0",
@@ -40,7 +40,8 @@
40
40
  "eslint-plugin-react": "^7.31.8",
41
41
  "eslint-plugin-react-hooks": "^4.2.0",
42
42
  "eslint-plugin-simple-import-sort": "^8.0.0",
43
- "eslint-plugin-testing-library": "^5.7.0"
43
+ "eslint-plugin-testing-library": "^5.7.0",
44
+ "eslint-plugin-unicorn": "^42.0.0"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@types/confusing-browser-globals": "1.0.0",
@@ -56,5 +57,5 @@
56
57
  "publishConfig": {
57
58
  "access": "public"
58
59
  },
59
- "gitHead": "959a348ec7c5c2373efed4523f1da2193142f071"
60
+ "gitHead": "0b6e4b29bc99ab8523c726d33f5a8b8531c6ee56"
60
61
  }
package/presets/base.js CHANGED
@@ -64,6 +64,7 @@ module.exports = {
64
64
  'eslint-plugin-import',
65
65
  'eslint-plugin-jsdoc',
66
66
  'eslint-plugin-prettier',
67
+ 'eslint-plugin-unicorn',
67
68
  ],
68
69
  env: {
69
70
  // should align with parserOptions.ecmaVersion
@@ -126,6 +127,8 @@ module.exports = {
126
127
  'jsdoc/valid-types': 'off',
127
128
  // avoid assigning anonymous function to object key which is harder to trace when debug
128
129
  'object-shorthand': ['error', 'always'],
130
+ // prefer Number static properties over global ones
131
+ 'unicorn/prefer-number-properties': 'error',
129
132
  },
130
133
  overrides: [
131
134
  {
@@ -198,15 +201,20 @@ module.exports = {
198
201
  'error',
199
202
  { prefer: 'type-imports' },
200
203
  ],
204
+ // disable the base rule as it can report incorrect errors, use @typescript-eslint/dot-notation instead
205
+ 'dot-notation': 'off',
206
+ // only allow indexed syntax (e.g. `obj['key']`) for accessing undefined fields
207
+ '@typescript-eslint/dot-notation': [
208
+ 'error',
209
+ {
210
+ allowIndexSignaturePropertyAccess: true,
211
+ },
212
+ ],
201
213
  // encourage to use private accessibility modifier
202
214
  '@typescript-eslint/explicit-member-accessibility': [
203
215
  'error',
204
216
  {
205
217
  accessibility: 'explicit',
206
- overrides: {
207
- // don't bother because it is always public
208
- constructors: 'off',
209
- },
210
218
  },
211
219
  ],
212
220
  // sometimes auto detect can provide a better and narrower type
@@ -272,8 +280,7 @@ module.exports = {
272
280
  },
273
281
  ],
274
282
  // forbid unnecessary callback wrapper
275
- // disabled due to https://github.com/eslint-functional/eslint-plugin-functional/issues/486
276
- // 'functional/prefer-tacit': 'error',
283
+ 'functional/prefer-tacit': 'error',
277
284
  // @typescript-eslint/eslint-plugin suggests to disable it: https://github.com/typescript-eslint/typescript-eslint/blob/2588e9ea55f78352fdd6ae92a306135aabb49a1a/docs/linting/TROUBLESHOOTING.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
278
285
  // It is disabled in recommended config but re-enabled here to enforce a subset of global variables that supported by both node.js and browsers
279
286
  'no-undef': 'error',