This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
generated from Sansai-snct/react-ts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
89 lines (89 loc) · 2.07 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
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['@typescript-eslint'],
rules: {
'no-console': [
'warn',
{
allow: ['warn', 'info', 'error'],
},
],
// console.logが残っていればwarn
'prefer-arrow-callback': 'error',
// arrow functionを許可
'prefer-const': 'error',
// const推奨
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
// 未使用変数はエラー
'import/prefer-default-export': 'off',
},
overrides: [
// 一部ルールを除外する
{
files: ['src/pages/**/*.tsx'],
// pagesのdefault exportは仕方ないので除外
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['**/*.tsx'],
// componentの戻り値の型定義の記述は必須にしない
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react/function-component-definition': [
2,
{
namedComponents: 'arrow-function',
},
],
},
},
{
files: ['*.stories.tsx'],
extends: ['plugin:storybook/recommended'],
rules: {
'import/no-default-export': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
optionalDependencies: false,
},
],
},
},
],
}