-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
77 lines (77 loc) · 2.74 KB
/
.eslintrc.json
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
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"react-app",
"react-app/jest",
"eslint:recommended",
"plugin:react/recommended",
"airbnb",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"tsconfigRootDir": ".",
"project": ["./tsconfig.json", "./functions/tsconfig.json"],
"sourceType": "module"
},
"plugins": ["react", "react-hooks", "@typescript-eslint", "import", "unused-imports"],
"ignorePatterns": ["build"],
"rules": {
"no-use-before-define": "off", //関数や変数が定義される前に使われているとエラーになるデフォルトの機能をoff
"@typescript-eslint/no-use-before-define": ["error"], //typescript側のno-use-before-defineを使うようにする
"import/prefer-default-export": "off", //named exportがエラーになるので使えるようにoff
"@typescript-eslint/no-unused-vars": "off", //unused-importsを使うため削除
"unused-imports/no-unused-imports": "error", //不要なimportの削除
"unused-imports/no-unused-vars": [
//unused-importsでno-unused-varsのルールを再定義
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"no-param-reassign": [2, { "props": false }], //パラメーターのプロパティ変更を許可
"react/jsx-one-expression-per-line": 0,
"react/jsx-filename-extension": ["warn", { "extensions": [".jsx", ".tsx"] }], //jsx形式のファイル拡張子をjsxもしくはtsxに限定
"react/react-in-jsx-scope": "off", //import React from 'react'が無くてもエラーを無くす
"react/function-component-definition": [2, { "namedComponents": "arrow-function" }], //アロー関数以外受け付けない設定
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off", //TypeScriptでチェックしているから不要。offにする
"no-void": [
//void演算子の許可
"error",
{
"allowAsStatement": true
}
],
"import/extensions": [
//importのときに以下の拡張子を記述しなくてもエラーにしない
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}