-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
100 lines (96 loc) · 2.82 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
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: { project: "./tsconfig.json" },
plugins: ["simple-import-sort", "sort-destructure-keys", "import-access"],
extends: [
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"prettier",
],
rules: {
curly: "error",
"no-console": ["error", { allow: ["warn", "info", "error"] }],
"no-restricted-syntax": [
"error",
{ selector: "TSEnumDeclaration", message: "Don't declare enums" },
],
"prefer-arrow-callback": "error",
"prefer-const": "error",
"func-style": ["error", "expression"],
"no-restricted-imports": [
"error",
{ paths: [{ name: "react", importNames: ["default"] }] },
],
// react
"react/display-name": "error",
"react/jsx-handler-names": [
"error",
{
eventHandlerPrefix: "handle",
eventHandlerPropPrefix: "on",
checkLocalVariables: false,
checkInlineFunction: true,
},
],
"react/destructuring-assignment": ["error", "always"],
// sort
"import/newline-after-import": "error",
"import-access/jsdoc": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"sort-destructure-keys/sort-destructure-keys": 2,
// @typescript-eslint
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports" },
],
"@typescript-eslint/no-unused-vars": [
"error",
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["typeLike"],
format: ["PascalCase"],
},
{
selector: ["function", "method"],
format: ["camelCase", "PascalCase"],
//パスカルケースとスネークケースの細かい設定後で(コンポーネント名の時にパスカルケースなど)
},
{
selector: ["variable", "parameter"],
types: ["boolean", "string", "number", "array"],
format: ["camelCase"],
},
{
selector: "variable",
types: ["boolean"],
format: ["PascalCase"],
prefix: ["no", "is", "has", "should"],
filter: { regex: "^_", match: false },
},
],
// jsx-a11y
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/anchor-is-valid": [
"error",
{
components: ["Link"],
specialLink: ["hrefLeft", "hrefRight"],
aspects: ["invalidHref", "preferButton"],
},
],
},
overrides: [
{
files: ["pages/**/*.tsx", "pages/api/**/*.ts"],
rules: { "import/no-default-export": "off" },
},
],
};