generated from kripod/next-starter-strict
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.json
76 lines (76 loc) · 2.42 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
{
"root": true,
"parserOptions": {
"project": "./tsconfig.json"
},
"extends": [
"next",
"airbnb",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:eslint-comments/recommended",
"plugin:etc/recommended",
"plugin:react-etc/recommended",
"plugin:tailwindcss/recommended",
"prettier",
"prettier/prettier"
],
"plugins": ["simple-import-sort"],
"rules": {
/* Auto-sort imports and exports */
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"sort-imports": "off",
"import/order": "off",
/* Custom preferences */
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-indexed-object-style": [
"error",
"index-signature" // Prevent ambiguity with Records & Tuples
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-module-boundary-types": "off", // Reduce bloat
"@typescript-eslint/method-signature-style": "error", // Force type safety
"@typescript-eslint/no-dynamic-delete": "error", // Use Map/Set structures
"@typescript-eslint/no-invalid-void-type": "error", // Force type safety
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-ts-expect-error": "error", // Force type safety
"import/no-anonymous-default-export": "error", // For named React components
"import/no-default-export": "error", // Default exports are confusing
"import/prefer-default-export": "off",
"jsx-a11y/anchor-is-valid": "off", // Doesn't play well with Next `<Link>`
"prefer-exponentiation-operator": "error", // Auto-fix for an inherited rule
"react/react-in-jsx-scope": "off", // React is always in scope with Next
"react/require-default-props": "off" // React `defaultProps` are deprecated
},
"overrides": [
{
"files": ["*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off" // Allow CommonJS imports
}
},
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"react/jsx-props-no-spreading": "off" // TypeScript makes this safe
}
},
{
"files": ["./src/**"],
"rules": {
"import/no-default-export": "off",
"import/prefer-default-export": "off"
}
},
{
"files": ["./src/pages/api/**"],
"rules": {
"import/no-anonymous-default-export": "off",
"import/prefer-default-export": "off"
}
}
]
}