-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
78 lines (75 loc) · 2.46 KB
/
eslint.config.mjs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import tseslintparser from '@typescript-eslint/parser';
import eslintConfigPrettier from 'eslint-config-prettier';
// prettier との連携のため
const tsParser = {
languageOptions: {
parser: tseslintparser,
parserOptions: {
sourceType: 'module',
project: 'tsconfig.eslint.json',
},
},
plugins: {
tseslint,
},
};
const myRules = {
rules: {
eqeqeq: 'error', // ===にしないとエラー
'no-console': 'warn', // console.xxxを使うと警告
// 'no-warning-comments': [
// // 対象のコメントを書くと警告
// 'warn',
// {terms: ['todo', 'fixme', 'memo'], location: 'anywhere'},
// ],
// 'max-statements': ['warn', 30], // 宣言した関数や変数の上限値
// 'max-lines': ['warn', 500], // 1ファイルの最大行数
// 'max-lines-per-function': ['warn', {max: 30, skipBlankLines: true}], // 関数内の行数が30行超えると警告
// 'max-depth': ['warn', 3], // ネストが3を超えると警告
// complexity: ['warn', 5], // 複雑度が5を超えると警告
// indent: ['error', 4], // 4スペース以外のインデントはエラー
// '@typescript-eslint/quotes': ['error', 'single'],
// '@typescript-eslint/naming-convention': [
// 'warn',
// {selector: 'variableLike', format: ['camelCase']},
// {selector: 'method', format: ['camelCase']},
// {selector: 'typeLike', format: ['PascalCase']},
// {selector: 'parameter', format: ['camelCase']},
// ],
// '@typescript-eslint/no-explicit-any': ['error'],
// FIXME: _ が無視されない
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
// '@typescript-eslint/no-require-imports': ['error'],
'@typescript-eslint/no-namespace': ['off'],
'linebreak-style': ['error', 'unix'],
},
};
export default tseslint.config(
{
ignores: ['docker/*', 'strapi/*'],
},
{
files: ['src/**/*.{ts,tsx}', 'lib/**/*.{ts,tsx}'],
extends: [
pluginJs.configs.recommended,
tseslint.configs.recommended,
tsParser,
eslintConfigPrettier,
myRules,
],
}
);