@mkaradeniz/eslint-config 5.8.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rules/baseRules.mjs +25 -0
package/package.json
CHANGED
package/rules/baseRules.mjs
CHANGED
|
@@ -98,6 +98,26 @@ export const baseRules = {
|
|
|
98
98
|
message: 'Use !isNotNullOrUndefined() instead of === undefined.',
|
|
99
99
|
selector: 'BinaryExpression[operator="==="][right.type="Identifier"][right.name="undefined"]',
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
message:
|
|
103
|
+
"Don't compare to true/false directly. For optional booleans use isNotNullOrUndefined(x) && x or isNotNullOrUndefined(x) && !x.",
|
|
104
|
+
selector: 'BinaryExpression[operator="==="][right.type="Literal"][right.raw="true"]',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
message:
|
|
108
|
+
"Don't compare to true/false directly. For optional booleans use isNotNullOrUndefined(x) && x or isNotNullOrUndefined(x) && !x.",
|
|
109
|
+
selector: 'BinaryExpression[operator="==="][right.type="Literal"][right.raw="false"]',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
message:
|
|
113
|
+
"Don't compare to true/false directly. For optional booleans use isNotNullOrUndefined(x) && x or isNotNullOrUndefined(x) && !x.",
|
|
114
|
+
selector: 'BinaryExpression[operator="!=="][right.type="Literal"][right.raw="true"]',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
message:
|
|
118
|
+
"Don't compare to true/false directly. For optional booleans use isNotNullOrUndefined(x) && x or isNotNullOrUndefined(x) && !x.",
|
|
119
|
+
selector: 'BinaryExpression[operator="!=="][right.type="Literal"][right.raw="false"]',
|
|
120
|
+
},
|
|
101
121
|
{
|
|
102
122
|
message: 'Exported functions with >1 parameter must use a single object parameter.',
|
|
103
123
|
selector: 'ExportNamedDeclaration > VariableDeclaration > VariableDeclarator > ArrowFunctionExpression[params.length>1]',
|
|
@@ -114,6 +134,11 @@ export const baseRules = {
|
|
|
114
134
|
message: 'Use envConfigClient or envConfigServer instead of process.env.',
|
|
115
135
|
selector: 'MemberExpression[object.name="process"][property.name="env"]',
|
|
116
136
|
},
|
|
137
|
+
// {
|
|
138
|
+
// message:
|
|
139
|
+
// 'Prefer const + functional patterns (map/filter/reduce/ternary). Extract to a util function if needed. Only disable for: try/catch assignment, iterators/generators, for-await-of accumulation, or closures requiring mutable state (debounce, event handlers).',
|
|
140
|
+
// selector: 'VariableDeclaration[kind="let"]',
|
|
141
|
+
// },
|
|
117
142
|
],
|
|
118
143
|
'no-return-assign': ['warn'],
|
|
119
144
|
'no-script-url': ['warn'],
|