@will-stone/eslint-config 3.0.4 → 3.1.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/node.js +1 -2
- package/package.json +3 -3
- package/rules/unicorn.js +12 -3
package/node.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "My ESLint config",
|
|
6
6
|
"repository": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
26
26
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
27
27
|
"eslint-plugin-switch-case": "^1.1.2",
|
|
28
|
-
"eslint-plugin-unicorn": "^
|
|
28
|
+
"eslint-plugin-unicorn": "^36.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"eslint": "^7.32.0",
|
|
32
|
-
"typescript": "4
|
|
32
|
+
"typescript": "^4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"typescript": {
|
package/rules/unicorn.js
CHANGED
|
@@ -39,8 +39,9 @@ module.exports = {
|
|
|
39
39
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/203
|
|
40
40
|
'unicorn/filename-case': 'off',
|
|
41
41
|
|
|
42
|
-
// Enforces
|
|
43
|
-
|
|
42
|
+
// Enforces requiring index file with . instead of ./, ./index or ./index.js
|
|
43
|
+
// Turned off for imports where this can mess with ESM.
|
|
44
|
+
'unicorn/import-index': ['warn', { ignoreImports: true }],
|
|
44
45
|
|
|
45
46
|
// Not sure if this is useful yet
|
|
46
47
|
'unicorn/import-style': 'off',
|
|
@@ -81,6 +82,10 @@ module.exports = {
|
|
|
81
82
|
// Require Array.isArray() instead of instanceof Array
|
|
82
83
|
'unicorn/no-instanceof-array': 'warn',
|
|
83
84
|
|
|
85
|
+
// The removeEventListener function must be called with a reference to the same
|
|
86
|
+
// function that was passed to addEventListener.
|
|
87
|
+
'unicorn/no-invalid-remove-event-listener': 'error',
|
|
88
|
+
|
|
84
89
|
// Disallow identifiers (var names) starting with new.
|
|
85
90
|
// Do not check properties and allow "class" so that "className" is allowed.
|
|
86
91
|
'unicorn/no-keyword-prefix': [
|
|
@@ -115,6 +120,10 @@ module.exports = {
|
|
|
115
120
|
// Disallow assigning this to a variable
|
|
116
121
|
'unicorn/no-this-assignment': 'error',
|
|
117
122
|
|
|
123
|
+
// TS doesn't allow falsy values to be spread so fallbacks are required
|
|
124
|
+
// https://github.com/microsoft/TypeScript/issues/37491
|
|
125
|
+
'unicorn/no-useless-fallback-in-spread': 'off',
|
|
126
|
+
|
|
118
127
|
// Disallow useless array length check
|
|
119
128
|
'unicorn/no-useless-length-check': 'warn',
|
|
120
129
|
|
|
@@ -253,7 +262,7 @@ module.exports = {
|
|
|
253
262
|
'unicorn/prefer-switch': 'off',
|
|
254
263
|
|
|
255
264
|
// Prefer ternary expressions over simple if-else statements
|
|
256
|
-
'unicorn/prefer-ternary': 'warn',
|
|
265
|
+
'unicorn/prefer-ternary': ['warn', 'only-single-line'],
|
|
257
266
|
|
|
258
267
|
// Prefer top-level await over top-level promises and async function calls
|
|
259
268
|
'unicorn/prefer-top-level-await': 'error',
|