@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 CHANGED
@@ -1,6 +1,5 @@
1
1
  const nodeRules = require('./rules/node')
2
2
 
3
-
4
3
  module.exports = {
5
4
  env: {
6
5
  node: true,
@@ -8,5 +7,5 @@ module.exports = {
8
7
 
9
8
  plugins: ['node'],
10
9
 
11
- rules: nodeRules
10
+ rules: nodeRules,
12
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@will-stone/eslint-config",
3
- "version": "3.0.4",
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": "^35.0.0"
28
+ "eslint-plugin-unicorn": "^36.0.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "eslint": "^7.32.0",
32
- "typescript": "4.x"
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 importing index file with . instead of ./, ./index or ./index.js
43
- 'unicorn/import-index': 'warn',
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',