@book000/eslint-config 1.4.2 → 1.5.0

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 (2) hide show
  1. package/index.mjs +17 -0
  2. package/package.json +2 -1
package/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import { FlatCompat } from "@eslint/eslintrc";
3
+ import stylistic from "@stylistic/eslint-plugin";
3
4
  import tseslintParser from "@typescript-eslint/parser";
4
5
  import eslintPrettier from "eslint-config-prettier";
5
6
  import unicorn from "eslint-plugin-unicorn";
@@ -13,6 +14,7 @@ export default tseslint.config(
13
14
  ...tseslint.configs.recommended,
14
15
  // @ts-expect-error flat/recommendedの返すpluginsがstring[]なことでエラーになるため
15
16
  unicorn.configs["flat/recommended"],
17
+ stylistic.configs["recommended-flat"],
16
18
  {
17
19
  files: ["**/*.ts", "**/*.tsx"],
18
20
  languageOptions: {
@@ -32,9 +34,13 @@ export default tseslint.config(
32
34
  ...tseslint.configs.stylisticTypeChecked,
33
35
  ],
34
36
  rules: {
37
+ // TypeScriptのany型の使用を許可する
35
38
  "@typescript-eslint/no-explicit-any": "off",
39
+ // TypeScriptの危険な代入を許可する
36
40
  "@typescript-eslint/no-unsafe-assignment": "off",
41
+ // TypeScriptの危険な引数を許可する
37
42
  "@typescript-eslint/no-unsafe-argument": "off",
43
+ // テンプレート式において、数値や真偽値、nullishを許可する
38
44
  "@typescript-eslint/restrict-template-expressions": [
39
45
  "error",
40
46
  {
@@ -44,6 +50,7 @@ export default tseslint.config(
44
50
  allowNullish: true,
45
51
  },
46
52
  ],
53
+ // 呼び出されないPromiseを許容しないが、void演算子や即時関数では許可する
47
54
  "@typescript-eslint/no-floating-promises": [
48
55
  "error",
49
56
  {
@@ -51,14 +58,24 @@ export default tseslint.config(
51
58
  ignoreIIFE: true,
52
59
  },
53
60
  ],
61
+ // 不要な条件式を許容しないが、定数ループ条件(無限ループ)は許可する
54
62
  "@typescript-eslint/no-unnecessary-condition": [
55
63
  "error",
56
64
  {
57
65
  allowConstantLoopConditions: true,
58
66
  },
59
67
  ],
68
+ // アロー関数使用時、括弧を強制する
69
+ // 本来はPrettierで設定して動作させるものなのかもしれない
70
+ "@stylistic/arrow-parens": ["error", "always"],
71
+ // シングルクォートを強制する。ただし、エスケープを避ける
72
+ // 本来はPrettierで設定して動作させるものなのかもしれない
73
+ "@stylistic/quotes": ["error", "single", { avoidEscape: true }],
74
+ // トップレベルのawaitを許可する
60
75
  "unicorn/prefer-top-level-await": "off",
76
+ // 省略形を許可する (dev -> development, prod -> productionなどの変換をさせない)
61
77
  "unicorn/prevent-abbreviations": "off",
78
+ // nullを許可する
62
79
  "unicorn/no-null": "off",
63
80
  },
64
81
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@book000/eslint-config",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@eslint/eslintrc": "3.0.2",
21
21
  "@typescript-eslint/parser": "7.7.0",
22
+ "@stylistic/eslint-plugin": "1.7.2",
22
23
  "eslint-config-prettier": "9.1.0",
23
24
  "eslint-plugin-unicorn": "52.0.0",
24
25
  "globals": "15.0.0",