-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
108 lines (81 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
// Indentation
"indent": ["error", 2],
// Semicolons
"semi": ["error", "always"],
// Quotes
"quotes": ["error", "double"],
// No console.log in production code
"no-console": "error",
// Warn about unused variables
"no-unused-vars": "warn",
// Disallow undeclared variables
"no-undef": "error",
// Disallow unnecessary semicolons
"no-extra-semi": "error",
// Enforce return statements in else blocks
"no-else-return": "error",
// Disallow implicit type coercion
"no-implicit-coercion": "error",
// Disallow multiple consecutive spaces
"no-multi-spaces": "error",
// Disallow trailing whitespace
"no-trailing-spaces": "error",
// Enforce newline at the end of files
"eol-last": "error",
// Disallow trailing commas in objects/arrays
"comma-dangle": ["error", "never"],
// Enforce parentheses around arrow function parameters
"arrow-parens": ["error", "always"],
// Enforce arrow functions with braces only if needed
"arrow-body-style": "off",
// Enforce consistent spacing in object literals
"object-curly-spacing": ["error", "always"],
// Allow any spacing in array literals
"array-bracket-spacing": ["error", "never"],
// Disallow usage of var
"no-var": "error",
// Prefer const over let when variable is not reassigned
"prefer-const": "error",
// Prefer template literals over string concatenation
"prefer-template": "error",
// Disallow use of variables before they are defined (except functions)
"no-use-before-define": ["error", { "functions": false }],
// Disallow variable shadowing in the same scope
"no-shadow": "error",
// Disallow specific syntax (ForInStatement, LabeledStatement)
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"message": "for..in loops are discouraged. Use Object.keys() instead."
},
{
"selector": "LabeledStatement",
"message": "Labels are discouraged in modern code."
}
],
// Allow underscores in properties
"no-underscore-dangle": "off",
// Prefer arrow functions as callbacks
"prefer-arrow-callback": "error",
// Prefer rest parameters over arguments
"prefer-rest-params": "error",
// Prefer spread operator over apply()
"prefer-spread": "error",
// Disallow assignments in return statements
"no-return-assign": "error"
},
"settings": {
"react": {
"version": "detect"
},
"next": {
"version": "detect"
}
}
}