forked from lightsound/nexst-tailwind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
89 lines (89 loc) · 3.3 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 = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: { project: "./tsconfig.json" },
plugins: ["simple-import-sort", "import-access"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"next/core-web-vitals",
"prettier",
],
rules: {
"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"],
"arrow-body-style": ["error", "always"],
"no-restricted-imports": ["error", { paths: [{ name: "react", importNames: ["default"] }] }],
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/display-name": "error",
"react/jsx-handler-names": [
"error",
{
eventHandlerPrefix: "handle",
eventHandlerPropPrefix: "on",
checkLocalVariables: true,
checkInlineFunction: true,
},
],
"react/destructuring-assignment": ["error", "never"],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/newline-after-import": "error",
"import/no-default-export": "error",
"import-access/jsdoc": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@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: ["typeAlias", "typeParameter"], format: ["PascalCase"] },
{ selector: ["property", "method"], format: ["camelCase"] },
{
selector: "variable",
types: ["boolean"],
format: ["PascalCase"],
prefix: ["no", "is", "has", "should"],
filter: { regex: "^_", match: false },
},
],
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/anchor-is-valid": [
"error",
{ components: ["Link"], specialLink: ["hrefLeft", "hrefRight"], aspects: ["invalidHref", "preferButton"] },
],
},
overrides: [
{
files: ["src/pages/**/*.tsx", "src/pages/api/**/*.ts"],
rules: {
"import/no-default-export": "off",
"@typescript-eslint/naming-convention": [
"error",
{ selector: ["typeAlias", "typeParameter"], format: ["PascalCase"] },
{ selector: ["classProperty", "typeProperty", "method"], format: ["camelCase"] },
{ selector: "variable", types: ["boolean"], format: ["PascalCase"], prefix: ["is", "has", "should"] },
],
},
},
{
files: ["src/type/**/*.d.ts"],
rules: {
"@typescript-eslint/naming-convention": [
"error",
{ selector: ["typeAlias", "typeParameter"], format: ["PascalCase"] },
{ selector: ["classProperty", "method"], format: ["camelCase"] },
{ selector: "variable", types: ["boolean"], format: ["PascalCase"], prefix: ["is", "has", "should"] },
],
},
},
],
};