-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
64 lines (62 loc) · 2.45 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// eslint.config.js
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended-esm.js';
// create by npx elint --init
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
// add
{
ignores: ['.vscode/**', 'archive/**', 'node_modules/**', 'coverage/**', '**/*{.,-}min.js', 'src/**/*.js', 'src/lib/**', '.npm/**', 'asset/**', 'sample/**', 'bak/**'],
name: 'ignores'
},
...recommendedConfig,
{
rules: {
// 命名規則 https://typescript-eslint.io/rules/naming-convention
"@typescript-eslint/naming-convention": [
"error",
{ // classやtypeなどは頭大文
"format": ["PascalCase"],
"selector": "typeLike",
},
{ // 変数名はキャメルケース
"format": ["camelCase"],
"selector": "variable",
}
],
// 変数!禁止 https://typescript-eslint.io/rules/no-non-null-assertion
//"@typescript-eslint/no-non-null-assertion": "off",
// 未使用の変数や関数は宣言禁止、ただし大文字で始まっているものはクラスなので許す
// https://typescript-eslint.io/rules/no-unused-vars/
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"varsIgnorePattern": "^[A-Z]",
}],
// メンバーの順序 https://typescript-eslint.io/rules/member-ordering
//"@typescript-eslint/member-ordering": "warn",
// コメントの先頭が大文字から
"capitalized-comments": ["off", "always", {
"ignoreConsecutiveComments": true,
"ignoreInlineComments": true,
}],
//"complexity": ["error", { "max": 5 }], //GitLab5
"max-lines": ["warn", { "max": 300 }], //GitLab250
"max-lines-per-function": ["warn", { "max": 50 }], //GitLab25
"no-console": "off",
"no-duplicate-imports": ["error", { "includeExports": true }],
//"no-octal-escape": "off", //Workaround RangeError: Maximum call stack size exceeded
"no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"varsIgnorePattern": "^[A-Z]",
}],
"sort-imports": ["warn"],
}
}
];