@book000/eslint-config 1.14.4 → 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.
Files changed (3) hide show
  1. package/index.mjs +3 -2
  2. package/package.json +1 -1
  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 ブロックのエラー変数名を err に変更する(JS/TS 両方に適用)
80
+ // catch ブロックのエラー変数名は error に統一する。
81
+ // err も常に許容する(error_ は要求しない)。
81
82
  rules: {
82
- "unicorn/catch-error-name": ["error", { name: "err" }],
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.4",
3
+ "version": "1.14.5",
4
4
  "description": "ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
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 ブロックで err を使用するのは OK",
160
- code: "try { throw new Error(); } catch (err) { console.log(err); }",
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 (error) { console.log(error); }",
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: スコープ内に error 変数があるときに err を使用するのは OK",
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"],