|
| 1 | +// @ts-check |
| 2 | +// from https://typescript-eslint.io/getting-started/ |
| 3 | + |
| 4 | +import eslint from '@eslint/js'; |
| 5 | +import tseslint from 'typescript-eslint'; |
| 6 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 7 | + |
| 8 | +export default tseslint.config({ |
| 9 | + files: ['**/*.ts'], |
| 10 | + ignores: ['**/node_modules/**', '**/dist/**', '**/.github/**'], |
| 11 | + extends: [ |
| 12 | + eslint.configs.recommended, |
| 13 | + ...tseslint.configs.recommended, |
| 14 | + eslintConfigPrettier, |
| 15 | + ], |
| 16 | + rules: { |
| 17 | + "max-lines-per-function": ["warn", {"max": 75}], //GitLab25 |
| 18 | + "max-lines": ["warn", {"max": 500}], //GitLab250 |
| 19 | + //"complexity": ["error", { "max": 5 }], //GitLab5 |
| 20 | + "import/order": "off", |
| 21 | + "sort-imports": "warn", |
| 22 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 23 | + "@typescript-eslint/no-unused-vars": ["error", { |
| 24 | + "argsIgnorePattern": "^_", |
| 25 | + "varsIgnorePattern": "^[A-Z]" |
| 26 | + }], |
| 27 | + /** 命名規則 */ |
| 28 | + "@typescript-eslint/naming-convention": [ |
| 29 | + "error", |
| 30 | + { // classやtypeなどは頭大文字 |
| 31 | + "selector": "typeLike", |
| 32 | + "format": ["PascalCase"] |
| 33 | + }, |
| 34 | + { // グローバル定数はアッパーケース |
| 35 | + "selector": "variable", |
| 36 | + "modifiers": ["global", "const"], |
| 37 | + "format": ["camelCase", "UPPER_CASE"] |
| 38 | + }, |
| 39 | + { // 変数名はキャメルケース |
| 40 | + "selector": "variable", |
| 41 | + "format": ["camelCase", "UPPER_CASE"] |
| 42 | + } |
| 43 | + ], |
| 44 | + // 未使用の変数や関数は宣言禁止、ただし大文字で始まっているものはクラスなので許す |
| 45 | + "no-unused-vars": ["error", { |
| 46 | + "argsIgnorePattern": "^_", |
| 47 | + "varsIgnorePattern": "^[A-Z]" |
| 48 | + }], |
| 49 | + "no-console": "error" |
| 50 | + }, |
| 51 | +}); |
0 commit comments