@slashnephy/eslint-config 2.0.27 → 2.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slashnephy/eslint-config",
3
- "version": "2.0.27",
3
+ "version": "2.0.29",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "author": "SlashNephy <spica@starry.blue> (https://spica.starry.blue/)",
@@ -76,7 +76,7 @@
76
76
  "eslint": "^8"
77
77
  },
78
78
  "devDependencies": {
79
- "@slashnephy/prettier-config": "1.0.17",
79
+ "@slashnephy/prettier-config": "1.0.18",
80
80
  "@types/eslint": "8.44.3",
81
81
  "@types/node": "20.8.2",
82
82
  "concurrently": "8.2.1",
@@ -84,7 +84,7 @@
84
84
  "prettier": "3.0.3",
85
85
  "ts-node": "10.9.1"
86
86
  },
87
- "packageManager": "yarn@3.6.3",
87
+ "packageManager": "yarn@3.6.4",
88
88
  "eslintConfig": {
89
89
  "extends": "./src"
90
90
  },
@@ -125,5 +125,6 @@ module.exports = {
125
125
  argsIgnorePattern: '^_',
126
126
  },
127
127
  ],
128
+ 'no-implicit-coercion': 'error',
128
129
  },
129
130
  };
@@ -33,7 +33,7 @@ module.exports = {
33
33
  'import/no-default-export': 'error',
34
34
  // アロー関数を優先
35
35
  'prefer-arrow-callback': 'error',
36
- // const a = function () { ... } を禁止
36
+ // 関数宣言は function xxx() {} にする
37
37
  'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
38
38
  // 中括弧の省略を禁止
39
39
  curly: 'error',
@@ -183,5 +183,7 @@ module.exports = {
183
183
  argsIgnorePattern: '^_',
184
184
  },
185
185
  ],
186
+ // '1' + 2 を禁止
187
+ 'no-implicit-coercion': 'error',
186
188
  },
187
189
  } satisfies Linter.Config
@@ -135,7 +135,6 @@ module.exports = {
135
135
  '@typescript-eslint/prefer-readonly': 'error',
136
136
  '@typescript-eslint/prefer-regexp-exec': 'error',
137
137
  '@typescript-eslint/promise-function-async': 'error',
138
- '@typescript-eslint/require-array-sort-compare': 'off',
139
138
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
140
139
  '@typescript-eslint/type-annotation-spacing': 'error',
141
140
  '@typescript-eslint/unbound-method': 'off',
@@ -163,5 +162,12 @@ module.exports = {
163
162
  },
164
163
  ],
165
164
  'deprecation/deprecation': 'error',
165
+ '@typescript-eslint/restrict-plus-operands': 'error',
166
+ '@typescript-eslint/require-array-sort-compare': [
167
+ 'error',
168
+ {
169
+ ignoreStringArrays: true,
170
+ },
171
+ ],
166
172
  },
167
173
  };
@@ -162,7 +162,6 @@ module.exports = {
162
162
  '@typescript-eslint/prefer-regexp-exec': 'error',
163
163
  // Promise<T> を返す関数では async のマークを強制
164
164
  '@typescript-eslint/promise-function-async': 'error',
165
- '@typescript-eslint/require-array-sort-compare': 'off',
166
165
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
167
166
  '@typescript-eslint/type-annotation-spacing': 'error',
168
167
  '@typescript-eslint/unbound-method': 'off',
@@ -196,5 +195,14 @@ module.exports = {
196
195
  ],
197
196
  // Deprecated されたコードの使用を禁止
198
197
  'deprecation/deprecation': 'error',
198
+ // '1' + 2 を禁止
199
+ '@typescript-eslint/restrict-plus-operands': 'error',
200
+ // 数値型の配列の sort() を禁止
201
+ '@typescript-eslint/require-array-sort-compare': [
202
+ 'error',
203
+ {
204
+ ignoreStringArrays: true,
205
+ },
206
+ ],
199
207
  },
200
208
  } satisfies Linter.Config
@@ -63,6 +63,14 @@ module.exports = {
63
63
  'react/jsx-props-no-spreading': 'off',
64
64
  'react/jsx-no-useless-fragment': 'off',
65
65
  'react/require-default-props': 'off',
66
+ 'react/jsx-no-bind': 'error',
67
+ 'react/function-component-definition': [
68
+ 'error',
69
+ {
70
+ namedComponents: 'function-declaration',
71
+ unnamedComponents: 'arrow-function',
72
+ },
73
+ ],
66
74
  },
67
75
  overrides: [
68
76
  {
@@ -80,6 +80,16 @@ module.exports = {
80
80
  'react/jsx-no-useless-fragment': 'off',
81
81
  // defaultProps を使わない
82
82
  'react/require-default-props': 'off',
83
+ // useCallback でコールバックを宣言させる
84
+ 'react/jsx-no-bind': 'error',
85
+ // コンポーネントの宣言を function Component() {} に強制
86
+ 'react/function-component-definition': [
87
+ 'error',
88
+ {
89
+ namedComponents: 'function-declaration',
90
+ unnamedComponents: 'arrow-function',
91
+ },
92
+ ],
83
93
  },
84
94
  overrides: [
85
95
  {