@book000/eslint-config 1.14.3 → 1.14.5
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/index.mjs +3 -2
- package/package.json +3 -3
- package/test.mjs +11 -5
package/index.mjs
CHANGED
|
@@ -77,9 +77,10 @@ export default tseslint.config(
|
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
// catch
|
|
80
|
+
// catch ブロックのエラー変数名は error に統一する。
|
|
81
|
+
// err も常に許容する(error_ は要求しない)。
|
|
81
82
|
rules: {
|
|
82
|
-
"unicorn/catch-error-name": ["error", { name: "
|
|
83
|
+
"unicorn/catch-error-name": ["error", { name: "error", ignore: [/^err$/] }],
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
86
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@book000/eslint-config",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"description": "ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"url": "git@github.com:book000/eslint-config.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@typescript-eslint/parser": "8.
|
|
20
|
+
"@typescript-eslint/parser": "8.58.0",
|
|
21
21
|
"eslint-config-prettier": "10.1.8",
|
|
22
22
|
"eslint-plugin-unicorn": "64.0.0",
|
|
23
23
|
"globals": "17.4.0",
|
|
24
24
|
"neostandard": "0.13.0",
|
|
25
|
-
"typescript-eslint": "8.
|
|
25
|
+
"typescript-eslint": "8.58.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"eslint": "10.1.0"
|
package/test.mjs
CHANGED
|
@@ -156,19 +156,25 @@ async function main() {
|
|
|
156
156
|
rules: ["unicorn/no-useless-undefined"],
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
name: "catch-error-name: catch ブロックで
|
|
160
|
-
code: "try { throw new Error(); } catch (
|
|
159
|
+
name: "catch-error-name: catch ブロックで error を使用するのは OK",
|
|
160
|
+
code: "try { throw new Error(); } catch (error) { console.log(error); }",
|
|
161
161
|
shouldError: false,
|
|
162
162
|
rules: ["unicorn/catch-error-name"],
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
|
-
name: "catch-error-name: catch ブロックで error
|
|
166
|
-
code: "try { throw new Error(); } catch (
|
|
165
|
+
name: "catch-error-name: catch ブロックで e など error/err 以外を使用するのはエラー",
|
|
166
|
+
code: "try { throw new Error(); } catch (e) { console.log(e); }",
|
|
167
167
|
shouldError: true,
|
|
168
168
|
rules: ["unicorn/catch-error-name"],
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
|
-
name: "catch-error-name:
|
|
171
|
+
name: "catch-error-name: err を使用するのは OK(常に許容)",
|
|
172
|
+
code: "try { throw new Error(); } catch (err) { console.log(err); }",
|
|
173
|
+
shouldError: false,
|
|
174
|
+
rules: ["unicorn/catch-error-name"],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "catch-error-name: スコープ内に error 変数があるときに err を使用するのは OK(重複回避)",
|
|
172
178
|
code: "const error = 'msg'; try { throw new Error(); } catch (err) { console.log(error, err); }",
|
|
173
179
|
shouldError: false,
|
|
174
180
|
rules: ["unicorn/catch-error-name"],
|