eslint-config-setup 0.3.0 → 0.3.1
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/dist/configs/0b23ff88.js +41 -3
- package/dist/configs/196d687e.js +43 -3
- package/dist/configs/4eb62e57.js +41 -3
- package/dist/configs/52762a42.js +41 -3
- package/dist/configs/6bc0d588.js +43 -3
- package/dist/configs/c2fecd3d.js +41 -3
- package/dist/configs/d537b683.js +43 -3
- package/dist/configs/db69ebb6.js +43 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js.map +1 -1
- package/dist/modules.d.ts +4 -2
- package/dist/modules.js +27 -5
- package/dist/modules.js.map +1 -1
- package/dist/{types-D227zLeg.d.ts → types-CAUUIuJR.d.ts} +13 -1
- package/package.json +1 -1
package/dist/configs/0b23ff88.js
CHANGED
|
@@ -173,12 +173,43 @@ export default [
|
|
|
173
173
|
],
|
|
174
174
|
"@typescript-eslint/naming-convention": [
|
|
175
175
|
"error",
|
|
176
|
+
{
|
|
177
|
+
"selector": "variable",
|
|
178
|
+
"format": [
|
|
179
|
+
"strictCamelCase",
|
|
180
|
+
"UPPER_CASE"
|
|
181
|
+
],
|
|
182
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
183
|
+
"trailingUnderscore": "allow",
|
|
184
|
+
"filter": {
|
|
185
|
+
"regex": "[- ]",
|
|
186
|
+
"match": false
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"selector": "function",
|
|
191
|
+
"format": [
|
|
192
|
+
"strictCamelCase"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"selector": "parameter",
|
|
197
|
+
"format": [
|
|
198
|
+
"strictCamelCase"
|
|
199
|
+
],
|
|
200
|
+
"leadingUnderscore": "allow"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"selector": "import",
|
|
204
|
+
"format": [
|
|
205
|
+
"strictCamelCase",
|
|
206
|
+
"StrictPascalCase",
|
|
207
|
+
"UPPER_CASE"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
176
210
|
{
|
|
177
211
|
"selector": [
|
|
178
|
-
"variable",
|
|
179
|
-
"function",
|
|
180
212
|
"classProperty",
|
|
181
|
-
"objectLiteralProperty",
|
|
182
213
|
"parameterProperty",
|
|
183
214
|
"classMethod",
|
|
184
215
|
"objectLiteralMethod",
|
|
@@ -195,6 +226,13 @@ export default [
|
|
|
195
226
|
"match": false
|
|
196
227
|
}
|
|
197
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"selector": [
|
|
231
|
+
"objectLiteralProperty",
|
|
232
|
+
"typeProperty"
|
|
233
|
+
],
|
|
234
|
+
"format": null
|
|
235
|
+
},
|
|
198
236
|
{
|
|
199
237
|
"selector": "typeLike",
|
|
200
238
|
"format": [
|
package/dist/configs/196d687e.js
CHANGED
|
@@ -198,12 +198,45 @@ export default [
|
|
|
198
198
|
],
|
|
199
199
|
"@typescript-eslint/naming-convention": [
|
|
200
200
|
"error",
|
|
201
|
+
{
|
|
202
|
+
"selector": "variable",
|
|
203
|
+
"format": [
|
|
204
|
+
"strictCamelCase",
|
|
205
|
+
"UPPER_CASE",
|
|
206
|
+
"StrictPascalCase"
|
|
207
|
+
],
|
|
208
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
209
|
+
"trailingUnderscore": "allow",
|
|
210
|
+
"filter": {
|
|
211
|
+
"regex": "[- ]",
|
|
212
|
+
"match": false
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"selector": "function",
|
|
217
|
+
"format": [
|
|
218
|
+
"strictCamelCase",
|
|
219
|
+
"StrictPascalCase"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"selector": "parameter",
|
|
224
|
+
"format": [
|
|
225
|
+
"strictCamelCase"
|
|
226
|
+
],
|
|
227
|
+
"leadingUnderscore": "allow"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"selector": "import",
|
|
231
|
+
"format": [
|
|
232
|
+
"strictCamelCase",
|
|
233
|
+
"StrictPascalCase",
|
|
234
|
+
"UPPER_CASE"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
201
237
|
{
|
|
202
238
|
"selector": [
|
|
203
|
-
"variable",
|
|
204
|
-
"function",
|
|
205
239
|
"classProperty",
|
|
206
|
-
"objectLiteralProperty",
|
|
207
240
|
"parameterProperty",
|
|
208
241
|
"classMethod",
|
|
209
242
|
"objectLiteralMethod",
|
|
@@ -220,6 +253,13 @@ export default [
|
|
|
220
253
|
"match": false
|
|
221
254
|
}
|
|
222
255
|
},
|
|
256
|
+
{
|
|
257
|
+
"selector": [
|
|
258
|
+
"objectLiteralProperty",
|
|
259
|
+
"typeProperty"
|
|
260
|
+
],
|
|
261
|
+
"format": null
|
|
262
|
+
},
|
|
223
263
|
{
|
|
224
264
|
"selector": "typeLike",
|
|
225
265
|
"format": [
|
package/dist/configs/4eb62e57.js
CHANGED
|
@@ -175,12 +175,43 @@ export default [
|
|
|
175
175
|
],
|
|
176
176
|
"@typescript-eslint/naming-convention": [
|
|
177
177
|
"error",
|
|
178
|
+
{
|
|
179
|
+
"selector": "variable",
|
|
180
|
+
"format": [
|
|
181
|
+
"strictCamelCase",
|
|
182
|
+
"UPPER_CASE"
|
|
183
|
+
],
|
|
184
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
185
|
+
"trailingUnderscore": "allow",
|
|
186
|
+
"filter": {
|
|
187
|
+
"regex": "[- ]",
|
|
188
|
+
"match": false
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"selector": "function",
|
|
193
|
+
"format": [
|
|
194
|
+
"strictCamelCase"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"selector": "parameter",
|
|
199
|
+
"format": [
|
|
200
|
+
"strictCamelCase"
|
|
201
|
+
],
|
|
202
|
+
"leadingUnderscore": "allow"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"selector": "import",
|
|
206
|
+
"format": [
|
|
207
|
+
"strictCamelCase",
|
|
208
|
+
"StrictPascalCase",
|
|
209
|
+
"UPPER_CASE"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
178
212
|
{
|
|
179
213
|
"selector": [
|
|
180
|
-
"variable",
|
|
181
|
-
"function",
|
|
182
214
|
"classProperty",
|
|
183
|
-
"objectLiteralProperty",
|
|
184
215
|
"parameterProperty",
|
|
185
216
|
"classMethod",
|
|
186
217
|
"objectLiteralMethod",
|
|
@@ -197,6 +228,13 @@ export default [
|
|
|
197
228
|
"match": false
|
|
198
229
|
}
|
|
199
230
|
},
|
|
231
|
+
{
|
|
232
|
+
"selector": [
|
|
233
|
+
"objectLiteralProperty",
|
|
234
|
+
"typeProperty"
|
|
235
|
+
],
|
|
236
|
+
"format": null
|
|
237
|
+
},
|
|
200
238
|
{
|
|
201
239
|
"selector": "typeLike",
|
|
202
240
|
"format": [
|
package/dist/configs/52762a42.js
CHANGED
|
@@ -172,12 +172,43 @@ export default [
|
|
|
172
172
|
],
|
|
173
173
|
"@typescript-eslint/naming-convention": [
|
|
174
174
|
"error",
|
|
175
|
+
{
|
|
176
|
+
"selector": "variable",
|
|
177
|
+
"format": [
|
|
178
|
+
"strictCamelCase",
|
|
179
|
+
"UPPER_CASE"
|
|
180
|
+
],
|
|
181
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
182
|
+
"trailingUnderscore": "allow",
|
|
183
|
+
"filter": {
|
|
184
|
+
"regex": "[- ]",
|
|
185
|
+
"match": false
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"selector": "function",
|
|
190
|
+
"format": [
|
|
191
|
+
"strictCamelCase"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"selector": "parameter",
|
|
196
|
+
"format": [
|
|
197
|
+
"strictCamelCase"
|
|
198
|
+
],
|
|
199
|
+
"leadingUnderscore": "allow"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"selector": "import",
|
|
203
|
+
"format": [
|
|
204
|
+
"strictCamelCase",
|
|
205
|
+
"StrictPascalCase",
|
|
206
|
+
"UPPER_CASE"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
175
209
|
{
|
|
176
210
|
"selector": [
|
|
177
|
-
"variable",
|
|
178
|
-
"function",
|
|
179
211
|
"classProperty",
|
|
180
|
-
"objectLiteralProperty",
|
|
181
212
|
"parameterProperty",
|
|
182
213
|
"classMethod",
|
|
183
214
|
"objectLiteralMethod",
|
|
@@ -194,6 +225,13 @@ export default [
|
|
|
194
225
|
"match": false
|
|
195
226
|
}
|
|
196
227
|
},
|
|
228
|
+
{
|
|
229
|
+
"selector": [
|
|
230
|
+
"objectLiteralProperty",
|
|
231
|
+
"typeProperty"
|
|
232
|
+
],
|
|
233
|
+
"format": null
|
|
234
|
+
},
|
|
197
235
|
{
|
|
198
236
|
"selector": "typeLike",
|
|
199
237
|
"format": [
|
package/dist/configs/6bc0d588.js
CHANGED
|
@@ -197,12 +197,45 @@ export default [
|
|
|
197
197
|
],
|
|
198
198
|
"@typescript-eslint/naming-convention": [
|
|
199
199
|
"error",
|
|
200
|
+
{
|
|
201
|
+
"selector": "variable",
|
|
202
|
+
"format": [
|
|
203
|
+
"strictCamelCase",
|
|
204
|
+
"UPPER_CASE",
|
|
205
|
+
"StrictPascalCase"
|
|
206
|
+
],
|
|
207
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
208
|
+
"trailingUnderscore": "allow",
|
|
209
|
+
"filter": {
|
|
210
|
+
"regex": "[- ]",
|
|
211
|
+
"match": false
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"selector": "function",
|
|
216
|
+
"format": [
|
|
217
|
+
"strictCamelCase",
|
|
218
|
+
"StrictPascalCase"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"selector": "parameter",
|
|
223
|
+
"format": [
|
|
224
|
+
"strictCamelCase"
|
|
225
|
+
],
|
|
226
|
+
"leadingUnderscore": "allow"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"selector": "import",
|
|
230
|
+
"format": [
|
|
231
|
+
"strictCamelCase",
|
|
232
|
+
"StrictPascalCase",
|
|
233
|
+
"UPPER_CASE"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
200
236
|
{
|
|
201
237
|
"selector": [
|
|
202
|
-
"variable",
|
|
203
|
-
"function",
|
|
204
238
|
"classProperty",
|
|
205
|
-
"objectLiteralProperty",
|
|
206
239
|
"parameterProperty",
|
|
207
240
|
"classMethod",
|
|
208
241
|
"objectLiteralMethod",
|
|
@@ -219,6 +252,13 @@ export default [
|
|
|
219
252
|
"match": false
|
|
220
253
|
}
|
|
221
254
|
},
|
|
255
|
+
{
|
|
256
|
+
"selector": [
|
|
257
|
+
"objectLiteralProperty",
|
|
258
|
+
"typeProperty"
|
|
259
|
+
],
|
|
260
|
+
"format": null
|
|
261
|
+
},
|
|
222
262
|
{
|
|
223
263
|
"selector": "typeLike",
|
|
224
264
|
"format": [
|
package/dist/configs/c2fecd3d.js
CHANGED
|
@@ -174,12 +174,43 @@ export default [
|
|
|
174
174
|
],
|
|
175
175
|
"@typescript-eslint/naming-convention": [
|
|
176
176
|
"error",
|
|
177
|
+
{
|
|
178
|
+
"selector": "variable",
|
|
179
|
+
"format": [
|
|
180
|
+
"strictCamelCase",
|
|
181
|
+
"UPPER_CASE"
|
|
182
|
+
],
|
|
183
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
184
|
+
"trailingUnderscore": "allow",
|
|
185
|
+
"filter": {
|
|
186
|
+
"regex": "[- ]",
|
|
187
|
+
"match": false
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"selector": "function",
|
|
192
|
+
"format": [
|
|
193
|
+
"strictCamelCase"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"selector": "parameter",
|
|
198
|
+
"format": [
|
|
199
|
+
"strictCamelCase"
|
|
200
|
+
],
|
|
201
|
+
"leadingUnderscore": "allow"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"selector": "import",
|
|
205
|
+
"format": [
|
|
206
|
+
"strictCamelCase",
|
|
207
|
+
"StrictPascalCase",
|
|
208
|
+
"UPPER_CASE"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
177
211
|
{
|
|
178
212
|
"selector": [
|
|
179
|
-
"variable",
|
|
180
|
-
"function",
|
|
181
213
|
"classProperty",
|
|
182
|
-
"objectLiteralProperty",
|
|
183
214
|
"parameterProperty",
|
|
184
215
|
"classMethod",
|
|
185
216
|
"objectLiteralMethod",
|
|
@@ -196,6 +227,13 @@ export default [
|
|
|
196
227
|
"match": false
|
|
197
228
|
}
|
|
198
229
|
},
|
|
230
|
+
{
|
|
231
|
+
"selector": [
|
|
232
|
+
"objectLiteralProperty",
|
|
233
|
+
"typeProperty"
|
|
234
|
+
],
|
|
235
|
+
"format": null
|
|
236
|
+
},
|
|
199
237
|
{
|
|
200
238
|
"selector": "typeLike",
|
|
201
239
|
"format": [
|
package/dist/configs/d537b683.js
CHANGED
|
@@ -196,12 +196,45 @@ export default [
|
|
|
196
196
|
],
|
|
197
197
|
"@typescript-eslint/naming-convention": [
|
|
198
198
|
"error",
|
|
199
|
+
{
|
|
200
|
+
"selector": "variable",
|
|
201
|
+
"format": [
|
|
202
|
+
"strictCamelCase",
|
|
203
|
+
"UPPER_CASE",
|
|
204
|
+
"StrictPascalCase"
|
|
205
|
+
],
|
|
206
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
207
|
+
"trailingUnderscore": "allow",
|
|
208
|
+
"filter": {
|
|
209
|
+
"regex": "[- ]",
|
|
210
|
+
"match": false
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"selector": "function",
|
|
215
|
+
"format": [
|
|
216
|
+
"strictCamelCase",
|
|
217
|
+
"StrictPascalCase"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"selector": "parameter",
|
|
222
|
+
"format": [
|
|
223
|
+
"strictCamelCase"
|
|
224
|
+
],
|
|
225
|
+
"leadingUnderscore": "allow"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"selector": "import",
|
|
229
|
+
"format": [
|
|
230
|
+
"strictCamelCase",
|
|
231
|
+
"StrictPascalCase",
|
|
232
|
+
"UPPER_CASE"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
199
235
|
{
|
|
200
236
|
"selector": [
|
|
201
|
-
"variable",
|
|
202
|
-
"function",
|
|
203
237
|
"classProperty",
|
|
204
|
-
"objectLiteralProperty",
|
|
205
238
|
"parameterProperty",
|
|
206
239
|
"classMethod",
|
|
207
240
|
"objectLiteralMethod",
|
|
@@ -218,6 +251,13 @@ export default [
|
|
|
218
251
|
"match": false
|
|
219
252
|
}
|
|
220
253
|
},
|
|
254
|
+
{
|
|
255
|
+
"selector": [
|
|
256
|
+
"objectLiteralProperty",
|
|
257
|
+
"typeProperty"
|
|
258
|
+
],
|
|
259
|
+
"format": null
|
|
260
|
+
},
|
|
221
261
|
{
|
|
222
262
|
"selector": "typeLike",
|
|
223
263
|
"format": [
|
package/dist/configs/db69ebb6.js
CHANGED
|
@@ -197,12 +197,45 @@ export default [
|
|
|
197
197
|
],
|
|
198
198
|
"@typescript-eslint/naming-convention": [
|
|
199
199
|
"error",
|
|
200
|
+
{
|
|
201
|
+
"selector": "variable",
|
|
202
|
+
"format": [
|
|
203
|
+
"strictCamelCase",
|
|
204
|
+
"UPPER_CASE",
|
|
205
|
+
"StrictPascalCase"
|
|
206
|
+
],
|
|
207
|
+
"leadingUnderscore": "allowSingleOrDouble",
|
|
208
|
+
"trailingUnderscore": "allow",
|
|
209
|
+
"filter": {
|
|
210
|
+
"regex": "[- ]",
|
|
211
|
+
"match": false
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"selector": "function",
|
|
216
|
+
"format": [
|
|
217
|
+
"strictCamelCase",
|
|
218
|
+
"StrictPascalCase"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"selector": "parameter",
|
|
223
|
+
"format": [
|
|
224
|
+
"strictCamelCase"
|
|
225
|
+
],
|
|
226
|
+
"leadingUnderscore": "allow"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"selector": "import",
|
|
230
|
+
"format": [
|
|
231
|
+
"strictCamelCase",
|
|
232
|
+
"StrictPascalCase",
|
|
233
|
+
"UPPER_CASE"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
200
236
|
{
|
|
201
237
|
"selector": [
|
|
202
|
-
"variable",
|
|
203
|
-
"function",
|
|
204
238
|
"classProperty",
|
|
205
|
-
"objectLiteralProperty",
|
|
206
239
|
"parameterProperty",
|
|
207
240
|
"classMethod",
|
|
208
241
|
"objectLiteralMethod",
|
|
@@ -219,6 +252,13 @@ export default [
|
|
|
219
252
|
"match": false
|
|
220
253
|
}
|
|
221
254
|
},
|
|
255
|
+
{
|
|
256
|
+
"selector": [
|
|
257
|
+
"objectLiteralProperty",
|
|
258
|
+
"typeProperty"
|
|
259
|
+
],
|
|
260
|
+
"format": null
|
|
261
|
+
},
|
|
222
262
|
{
|
|
223
263
|
"selector": "typeLike",
|
|
224
264
|
"format": [
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ConfigOptions, F as FlatConfigArray, O as OxlintConfigOptions, R as RuleSeverity,
|
|
2
|
-
export {
|
|
1
|
+
import { C as ConfigOptions, F as FlatConfigArray, O as OxlintConfigOptions, a as OxlintConfigResult, R as RuleSeverity, b as RuleOptions } from './types-CAUUIuJR.js';
|
|
2
|
+
export { c as RuleScope } from './types-CAUUIuJR.js';
|
|
3
3
|
import 'eslint';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ declare function getEslintConfig(opts?: ConfigOptions): Promise<FlatConfigArray>
|
|
|
11
11
|
* Loads a pre-generated OxLint config from the hashed JSON file.
|
|
12
12
|
* Only `react`, `node`, and `ai` flags are relevant — `oxlint` is ignored.
|
|
13
13
|
*/
|
|
14
|
-
declare function getOxlintConfig(opts?: OxlintConfigOptions):
|
|
14
|
+
declare function getOxlintConfig(opts?: OxlintConfigOptions): OxlintConfigResult;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Change the severity of a rule across all config blocks, preserving options.
|
|
@@ -49,4 +49,4 @@ declare function bitmaskToHash(mask: number): string;
|
|
|
49
49
|
/** Convenience: options → filename (without path prefix). */
|
|
50
50
|
declare function optionsToFilename(opts: ConfigOptions): string;
|
|
51
51
|
|
|
52
|
-
export { ConfigOptions, FlatConfigArray, OxlintConfigOptions, RuleOptions, RuleSeverity, addRule, bitmaskToHash, configureRule, disableAllRulesBut, disableRule, getEslintConfig, getOxlintConfig, optionsToBitmask, optionsToFilename, setRuleSeverity };
|
|
52
|
+
export { ConfigOptions, FlatConfigArray, OxlintConfigOptions, OxlintConfigResult, RuleOptions, RuleSeverity, addRule, bitmaskToHash, configureRule, disableAllRulesBut, disableRule, getEslintConfig, getOxlintConfig, optionsToBitmask, optionsToFilename, setRuleSeverity };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/loader.ts","../src/hash.ts","../src/api/rule-helpers.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename -- Paths are computed from deterministic hashes in dist/, not from user input. */\nimport { readFileSync } from \"node:fs\"\nimport path from \"node:path\"\n\nimport type { ConfigOptions, FlatConfigArray, OxlintConfigOptions } from \"./types\"\n\nimport { optionsToFilename, oxlintOptionsToFilename } from \"./hash\"\n\n/**\n * Loads a pre-generated ESLint config by dynamically importing the hashed file.\n * The hash is computed from the options using the same algorithm as the build.\n */\nexport async function getEslintConfig(\n opts: ConfigOptions = {},\n): Promise<FlatConfigArray> {\n const filename = optionsToFilename(opts)\n const dirname = import.meta.dirname\n const configPath = path.join(dirname, \"configs\", filename)\n\n try {\n const module = (await import(\n /* webpackIgnore: true */\n `${configPath}?${Date.now()}`\n )) as { default: FlatConfigArray }\n return module.default\n } catch {\n throw new Error(\n `eslint-config-setup: No pre-generated config found for options ${JSON.stringify(opts)}. ` +\n `Expected file: configs/${filename}. Run \"npm run generate\" in the package to build configs.`,\n )\n }\n}\n\n/**\n * Loads a pre-generated OxLint config from the hashed JSON file.\n * Only `react`, `node`, and `ai` flags are relevant — `oxlint` is ignored.\n */\nexport function getOxlintConfig(\n opts: OxlintConfigOptions = {},\n): unknown {\n const filename = oxlintOptionsToFilename(opts)\n const dirname = import.meta.dirname\n const configPath = path.join(dirname, \"oxlint-configs\", filename)\n\n try {\n const content = readFileSync(configPath, \"utf8\")\n return JSON.parse(content) as unknown\n } catch {\n throw new Error(\n `eslint-config-setup: No pre-generated OxLint config found for options ${JSON.stringify(opts)}. ` +\n `Expected file: oxlint-configs/${filename}. Run \"npm run generate\" in the package to build configs.`,\n )\n }\n}\n","import { createHash } from \"node:crypto\"\n\nimport type { ConfigOptions, OxlintConfigOptions } from \"./types\"\n\n/**\n * Converts config options to a deterministic bitmask.\n * Bit order is fixed and must never change (would break published configs).\n */\nexport function optionsToBitmask(opts: ConfigOptions): number {\n let mask = 0\n if (opts.react) mask |= 1 << 0\n if (opts.node) mask |= 1 << 1\n if (opts.ai) mask |= 1 << 2\n if (opts.oxlint) mask |= 1 << 3\n return mask\n}\n\n/**\n * Converts a bitmask to a short deterministic hash (8 hex chars).\n * The same hash is produced at build-time (generate) and run-time (getConfig).\n */\nexport function bitmaskToHash(mask: number): string {\n const input = `effective-eslint-config:${mask}`\n return createHash(\"sha1\").update(input).digest(\"hex\").slice(0, 8)\n}\n\n/** Convenience: options → filename (without path prefix). */\nexport function optionsToFilename(opts: ConfigOptions): string {\n return `${bitmaskToHash(optionsToBitmask(opts))}.js`\n}\n\n/** Total number of permutations (2^4 = 16). */\nexport const TOTAL_PERMUTATIONS = 16\n\n/** Iterate all possible option combinations. */\nexport function* allPermutations(): Generator<ConfigOptions> {\n for (let mask = 0; mask < TOTAL_PERMUTATIONS; mask++) {\n yield {\n react: Boolean(mask & (1 << 0)),\n node: Boolean(mask & (1 << 1)),\n ai: Boolean(mask & (1 << 2)),\n oxlint: Boolean(mask & (1 << 3)),\n }\n }\n}\n\n// --- OxLint config permutations (3 flags → 8 combos) ---\n\n/** Converts OxLint-relevant options to a 3-bit bitmask (react, node, ai). */\nexport function oxlintOptionsToBitmask(opts: OxlintConfigOptions): number {\n let mask = 0\n if (opts.react) mask |= 1 << 0\n if (opts.node) mask |= 1 << 1\n if (opts.ai) mask |= 1 << 2\n return mask\n}\n\n/** Deterministic hash for OxLint configs (different salt to avoid collisions). */\nexport function oxlintBitmaskToHash(mask: number): string {\n const input = `eslint-config-setup-oxlint:${mask}`\n return createHash(\"sha1\").update(input).digest(\"hex\").slice(0, 8)\n}\n\n/** OxLint options → filename (without path prefix). */\nexport function oxlintOptionsToFilename(opts: OxlintConfigOptions): string {\n return `${oxlintBitmaskToHash(oxlintOptionsToBitmask(opts))}.json`\n}\n\n/** Total number of OxLint permutations (2^3 = 8). */\nexport const TOTAL_OXLINT_PERMUTATIONS = 8\n\n/** Iterate all OxLint option combinations. */\nexport function* allOxlintPermutations(): Generator<OxlintConfigOptions> {\n for (let mask = 0; mask < TOTAL_OXLINT_PERMUTATIONS; mask++) {\n yield {\n react: Boolean(mask & (1 << 0)),\n node: Boolean(mask & (1 << 1)),\n ai: Boolean(mask & (1 << 2)),\n }\n }\n}\n","/* eslint-disable max-params, complexity -- Public API: config + ruleName + severity + options is the natural signature. Options objects would hurt ergonomics for one-liner calls. */\nimport type { Linter } from \"eslint\"\n\nimport type {\n FlatConfigArray,\n RuleOptions,\n RuleSeverity,\n} from \"../types\"\n\nconst CONFIG_PREFIX = \"eslint-config-setup/\"\n\n/** Maps user-facing scope names to config block name segments. */\nconst SCOPE_TO_BLOCK: Record<string, string> = {\n configs: \"config-files\",\n}\n\n/**\n * Check if a config block matches a given scope.\n * A block matches if its name is `eslint-config-setup/{segment}` or starts with `eslint-config-setup/{segment}-`.\n */\nfunction blockMatchesScope(\n block: Linter.Config,\n scope: string,\n): boolean {\n const name = block.name\n if (name == null) return false\n const segment = SCOPE_TO_BLOCK[scope] ?? scope\n const target = `${CONFIG_PREFIX}${segment}`\n return name === target || name.startsWith(`${target}-`)\n}\n\n/**\n * Change the severity of a rule across all config blocks, preserving options.\n */\nexport function setRuleSeverity(\n config: FlatConfigArray,\n ruleName: string,\n severity: RuleSeverity,\n options?: RuleOptions,\n): void {\n for (const block of config) {\n if (options?.scope !== undefined && !blockMatchesScope(block, options.scope)) continue\n if (block.rules?.[ruleName] == null) continue\n\n const current = block.rules[ruleName]\n if (Array.isArray(current)) {\n block.rules[ruleName] = [severity, ...current.slice(1)] as Linter.RuleEntry\n } else {\n block.rules[ruleName] = severity\n }\n }\n}\n\n/**\n * Update the options of a rule across all config blocks, preserving severity.\n */\nexport function configureRule(\n config: FlatConfigArray,\n ruleName: string,\n options: unknown[],\n ruleOptions?: RuleOptions,\n): void {\n for (const block of config) {\n if (ruleOptions?.scope !== undefined && !blockMatchesScope(block, ruleOptions.scope))\n continue\n if (block.rules?.[ruleName] == null) continue\n\n const current = block.rules[ruleName]\n const severity = Array.isArray(current) ? current[0] : current\n block.rules[ruleName] = [severity, ...options] as Linter.RuleEntry\n }\n}\n\n/**\n * Completely disable a rule across all config blocks.\n * With scope: disables in the first matching block (creates entry if needed).\n */\nexport function disableRule(\n config: FlatConfigArray,\n ruleName: string,\n options?: RuleOptions,\n): void {\n if (options?.scope != null) {\n const { scope } = options\n const block = config.find((b) => blockMatchesScope(b, scope))\n if (!block) return\n block.rules ??= {}\n block.rules[ruleName] = \"off\"\n return\n }\n\n for (const block of config) {\n if (block.rules?.[ruleName] == null) continue\n block.rules[ruleName] = \"off\"\n }\n}\n\n/**\n * Add a new rule to the first (base) config block.\n * With scope: adds to the first matching block instead.\n */\nexport function addRule(\n config: FlatConfigArray,\n ruleName: string,\n severity: RuleSeverity,\n options?: RuleOptions | unknown[],\n ruleOptions?: RuleOptions,\n): void {\n // Handle overloaded signatures: addRule(config, rule, severity, options?, ruleOptions?)\n // When options is a plain object with scope, it's actually ruleOptions\n let ruleOpts: undefined | unknown[]\n let scopeOpts: RuleOptions | undefined\n\n if (Array.isArray(options)) {\n ruleOpts = options\n scopeOpts = ruleOptions\n } else if (options && typeof options === \"object\" && \"scope\" in options) {\n scopeOpts = options\n } else if (options === undefined) {\n scopeOpts = ruleOptions\n }\n\n let target: Linter.Config | undefined\n if (scopeOpts?.scope != null) {\n const { scope } = scopeOpts\n target = config.find((b) => blockMatchesScope(b, scope))\n } else {\n target = config[0]\n }\n\n if (!target) return\n\n target.rules ??= {}\n target.rules[ruleName] = ruleOpts\n ? ([severity, ...ruleOpts] as Linter.RuleEntry)\n : severity\n}\n\n/**\n * Disable all rules except the specified one — useful for debugging.\n */\nexport function disableAllRulesBut(\n config: FlatConfigArray,\n keepRuleName: string,\n): void {\n for (const block of config) {\n if (!block.rules) continue\n for (const ruleName of Object.keys(block.rules)) {\n if (ruleName !== keepRuleName) {\n block.rules[ruleName] = \"off\"\n }\n }\n }\n}\n"],"mappings":";AACA,SAAS,oBAAoB;AAC7B,OAAO,UAAU;;;ACFjB,SAAS,kBAAkB;AAQpB,SAAS,iBAAiB,MAA6B;AAC5D,MAAI,OAAO;AACX,MAAI,KAAK,MAAO,SAAQ,KAAK;AAC7B,MAAI,KAAK,KAAM,SAAQ,KAAK;AAC5B,MAAI,KAAK,GAAI,SAAQ,KAAK;AAC1B,MAAI,KAAK,OAAQ,SAAQ,KAAK;AAC9B,SAAO;AACT;AAMO,SAAS,cAAc,MAAsB;AAClD,QAAM,QAAQ,2BAA2B,IAAI;AAC7C,SAAO,WAAW,MAAM,EAAE,OAAO,KAAK,EA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M,kBAAkB,GAAG,KAAK,CAAC;AAC5D,QAAI,CAAC,MAAO;AACZ,UAAM,UAAU,CAAC;AACjB,UAAM,MAAM,QAAQ,IAAI;AACxB;AAAA,EACF;AAEA,aAAW,SAAS,QAAQ;AAC1B,QAAI,MAAM,QAAQ,QAAQ,KAAK,KAAM;AACrC,UAAM,MAAM,QAAQ,IAAI;AAAA,EAC1B;AACF;AAMO,SAAS,QACd,QACA,UACA,UACA,SACA,aACM;AAGN,MAAI;AACJ,MAAI;AAEJ,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,eAAW;AACX,gBAAY;AAAA,EACd,WAAW,WAAW,OAAO,YAAY,YAAY,WAAW,SAAS;AACvE,gBAAY;AAAA,EACd,WAAW,YAAY,QAAW;AAChC,gBAAY;AAAA,EACd;AAEA,MAAI;AACJ,MAAI,WAAW,SAAS,MAAM;AAC5B,UAAM,EAAE,MAAM,IAAI;AAClB,aAAS,OAAO,KAAK,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAAA,EACzD,OAAO;AACL,aAAS,OAAO,CAAC;AAAA,EACnB;AAEA,MAAI,CAAC,OAAQ;AAEb,SAAO,UAAU,CAAC;AAClB,SAAO,MAAM,QAAQ,IAAI,WACpB,CAAC,UAAU,GAAG,QAAQ,IACvB;AACN;AAKO,SAAS,mBACd,QACA,cACM;AACN,aAAW,SAAS,QAAQ;AAC1B,QAAI,CAAC,MAAM,MAAO;AAClB,eAAW,YAAY,OAAO,KAAK,MAAM,KAAK,GAAG;AAC/C,UAAI,aAAa,cAAc;AAC7B,cAAM,MAAM,QAAQ,IAAI;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/loader.ts","../src/hash.ts","../src/api/rule-helpers.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename -- Paths are computed from deterministic hashes in dist/, not from user input. */\nimport { readFileSync } from \"node:fs\"\nimport path from \"node:path\"\n\nimport type { ConfigOptions, FlatConfigArray, OxlintConfigOptions, OxlintConfigResult } from \"./types\"\n\nimport { optionsToFilename, oxlintOptionsToFilename } from \"./hash\"\n\n/**\n * Loads a pre-generated ESLint config by dynamically importing the hashed file.\n * The hash is computed from the options using the same algorithm as the build.\n */\nexport async function getEslintConfig(\n opts: ConfigOptions = {},\n): Promise<FlatConfigArray> {\n const filename = optionsToFilename(opts)\n const dirname = import.meta.dirname\n const configPath = path.join(dirname, \"configs\", filename)\n\n try {\n const module = (await import(\n /* webpackIgnore: true */\n `${configPath}?${Date.now()}`\n )) as { default: FlatConfigArray }\n return module.default\n } catch {\n throw new Error(\n `eslint-config-setup: No pre-generated config found for options ${JSON.stringify(opts)}. ` +\n `Expected file: configs/${filename}. Run \"npm run generate\" in the package to build configs.`,\n )\n }\n}\n\n/**\n * Loads a pre-generated OxLint config from the hashed JSON file.\n * Only `react`, `node`, and `ai` flags are relevant — `oxlint` is ignored.\n */\nexport function getOxlintConfig(\n opts: OxlintConfigOptions = {},\n): OxlintConfigResult {\n const filename = oxlintOptionsToFilename(opts)\n const dirname = import.meta.dirname\n const configPath = path.join(dirname, \"oxlint-configs\", filename)\n\n try {\n const content = readFileSync(configPath, \"utf8\")\n return JSON.parse(content) as OxlintConfigResult\n } catch {\n throw new Error(\n `eslint-config-setup: No pre-generated OxLint config found for options ${JSON.stringify(opts)}. ` +\n `Expected file: oxlint-configs/${filename}. Run \"npm run generate\" in the package to build configs.`,\n )\n }\n}\n","import { createHash } from \"node:crypto\"\n\nimport type { ConfigOptions, OxlintConfigOptions } from \"./types\"\n\n/**\n * Converts config options to a deterministic bitmask.\n * Bit order is fixed and must never change (would break published configs).\n */\nexport function optionsToBitmask(opts: ConfigOptions): number {\n let mask = 0\n if (opts.react) mask |= 1 << 0\n if (opts.node) mask |= 1 << 1\n if (opts.ai) mask |= 1 << 2\n if (opts.oxlint) mask |= 1 << 3\n return mask\n}\n\n/**\n * Converts a bitmask to a short deterministic hash (8 hex chars).\n * The same hash is produced at build-time (generate) and run-time (getConfig).\n */\nexport function bitmaskToHash(mask: number): string {\n const input = `effective-eslint-config:${mask}`\n return createHash(\"sha1\").update(input).digest(\"hex\").slice(0, 8)\n}\n\n/** Convenience: options → filename (without path prefix). */\nexport function optionsToFilename(opts: ConfigOptions): string {\n return `${bitmaskToHash(optionsToBitmask(opts))}.js`\n}\n\n/** Total number of permutations (2^4 = 16). */\nexport const TOTAL_PERMUTATIONS = 16\n\n/** Iterate all possible option combinations. */\nexport function* allPermutations(): Generator<ConfigOptions> {\n for (let mask = 0; mask < TOTAL_PERMUTATIONS; mask++) {\n yield {\n react: Boolean(mask & (1 << 0)),\n node: Boolean(mask & (1 << 1)),\n ai: Boolean(mask & (1 << 2)),\n oxlint: Boolean(mask & (1 << 3)),\n }\n }\n}\n\n// --- OxLint config permutations (3 flags → 8 combos) ---\n\n/** Converts OxLint-relevant options to a 3-bit bitmask (react, node, ai). */\nexport function oxlintOptionsToBitmask(opts: OxlintConfigOptions): number {\n let mask = 0\n if (opts.react) mask |= 1 << 0\n if (opts.node) mask |= 1 << 1\n if (opts.ai) mask |= 1 << 2\n return mask\n}\n\n/** Deterministic hash for OxLint configs (different salt to avoid collisions). */\nexport function oxlintBitmaskToHash(mask: number): string {\n const input = `eslint-config-setup-oxlint:${mask}`\n return createHash(\"sha1\").update(input).digest(\"hex\").slice(0, 8)\n}\n\n/** OxLint options → filename (without path prefix). */\nexport function oxlintOptionsToFilename(opts: OxlintConfigOptions): string {\n return `${oxlintBitmaskToHash(oxlintOptionsToBitmask(opts))}.json`\n}\n\n/** Total number of OxLint permutations (2^3 = 8). */\nexport const TOTAL_OXLINT_PERMUTATIONS = 8\n\n/** Iterate all OxLint option combinations. */\nexport function* allOxlintPermutations(): Generator<OxlintConfigOptions> {\n for (let mask = 0; mask < TOTAL_OXLINT_PERMUTATIONS; mask++) {\n yield {\n react: Boolean(mask & (1 << 0)),\n node: Boolean(mask & (1 << 1)),\n ai: Boolean(mask & (1 << 2)),\n }\n }\n}\n","/* eslint-disable max-params, complexity -- Public API: config + ruleName + severity + options is the natural signature. Options objects would hurt ergonomics for one-liner calls. */\nimport type { Linter } from \"eslint\"\n\nimport type {\n FlatConfigArray,\n RuleOptions,\n RuleSeverity,\n} from \"../types\"\n\nconst CONFIG_PREFIX = \"eslint-config-setup/\"\n\n/** Maps user-facing scope names to config block name segments. */\nconst SCOPE_TO_BLOCK: Record<string, string> = {\n configs: \"config-files\",\n}\n\n/**\n * Check if a config block matches a given scope.\n * A block matches if its name is `eslint-config-setup/{segment}` or starts with `eslint-config-setup/{segment}-`.\n */\nfunction blockMatchesScope(\n block: Linter.Config,\n scope: string,\n): boolean {\n const name = block.name\n if (name == null) return false\n const segment = SCOPE_TO_BLOCK[scope] ?? scope\n const target = `${CONFIG_PREFIX}${segment}`\n return name === target || name.startsWith(`${target}-`)\n}\n\n/**\n * Change the severity of a rule across all config blocks, preserving options.\n */\nexport function setRuleSeverity(\n config: FlatConfigArray,\n ruleName: string,\n severity: RuleSeverity,\n options?: RuleOptions,\n): void {\n for (const block of config) {\n if (options?.scope !== undefined && !blockMatchesScope(block, options.scope)) continue\n if (block.rules?.[ruleName] == null) continue\n\n const current = block.rules[ruleName]\n if (Array.isArray(current)) {\n block.rules[ruleName] = [severity, ...current.slice(1)] as Linter.RuleEntry\n } else {\n block.rules[ruleName] = severity\n }\n }\n}\n\n/**\n * Update the options of a rule across all config blocks, preserving severity.\n */\nexport function configureRule(\n config: FlatConfigArray,\n ruleName: string,\n options: unknown[],\n ruleOptions?: RuleOptions,\n): void {\n for (const block of config) {\n if (ruleOptions?.scope !== undefined && !blockMatchesScope(block, ruleOptions.scope))\n continue\n if (block.rules?.[ruleName] == null) continue\n\n const current = block.rules[ruleName]\n const severity = Array.isArray(current) ? current[0] : current\n block.rules[ruleName] = [severity, ...options] as Linter.RuleEntry\n }\n}\n\n/**\n * Completely disable a rule across all config blocks.\n * With scope: disables in the first matching block (creates entry if needed).\n */\nexport function disableRule(\n config: FlatConfigArray,\n ruleName: string,\n options?: RuleOptions,\n): void {\n if (options?.scope != null) {\n const { scope } = options\n const block = config.find((b) => blockMatchesScope(b, scope))\n if (!block) return\n block.rules ??= {}\n block.rules[ruleName] = \"off\"\n return\n }\n\n for (const block of config) {\n if (block.rules?.[ruleName] == null) continue\n block.rules[ruleName] = \"off\"\n }\n}\n\n/**\n * Add a new rule to the first (base) config block.\n * With scope: adds to the first matching block instead.\n */\nexport function addRule(\n config: FlatConfigArray,\n ruleName: string,\n severity: RuleSeverity,\n options?: RuleOptions | unknown[],\n ruleOptions?: RuleOptions,\n): void {\n // Handle overloaded signatures: addRule(config, rule, severity, options?, ruleOptions?)\n // When options is a plain object with scope, it's actually ruleOptions\n let ruleOpts: undefined | unknown[]\n let scopeOpts: RuleOptions | undefined\n\n if (Array.isArray(options)) {\n ruleOpts = options\n scopeOpts = ruleOptions\n } else if (options && typeof options === \"object\" && \"scope\" in options) {\n scopeOpts = options\n } else if (options === undefined) {\n scopeOpts = ruleOptions\n }\n\n let target: Linter.Config | undefined\n if (scopeOpts?.scope != null) {\n const { scope } = scopeOpts\n target = config.find((b) => blockMatchesScope(b, scope))\n } else {\n target = config[0]\n }\n\n if (!target) return\n\n target.rules ??= {}\n target.rules[ruleName] = ruleOpts\n ? ([severity, ...ruleOpts] as Linter.RuleEntry)\n : severity\n}\n\n/**\n * Disable all rules except the specified one — useful for debugging.\n */\nexport function disableAllRulesBut(\n config: FlatConfigArray,\n keepRuleName: string,\n): void {\n for (const block of config) {\n if (!block.rules) continue\n for (const ruleName of Object.keys(block.rules)) {\n if (ruleName !== keepRuleName) {\n block.rules[ruleName] = \"off\"\n }\n }\n }\n}\n"],"mappings":";AACA,SAAS,oBAAoB;AAC7B,OAAO,UAAU;;;ACFjB,SAAS,kBAAkB;AAQpB,SAAS,iBAAiB,MAA6B;AAC5D,MAAI,OAAO;AACX,MAAI,KAAK,MAAO,SAAQ,KAAK;AAC7B,MAAI,KAAK,KAAM,SAAQ,KAAK;AAC5B,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[]}
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FlatConfigArray, C as ConfigOptions } from './types-
|
|
1
|
+
import { F as FlatConfigArray, C as ConfigOptions } from './types-CAUUIuJR.js';
|
|
2
2
|
import 'eslint';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -13,7 +13,9 @@ import 'eslint';
|
|
|
13
13
|
* and tightened beyond their defaults for AI-generated code.
|
|
14
14
|
* @see ADR-0006: docs/adr/0006-ai-mode-as-dedicated-flag.md
|
|
15
15
|
*/
|
|
16
|
-
declare function aiConfig(
|
|
16
|
+
declare function aiConfig(opts?: {
|
|
17
|
+
react?: boolean;
|
|
18
|
+
}): FlatConfigArray;
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Base ESLint config — extends `eslint.configs.recommended` with additional
|
package/dist/modules.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/configs/ai.ts
|
|
2
|
-
function aiConfig() {
|
|
2
|
+
function aiConfig(opts) {
|
|
3
|
+
const isReact = opts?.react ?? false;
|
|
3
4
|
const configs = [
|
|
4
5
|
{
|
|
5
6
|
name: "eslint-config-setup/ai-structural",
|
|
@@ -136,12 +137,29 @@ function aiConfig() {
|
|
|
136
137
|
// https://typescript-eslint.io/rules/naming-convention
|
|
137
138
|
"@typescript-eslint/naming-convention": [
|
|
138
139
|
"error",
|
|
140
|
+
{
|
|
141
|
+
selector: "variable",
|
|
142
|
+
format: isReact ? ["strictCamelCase", "UPPER_CASE", "StrictPascalCase"] : ["strictCamelCase", "UPPER_CASE"],
|
|
143
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
144
|
+
trailingUnderscore: "allow",
|
|
145
|
+
filter: { regex: "[- ]", match: false }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
selector: "function",
|
|
149
|
+
format: isReact ? ["strictCamelCase", "StrictPascalCase"] : ["strictCamelCase"]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
selector: "parameter",
|
|
153
|
+
format: ["strictCamelCase"],
|
|
154
|
+
leadingUnderscore: "allow"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
selector: "import",
|
|
158
|
+
format: ["strictCamelCase", "StrictPascalCase", "UPPER_CASE"]
|
|
159
|
+
},
|
|
139
160
|
{
|
|
140
161
|
selector: [
|
|
141
|
-
"variable",
|
|
142
|
-
"function",
|
|
143
162
|
"classProperty",
|
|
144
|
-
"objectLiteralProperty",
|
|
145
163
|
"parameterProperty",
|
|
146
164
|
"classMethod",
|
|
147
165
|
"objectLiteralMethod",
|
|
@@ -153,6 +171,10 @@ function aiConfig() {
|
|
|
153
171
|
trailingUnderscore: "allow",
|
|
154
172
|
filter: { regex: "[- ]", match: false }
|
|
155
173
|
},
|
|
174
|
+
{
|
|
175
|
+
selector: ["objectLiteralProperty", "typeProperty"],
|
|
176
|
+
format: null
|
|
177
|
+
},
|
|
156
178
|
{
|
|
157
179
|
selector: "typeLike",
|
|
158
180
|
format: ["StrictPascalCase"]
|
|
@@ -2347,7 +2369,7 @@ function composeConfig(opts) {
|
|
|
2347
2369
|
config.push(...reactEffectConfig());
|
|
2348
2370
|
}
|
|
2349
2371
|
if (opts.ai) {
|
|
2350
|
-
config.push(...aiConfig());
|
|
2372
|
+
config.push(...aiConfig({ react: opts.react }));
|
|
2351
2373
|
config.push(...perfectionistAiConfig());
|
|
2352
2374
|
config.push(...packageJsonAiConfig());
|
|
2353
2375
|
}
|