-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
111 lines (99 loc) · 3.22 KB
/
.eslintrc.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin', "testing-library"],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
// Lintの時間があまりに長いようなら無効化も考える
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:testing-library/react',
],
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 'next',
sourceType: 'module',
ecaFeatures: {
jsx: true,
},
},
rules: {
curly: 'error',
eqeqeq: ['error', 'smart'],
'no-return-await': 'error',
'require-await': 'error',
'no-await-in-loop': 'error',
'@typescript-eslint/prefer-readonly': 'error',
// '@typescript-eslint/prefer-readonly-parameter-types': ["error", {ignoreInferredTypes: true}],
'@typescript-eslint/array-type': ['error', {default: 'generic', readonly: 'generic'}],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
'padding-line-between-statements': [
'error',
{blankLine: 'always', prev: 'multiline-const', next: 'multiline-const'},
{blankLine: 'always', prev: '*', next: 'function'},
{blankLine: 'always', prev: '*', next: 'class'},
{blankLine: 'always', prev: '*', next: 'export'},
],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'none',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// 要検討
'@typescript-eslint/no-unsafe-assignment': 'off',
// voidとのunionで微妙な挙動をするので一旦停止
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false,
},
],
'import/newline-after-import': 'error',
'import/named': 'off',
'import/no-named-default': 'error',
'import/no-default-export': 'off',
'import/default': 'off',
'import/no-useless-path-segments': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', ['index', 'sibling'], 'type'],
'newlines-between': 'always-and-inside-groups',
alphabetize: {
order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
caseInsensitive: true /* ignore case. Options: [true, false] */,
},
},
],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.js', '.jsx', '.ts', '.tsx'],
},
'import/ignore': ['node_modules'],
},
"overrides": [
{
// 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
"files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
"extends": ["plugin:testing-library/react"]
},
]
};