@ntnyq/eslint-config 3.5.0 → 3.6.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/dist/index.cjs +396 -118
- package/dist/index.d.cts +51 -23
- package/dist/index.d.ts +51 -23
- package/dist/index.js +396 -118
- package/package.json +10 -8
package/dist/index.cjs
CHANGED
|
@@ -499,14 +499,37 @@ var unCategorizedRules = {
|
|
|
499
499
|
var vue = (options = {}) => {
|
|
500
500
|
const isVue3 = options.vueVersion !== 2;
|
|
501
501
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
502
|
+
const { files: FILES_VUE = [GLOB_VUE] } = options;
|
|
503
|
+
function getVueProcessor() {
|
|
504
|
+
const processorVueSFC = import_eslint_plugin_vue.default.processors[".vue"];
|
|
505
|
+
if (!sfcBlocks) return processorVueSFC;
|
|
506
|
+
return (0, import_eslint_merge_processors3.mergeProcessors)([
|
|
507
|
+
processorVueSFC,
|
|
508
|
+
(0, import_eslint_processor_vue_blocks.default)({
|
|
509
|
+
...sfcBlocks,
|
|
510
|
+
blocks: {
|
|
511
|
+
styles: true,
|
|
512
|
+
...sfcBlocks.blocks
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
]);
|
|
516
|
+
}
|
|
502
517
|
return [
|
|
503
518
|
{
|
|
504
519
|
name: "ntnyq/vue/setup",
|
|
505
520
|
plugins: {
|
|
506
521
|
vue: import_eslint_plugin_vue.default,
|
|
507
522
|
"@typescript-eslint": import_typescript_eslint2.plugin
|
|
508
|
-
}
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "ntnyq/vue/rules",
|
|
527
|
+
files: [
|
|
528
|
+
// File apply vue rules
|
|
529
|
+
...FILES_VUE
|
|
530
|
+
],
|
|
509
531
|
languageOptions: {
|
|
532
|
+
parser: parserVue,
|
|
510
533
|
parserOptions: {
|
|
511
534
|
sourceType: "module",
|
|
512
535
|
ecmaVersion: "latest",
|
|
@@ -516,24 +539,8 @@ var vue = (options = {}) => {
|
|
|
516
539
|
jsx: true
|
|
517
540
|
}
|
|
518
541
|
}
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
name: "ntnyq/vue/rules",
|
|
523
|
-
files: [GLOB_VUE],
|
|
524
|
-
languageOptions: {
|
|
525
|
-
parser: parserVue
|
|
526
542
|
},
|
|
527
|
-
processor:
|
|
528
|
-
import_eslint_plugin_vue.default.processors[".vue"],
|
|
529
|
-
(0, import_eslint_processor_vue_blocks.default)({
|
|
530
|
-
...sfcBlocks,
|
|
531
|
-
blocks: {
|
|
532
|
-
styles: true,
|
|
533
|
-
...sfcBlocks.blocks
|
|
534
|
-
}
|
|
535
|
-
})
|
|
536
|
-
]),
|
|
543
|
+
processor: getVueProcessor(),
|
|
537
544
|
rules: {
|
|
538
545
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
539
546
|
"vue/html-self-closing": [
|
|
@@ -1035,25 +1042,25 @@ var toml = (options = {}) => [
|
|
|
1035
1042
|
toml: import_eslint_plugin_toml.default
|
|
1036
1043
|
},
|
|
1037
1044
|
rules: {
|
|
1038
|
-
"toml/comma-style": "error",
|
|
1039
1045
|
"toml/keys-order": "error",
|
|
1046
|
+
"toml/key-spacing": "error",
|
|
1047
|
+
"toml/quoted-keys": "error",
|
|
1048
|
+
"toml/comma-style": "error",
|
|
1049
|
+
"toml/tables-order": "error",
|
|
1040
1050
|
"toml/no-space-dots": "error",
|
|
1041
|
-
"toml/
|
|
1042
|
-
"toml/precision-of-fractional-seconds": "error",
|
|
1051
|
+
"toml/spaced-comment": "error",
|
|
1043
1052
|
"toml/precision-of-integer": "error",
|
|
1044
|
-
"toml/
|
|
1045
|
-
"toml/indent": ["error", 2],
|
|
1046
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1053
|
+
"toml/table-bracket-spacing": "error",
|
|
1047
1054
|
"toml/array-bracket-newline": "error",
|
|
1048
|
-
"toml/array-bracket-spacing": ["error", "never"],
|
|
1049
|
-
"toml/array-element-newline": ["error", "never"],
|
|
1050
1055
|
"toml/inline-table-curly-spacing": "error",
|
|
1051
|
-
"toml/key-spacing": "error",
|
|
1052
1056
|
"toml/padding-line-between-pairs": "error",
|
|
1053
1057
|
"toml/padding-line-between-tables": "error",
|
|
1054
|
-
"toml/
|
|
1055
|
-
"toml/
|
|
1056
|
-
"toml/
|
|
1058
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1059
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1060
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1061
|
+
"toml/indent": ["error", 2],
|
|
1062
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
1063
|
+
"toml/array-element-newline": ["error", "never"],
|
|
1057
1064
|
// Overrides rules
|
|
1058
1065
|
...options.overrides
|
|
1059
1066
|
}
|
|
@@ -1109,6 +1116,13 @@ var antfu = (options = {}) => [
|
|
|
1109
1116
|
];
|
|
1110
1117
|
|
|
1111
1118
|
// src/configs/jsdoc.ts
|
|
1119
|
+
var typescriptRules = {
|
|
1120
|
+
"jsdoc/no-undefined-types": "off",
|
|
1121
|
+
"jsdoc/require-param-type": "off",
|
|
1122
|
+
"jsdoc/require-property-type": "off",
|
|
1123
|
+
"jsdoc/require-returns-type": "off",
|
|
1124
|
+
"jsdoc/no-types": "error"
|
|
1125
|
+
};
|
|
1112
1126
|
var jsdoc = (options = {}) => [
|
|
1113
1127
|
{
|
|
1114
1128
|
name: "ntnyq/jsdoc",
|
|
@@ -1116,23 +1130,204 @@ var jsdoc = (options = {}) => [
|
|
|
1116
1130
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
1117
1131
|
},
|
|
1118
1132
|
rules: {
|
|
1133
|
+
// Disabled rules
|
|
1134
|
+
"jsdoc/tag-lines": "off",
|
|
1135
|
+
// Use `jsdoc/sort-tags`
|
|
1136
|
+
"jsdoc/text-escaping": "off",
|
|
1137
|
+
// No need
|
|
1138
|
+
// Fixable rules
|
|
1139
|
+
"jsdoc/check-alignment": "error",
|
|
1140
|
+
"jsdoc/check-line-alignment": "error",
|
|
1141
|
+
"jsdoc/check-param-names": "error",
|
|
1142
|
+
"jsdoc/check-property-names": "error",
|
|
1143
|
+
"jsdoc/check-tag-names": "error",
|
|
1144
|
+
"jsdoc/check-types": "error",
|
|
1145
|
+
"jsdoc/empty-tags": "error",
|
|
1146
|
+
"jsdoc/multiline-blocks": "error",
|
|
1147
|
+
"jsdoc/no-bad-blocks": "error",
|
|
1148
|
+
"jsdoc/no-blank-block-descriptions": "error",
|
|
1149
|
+
"jsdoc/no-blank-blocks": "error",
|
|
1150
|
+
"jsdoc/no-defaults": "error",
|
|
1151
|
+
"jsdoc/no-multi-asterisks": "error",
|
|
1152
|
+
"jsdoc/require-asterisk-prefix": "error",
|
|
1153
|
+
"jsdoc/require-hyphen-before-param-description": "error",
|
|
1154
|
+
// TODO: this after investigate
|
|
1155
|
+
// 'jsdoc/sort-tags': [
|
|
1156
|
+
// 'error',
|
|
1157
|
+
// {
|
|
1158
|
+
// tagSequence: [
|
|
1159
|
+
// {
|
|
1160
|
+
// // Module/file-level
|
|
1161
|
+
// tags: ['module', 'exports', 'file', 'fileoverview', 'overview', 'import'],
|
|
1162
|
+
// },
|
|
1163
|
+
// {
|
|
1164
|
+
// // Identifying (name, type)
|
|
1165
|
+
// tags: [
|
|
1166
|
+
// 'typedef',
|
|
1167
|
+
// 'interface',
|
|
1168
|
+
// 'record',
|
|
1169
|
+
// 'template',
|
|
1170
|
+
// 'name',
|
|
1171
|
+
// 'kind',
|
|
1172
|
+
// 'type',
|
|
1173
|
+
// 'alias',
|
|
1174
|
+
// 'external',
|
|
1175
|
+
// 'host',
|
|
1176
|
+
// 'callback',
|
|
1177
|
+
// 'func',
|
|
1178
|
+
// 'function',
|
|
1179
|
+
// 'method',
|
|
1180
|
+
// 'class',
|
|
1181
|
+
// 'constructor',
|
|
1182
|
+
// ],
|
|
1183
|
+
// },
|
|
1184
|
+
// {
|
|
1185
|
+
// // Relationships
|
|
1186
|
+
// tags: [
|
|
1187
|
+
// 'modifies',
|
|
1188
|
+
// 'mixes',
|
|
1189
|
+
// 'mixin',
|
|
1190
|
+
// 'mixinClass',
|
|
1191
|
+
// 'mixinFunction',
|
|
1192
|
+
// 'namespace',
|
|
1193
|
+
// 'borrows',
|
|
1194
|
+
// 'constructs',
|
|
1195
|
+
// 'lends',
|
|
1196
|
+
// 'implements',
|
|
1197
|
+
// 'requires',
|
|
1198
|
+
// ],
|
|
1199
|
+
// },
|
|
1200
|
+
// {
|
|
1201
|
+
// // Long descriptions
|
|
1202
|
+
// tags: ['desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license'],
|
|
1203
|
+
// },
|
|
1204
|
+
// {
|
|
1205
|
+
// // Simple annotations
|
|
1206
|
+
// tags: [
|
|
1207
|
+
// 'const',
|
|
1208
|
+
// 'constant',
|
|
1209
|
+
// 'final',
|
|
1210
|
+
// 'global',
|
|
1211
|
+
// 'readonly',
|
|
1212
|
+
// 'abstract',
|
|
1213
|
+
// 'virtual',
|
|
1214
|
+
// 'var',
|
|
1215
|
+
// 'member',
|
|
1216
|
+
// 'memberof',
|
|
1217
|
+
// 'memberof!',
|
|
1218
|
+
// 'inner',
|
|
1219
|
+
// 'instance',
|
|
1220
|
+
// 'inheritdoc',
|
|
1221
|
+
// 'inheritDoc',
|
|
1222
|
+
// 'override',
|
|
1223
|
+
// 'hideconstructor',
|
|
1224
|
+
// ],
|
|
1225
|
+
// },
|
|
1226
|
+
// {
|
|
1227
|
+
// // Core function/object inf
|
|
1228
|
+
// tags: ['param', 'arg', 'argument', 'prop', 'property', 'return', 'returns'],
|
|
1229
|
+
// },
|
|
1230
|
+
// {
|
|
1231
|
+
// // Important behavior details
|
|
1232
|
+
// tags: [
|
|
1233
|
+
// 'async',
|
|
1234
|
+
// 'generator',
|
|
1235
|
+
// 'default',
|
|
1236
|
+
// 'defaultvalue',
|
|
1237
|
+
// 'enum',
|
|
1238
|
+
// 'augments',
|
|
1239
|
+
// 'extends',
|
|
1240
|
+
// 'throws',
|
|
1241
|
+
// 'exception',
|
|
1242
|
+
// 'yield',
|
|
1243
|
+
// 'yields',
|
|
1244
|
+
// 'event',
|
|
1245
|
+
// 'fires',
|
|
1246
|
+
// 'emits',
|
|
1247
|
+
// 'listens',
|
|
1248
|
+
// 'this',
|
|
1249
|
+
// ],
|
|
1250
|
+
// },
|
|
1251
|
+
// {
|
|
1252
|
+
// // Access
|
|
1253
|
+
// tags: ['static', 'private', 'protected', 'public', 'access', 'internal', 'package'],
|
|
1254
|
+
// },
|
|
1255
|
+
// {
|
|
1256
|
+
// // Other/unknown
|
|
1257
|
+
// tags: ['-other'],
|
|
1258
|
+
// },
|
|
1259
|
+
// {
|
|
1260
|
+
// // Supplementary descriptions
|
|
1261
|
+
// tags: ['see', 'example'],
|
|
1262
|
+
// },
|
|
1263
|
+
// {
|
|
1264
|
+
// // Other Closure (undocumented) metadata
|
|
1265
|
+
// tags: [
|
|
1266
|
+
// 'closurePrimitive',
|
|
1267
|
+
// 'customElement',
|
|
1268
|
+
// 'expose',
|
|
1269
|
+
// 'hidden',
|
|
1270
|
+
// 'idGenerator',
|
|
1271
|
+
// 'meaning',
|
|
1272
|
+
// 'ngInject',
|
|
1273
|
+
// 'owner',
|
|
1274
|
+
// 'wizaction',
|
|
1275
|
+
// ],
|
|
1276
|
+
// },
|
|
1277
|
+
// {
|
|
1278
|
+
// // Other Closure (documented) metadata
|
|
1279
|
+
// tags: [
|
|
1280
|
+
// 'define',
|
|
1281
|
+
// 'dict',
|
|
1282
|
+
// 'export',
|
|
1283
|
+
// 'externs',
|
|
1284
|
+
// 'implicitCast',
|
|
1285
|
+
// 'noalias',
|
|
1286
|
+
// 'nocollapse',
|
|
1287
|
+
// 'nocompile',
|
|
1288
|
+
// 'noinline',
|
|
1289
|
+
// 'nosideeffects',
|
|
1290
|
+
// 'polymer',
|
|
1291
|
+
// 'polymerBehavior',
|
|
1292
|
+
// 'preserve',
|
|
1293
|
+
// 'struct',
|
|
1294
|
+
// 'suppress',
|
|
1295
|
+
// 'unrestricted',
|
|
1296
|
+
// ],
|
|
1297
|
+
// },
|
|
1298
|
+
// {
|
|
1299
|
+
// // Metadata
|
|
1300
|
+
// tags: ['category'],
|
|
1301
|
+
// },
|
|
1302
|
+
// {
|
|
1303
|
+
// // Non-Closure metadata
|
|
1304
|
+
// tags: [
|
|
1305
|
+
// 'ignore',
|
|
1306
|
+
// 'author',
|
|
1307
|
+
// 'version',
|
|
1308
|
+
// 'variation',
|
|
1309
|
+
// 'since',
|
|
1310
|
+
// 'deprecated',
|
|
1311
|
+
// 'compatibility',
|
|
1312
|
+
// 'todo',
|
|
1313
|
+
// ],
|
|
1314
|
+
// },
|
|
1315
|
+
// ],
|
|
1316
|
+
// alphabetizeExtras: true,
|
|
1317
|
+
// linesBetween: 1,
|
|
1318
|
+
// },
|
|
1319
|
+
// ],
|
|
1119
1320
|
"jsdoc/check-access": "warn",
|
|
1120
|
-
"jsdoc/check-param-names": "warn",
|
|
1121
|
-
"jsdoc/check-property-names": "warn",
|
|
1122
|
-
"jsdoc/check-types": "warn",
|
|
1123
|
-
"jsdoc/empty-tags": "warn",
|
|
1124
1321
|
"jsdoc/implements-on-classes": "warn",
|
|
1125
|
-
"jsdoc/no-defaults": "warn",
|
|
1126
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
1127
1322
|
"jsdoc/require-param-name": "warn",
|
|
1128
1323
|
"jsdoc/require-property": "warn",
|
|
1129
|
-
"jsdoc/require-property-description": "warn",
|
|
1130
1324
|
"jsdoc/require-property-name": "warn",
|
|
1325
|
+
"jsdoc/require-property-description": "warn",
|
|
1131
1326
|
"jsdoc/require-returns-check": "warn",
|
|
1132
1327
|
"jsdoc/require-returns-description": "warn",
|
|
1133
1328
|
"jsdoc/require-yields-check": "warn",
|
|
1134
|
-
|
|
1135
|
-
|
|
1329
|
+
// TypeScript rules overrides
|
|
1330
|
+
...options.typescript ? typescriptRules : {},
|
|
1136
1331
|
// Overrides rules
|
|
1137
1332
|
...options.overrides
|
|
1138
1333
|
}
|
|
@@ -1152,10 +1347,12 @@ var jsonc = (options = {}) => [
|
|
|
1152
1347
|
},
|
|
1153
1348
|
rules: {
|
|
1154
1349
|
...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
|
|
1155
|
-
"jsonc/
|
|
1156
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1157
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1350
|
+
"jsonc/no-octal-escape": "error",
|
|
1158
1351
|
"jsonc/indent": ["error", 2],
|
|
1352
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1353
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1354
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1355
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1159
1356
|
"jsonc/key-spacing": [
|
|
1160
1357
|
"error",
|
|
1161
1358
|
{
|
|
@@ -1163,7 +1360,6 @@ var jsonc = (options = {}) => [
|
|
|
1163
1360
|
afterColon: true
|
|
1164
1361
|
}
|
|
1165
1362
|
],
|
|
1166
|
-
"jsonc/no-octal-escape": "error",
|
|
1167
1363
|
"jsonc/object-curly-newline": [
|
|
1168
1364
|
"error",
|
|
1169
1365
|
{
|
|
@@ -1171,7 +1367,6 @@ var jsonc = (options = {}) => [
|
|
|
1171
1367
|
consistent: true
|
|
1172
1368
|
}
|
|
1173
1369
|
],
|
|
1174
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1175
1370
|
"jsonc/object-property-newline": [
|
|
1176
1371
|
"error",
|
|
1177
1372
|
{
|
|
@@ -1201,23 +1396,23 @@ var ntnyq = (options = {}) => [
|
|
|
1201
1396
|
|
|
1202
1397
|
// src/configs/regexp.ts
|
|
1203
1398
|
var regexp = (options = {}) => {
|
|
1204
|
-
const
|
|
1205
|
-
const
|
|
1206
|
-
...
|
|
1399
|
+
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1400
|
+
const recommendedRules2 = {
|
|
1401
|
+
...recommendedConfig.rules
|
|
1207
1402
|
};
|
|
1208
1403
|
if (options.level === "warn") {
|
|
1209
|
-
for (const key in
|
|
1210
|
-
if (
|
|
1211
|
-
|
|
1404
|
+
for (const key in recommendedRules2) {
|
|
1405
|
+
if (recommendedRules2[key] === "error") {
|
|
1406
|
+
recommendedRules2[key] = "warn";
|
|
1212
1407
|
}
|
|
1213
1408
|
}
|
|
1214
1409
|
}
|
|
1215
1410
|
return [
|
|
1216
1411
|
{
|
|
1217
|
-
...
|
|
1412
|
+
...recommendedConfig,
|
|
1218
1413
|
name: "ntnyq/regexp",
|
|
1219
1414
|
rules: {
|
|
1220
|
-
...
|
|
1415
|
+
...recommendedRules2,
|
|
1221
1416
|
// Overrides rules
|
|
1222
1417
|
...options.overrides
|
|
1223
1418
|
}
|
|
@@ -1492,8 +1687,8 @@ var imports = (options = {}) => [
|
|
|
1492
1687
|
// src/configs/unicorn.ts
|
|
1493
1688
|
var disabledRules2 = {
|
|
1494
1689
|
"unicorn/better-regex": "off",
|
|
1495
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1496
1690
|
"unicorn/explicit-length-check": "off",
|
|
1691
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1497
1692
|
"unicorn/no-array-callback-reference": "off",
|
|
1498
1693
|
/**
|
|
1499
1694
|
* @see https://caniuse.com/?search=globalThis
|
|
@@ -1507,37 +1702,37 @@ var unicorn = (options = {}) => [
|
|
|
1507
1702
|
unicorn: import_eslint_plugin_unicorn.default
|
|
1508
1703
|
},
|
|
1509
1704
|
rules: {
|
|
1510
|
-
"unicorn/error-message": "error",
|
|
1511
1705
|
"unicorn/escape-case": "error",
|
|
1706
|
+
"unicorn/no-for-loop": "error",
|
|
1707
|
+
"unicorn/no-lonely-if": "error",
|
|
1708
|
+
"unicorn/error-message": "error",
|
|
1512
1709
|
"unicorn/no-new-buffer": "error",
|
|
1513
|
-
"unicorn/
|
|
1710
|
+
"unicorn/no-hex-escape": "error",
|
|
1711
|
+
"unicorn/throw-new-error": "error",
|
|
1514
1712
|
"unicorn/prefer-includes": "error",
|
|
1713
|
+
"unicorn/new-for-builtins": "error",
|
|
1515
1714
|
"unicorn/prefer-type-error": "error",
|
|
1516
|
-
"unicorn/
|
|
1517
|
-
"unicorn/no-
|
|
1518
|
-
"unicorn/
|
|
1519
|
-
"unicorn/no-typeof-undefined": "error",
|
|
1715
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1716
|
+
"unicorn/no-console-spaces": "error",
|
|
1717
|
+
"unicorn/no-zero-fractions": "error",
|
|
1520
1718
|
"unicorn/prefer-regexp-test": "error",
|
|
1719
|
+
"unicorn/number-literal-case": "error",
|
|
1720
|
+
"unicorn/no-typeof-undefined": "error",
|
|
1721
|
+
"unicorn/prefer-math-min-max": "error",
|
|
1722
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1723
|
+
"unicorn/no-unnecessary-await": "error",
|
|
1521
1724
|
"unicorn/no-static-only-class": "error",
|
|
1522
|
-
"unicorn/
|
|
1725
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
1726
|
+
"unicorn/prefer-negative-index": "error",
|
|
1727
|
+
"unicorn/prefer-structured-clone": "error",
|
|
1523
1728
|
"unicorn/custom-error-definition": "error",
|
|
1524
1729
|
"unicorn/prefer-modern-math-apis": "error",
|
|
1525
|
-
"unicorn/new-for-builtins": "error",
|
|
1526
|
-
"unicorn/no-console-spaces": "error",
|
|
1527
|
-
"unicorn/no-for-loop": "error",
|
|
1528
|
-
"unicorn/no-hex-escape": "error",
|
|
1529
|
-
"unicorn/no-lonely-if": "error",
|
|
1530
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
1531
|
-
"unicorn/prefer-math-trunc": "error",
|
|
1532
|
-
"unicorn/prefer-negative-index": "error",
|
|
1533
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1534
1730
|
"unicorn/prefer-number-properties": "error",
|
|
1535
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1536
1731
|
"unicorn/prefer-prototype-methods": "error",
|
|
1537
|
-
"unicorn/prefer-
|
|
1538
|
-
"unicorn/prefer-
|
|
1539
|
-
"unicorn/prefer-structured-clone": "error",
|
|
1732
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
1733
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1540
1734
|
"unicorn/consistent-existence-index-check": "error",
|
|
1735
|
+
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1541
1736
|
"unicorn/catch-error-name": [
|
|
1542
1737
|
"error",
|
|
1543
1738
|
{
|
|
@@ -1552,24 +1747,24 @@ var unicorn = (options = {}) => [
|
|
|
1552
1747
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1553
1748
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1554
1749
|
// DOM
|
|
1555
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
1556
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1557
1750
|
"unicorn/prefer-query-selector": "error",
|
|
1558
1751
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
1752
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1559
1753
|
"unicorn/prefer-dom-node-append": "error",
|
|
1560
1754
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
1561
|
-
"unicorn/prefer-
|
|
1755
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1562
1756
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1757
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1563
1758
|
// Array
|
|
1564
1759
|
"unicorn/no-new-array": "error",
|
|
1565
|
-
"unicorn/no-instanceof-array": "error",
|
|
1566
1760
|
"unicorn/no-array-push-push": "error",
|
|
1567
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
1568
1761
|
"unicorn/prefer-array-find": "error",
|
|
1569
1762
|
"unicorn/prefer-array-some": "error",
|
|
1763
|
+
"unicorn/no-instanceof-array": "error",
|
|
1570
1764
|
"unicorn/prefer-array-flat-map": "error",
|
|
1571
1765
|
"unicorn/prefer-array-index-of": "error",
|
|
1572
1766
|
"unicorn/require-array-join-separator": "error",
|
|
1767
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1573
1768
|
// Set
|
|
1574
1769
|
"unicorn/prefer-set-has": "error",
|
|
1575
1770
|
"unicorn/prefer-set-size": "error",
|
|
@@ -1582,13 +1777,15 @@ var unicorn = (options = {}) => [
|
|
|
1582
1777
|
|
|
1583
1778
|
// src/configs/specials.ts
|
|
1584
1779
|
var import_globals = __toESM(require("globals"), 1);
|
|
1585
|
-
var specials = () => [
|
|
1780
|
+
var specials = (options = {}) => [
|
|
1586
1781
|
{
|
|
1587
1782
|
name: "ntnyq/specials/scripts",
|
|
1588
1783
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
1589
1784
|
rules: {
|
|
1590
1785
|
"no-console": "off",
|
|
1591
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1786
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1787
|
+
// Overrides rules
|
|
1788
|
+
...options.overridesScriptsRules
|
|
1592
1789
|
}
|
|
1593
1790
|
},
|
|
1594
1791
|
{
|
|
@@ -1596,7 +1793,9 @@ var specials = () => [
|
|
|
1596
1793
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1597
1794
|
rules: {
|
|
1598
1795
|
"no-console": "off",
|
|
1599
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1796
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1797
|
+
// Overrides rules
|
|
1798
|
+
...options.overridesCliRules
|
|
1600
1799
|
}
|
|
1601
1800
|
},
|
|
1602
1801
|
{
|
|
@@ -1613,9 +1812,14 @@ var specials = () => [
|
|
|
1613
1812
|
{
|
|
1614
1813
|
allow: ["^GM_.+"]
|
|
1615
1814
|
}
|
|
1616
|
-
]
|
|
1815
|
+
],
|
|
1816
|
+
// Overrides rules
|
|
1817
|
+
...options.overridesUserScriptsRules
|
|
1617
1818
|
}
|
|
1618
|
-
}
|
|
1819
|
+
},
|
|
1820
|
+
// More special case configs
|
|
1821
|
+
// So don't need to append configs to composer
|
|
1822
|
+
...options.specialCaseConfigs ? options.specialCaseConfigs : []
|
|
1619
1823
|
];
|
|
1620
1824
|
|
|
1621
1825
|
// src/configs/comments.ts
|
|
@@ -1637,14 +1841,43 @@ var comments = (options = {}) => [
|
|
|
1637
1841
|
// src/configs/markdown.ts
|
|
1638
1842
|
var markdown = (options = {}) => {
|
|
1639
1843
|
if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
|
|
1844
|
+
const { files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`], extensions = [] } = options;
|
|
1640
1845
|
return [
|
|
1641
1846
|
...import_markdown.default.configs.processor.map((config) => ({
|
|
1642
1847
|
...config,
|
|
1643
1848
|
name: `ntnyq/${config.name}`
|
|
1644
1849
|
})),
|
|
1850
|
+
{
|
|
1851
|
+
name: "ntnyq/markdown/processor",
|
|
1852
|
+
files,
|
|
1853
|
+
ignores: [GLOB_MARKDOWN_NESTED],
|
|
1854
|
+
processor: (0, import_eslint_merge_processors.mergeProcessors)([
|
|
1855
|
+
import_markdown.default.processors.markdown,
|
|
1856
|
+
// Just pass through processor
|
|
1857
|
+
import_eslint_merge_processors2.processorPassThrough
|
|
1858
|
+
])
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
name: "ntnyq/markdown/parser",
|
|
1862
|
+
files,
|
|
1863
|
+
languageOptions: {
|
|
1864
|
+
parser: parserPlain
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1645
1867
|
{
|
|
1646
1868
|
name: "ntnyq/markdown/disabled/code-blocks",
|
|
1647
|
-
files: [
|
|
1869
|
+
files: [
|
|
1870
|
+
...files,
|
|
1871
|
+
// Extension block support
|
|
1872
|
+
...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
1873
|
+
],
|
|
1874
|
+
languageOptions: {
|
|
1875
|
+
parserOptions: {
|
|
1876
|
+
ecmaFeatures: {
|
|
1877
|
+
impliedStrict: true
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
},
|
|
1648
1881
|
rules: {
|
|
1649
1882
|
"no-undef": "off",
|
|
1650
1883
|
"no-alert": "off",
|
|
@@ -1677,6 +1910,7 @@ var markdown = (options = {}) => {
|
|
|
1677
1910
|
var prettier = (options = {}) => {
|
|
1678
1911
|
const {
|
|
1679
1912
|
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1913
|
+
// User defined disabled files
|
|
1680
1914
|
userDisabledFiles = []
|
|
1681
1915
|
} = options;
|
|
1682
1916
|
return [
|
|
@@ -2043,14 +2277,21 @@ var recommendedRules = import_typescript_eslint3.configs.recommended.reduce((rul
|
|
|
2043
2277
|
var typescript = (options = {}) => {
|
|
2044
2278
|
const enableTypeAwareLint = !!options?.tsconfigPath;
|
|
2045
2279
|
const {
|
|
2280
|
+
extensions = [],
|
|
2046
2281
|
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
2047
2282
|
ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
|
|
2048
2283
|
overridesTypeAwareRules = {},
|
|
2049
2284
|
parserOptions = {}
|
|
2050
2285
|
} = options;
|
|
2051
|
-
|
|
2286
|
+
const files = options.files ?? [
|
|
2287
|
+
GLOB_TS,
|
|
2288
|
+
GLOB_TSX,
|
|
2289
|
+
// Enable typescript in these exts
|
|
2290
|
+
...extensions.map((ext) => `**/*.${ext}`)
|
|
2291
|
+
];
|
|
2292
|
+
function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
|
|
2052
2293
|
const typescriptParserOptions = {
|
|
2053
|
-
|
|
2294
|
+
extraFileExtensions: extensions.map((ext) => `.${ext}`),
|
|
2054
2295
|
sourceType: "module",
|
|
2055
2296
|
...enableTypeAware ? {
|
|
2056
2297
|
projectService: {
|
|
@@ -2063,7 +2304,7 @@ var typescript = (options = {}) => {
|
|
|
2063
2304
|
};
|
|
2064
2305
|
const parserConfig = {
|
|
2065
2306
|
name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
|
|
2066
|
-
files,
|
|
2307
|
+
files: files2,
|
|
2067
2308
|
ignores: [...ignores2],
|
|
2068
2309
|
languageOptions: {
|
|
2069
2310
|
parser: parserTypeScript,
|
|
@@ -2081,12 +2322,12 @@ var typescript = (options = {}) => {
|
|
|
2081
2322
|
}
|
|
2082
2323
|
},
|
|
2083
2324
|
...enableTypeAwareLint ? [
|
|
2084
|
-
createParserConfig(false,
|
|
2325
|
+
createParserConfig(false, files),
|
|
2085
2326
|
createParserConfig(true, filesTypeAware, ignoresTypeAware)
|
|
2086
|
-
] : [createParserConfig(false,
|
|
2327
|
+
] : [createParserConfig(false, files)],
|
|
2087
2328
|
{
|
|
2088
2329
|
name: "ntnyq/ts/rules",
|
|
2089
|
-
files
|
|
2330
|
+
files,
|
|
2090
2331
|
rules: {
|
|
2091
2332
|
...recommendedRules,
|
|
2092
2333
|
// Disabled in favor of ts rules
|
|
@@ -2329,9 +2570,41 @@ var unusedImports = (options = {}) => [
|
|
|
2329
2570
|
];
|
|
2330
2571
|
|
|
2331
2572
|
// src/core.ts
|
|
2332
|
-
|
|
2573
|
+
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2574
|
+
const {
|
|
2575
|
+
/**
|
|
2576
|
+
* Shared options
|
|
2577
|
+
*/
|
|
2578
|
+
extensions: supportedExtensions = [],
|
|
2579
|
+
/**
|
|
2580
|
+
* Conditional by deps
|
|
2581
|
+
*/
|
|
2582
|
+
vue: enableVue = hasVue,
|
|
2583
|
+
test: enableTest = hasVitest,
|
|
2584
|
+
unocss: enableUnoCSS = hasUnoCSS,
|
|
2585
|
+
typescript: enableTypeScript = hasTypeScript,
|
|
2586
|
+
/**
|
|
2587
|
+
* Enabled by default
|
|
2588
|
+
*/
|
|
2589
|
+
yml: enableYML = true,
|
|
2590
|
+
sort: enableSort = true,
|
|
2591
|
+
toml: enableTOML = true,
|
|
2592
|
+
jsonc: enableJSONC = true,
|
|
2593
|
+
antfu: enableAntfu = true,
|
|
2594
|
+
regexp: enableRegexp = true,
|
|
2595
|
+
unicorn: enableUnicorn = true,
|
|
2596
|
+
prettier: enablePrettier = true,
|
|
2597
|
+
markdown: enableMarkdown = true,
|
|
2598
|
+
stylistic: enableStylistic = true,
|
|
2599
|
+
gitignore: enableGitIgnore = true,
|
|
2600
|
+
githubAction: enableGitHubAction = true,
|
|
2601
|
+
perfectionist: enablePerfectionist = true
|
|
2602
|
+
} = options;
|
|
2333
2603
|
const configs2 = [];
|
|
2334
|
-
if (
|
|
2604
|
+
if (enableVue) {
|
|
2605
|
+
supportedExtensions.push("vue");
|
|
2606
|
+
}
|
|
2607
|
+
if (enableGitIgnore) {
|
|
2335
2608
|
configs2.push(
|
|
2336
2609
|
...gitignore({
|
|
2337
2610
|
...resolveSubOptions(options, "gitignore")
|
|
@@ -2351,6 +2624,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2351
2624
|
overrides: getOverrides(options, "imports")
|
|
2352
2625
|
}),
|
|
2353
2626
|
...jsdoc({
|
|
2627
|
+
typescript: !!enableTypeScript,
|
|
2354
2628
|
overrides: getOverrides(options, "jsdoc")
|
|
2355
2629
|
}),
|
|
2356
2630
|
...comments({
|
|
@@ -2361,7 +2635,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2361
2635
|
overrides: getOverrides(options, "javascript")
|
|
2362
2636
|
})
|
|
2363
2637
|
);
|
|
2364
|
-
if (
|
|
2638
|
+
if (enablePerfectionist) {
|
|
2365
2639
|
configs2.push(
|
|
2366
2640
|
...perfectionist({
|
|
2367
2641
|
...resolveSubOptions(options, "perfectionist"),
|
|
@@ -2369,14 +2643,14 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2369
2643
|
})
|
|
2370
2644
|
);
|
|
2371
2645
|
}
|
|
2372
|
-
if (
|
|
2646
|
+
if (enableUnicorn) {
|
|
2373
2647
|
configs2.push(
|
|
2374
2648
|
...unicorn({
|
|
2375
2649
|
overrides: getOverrides(options, "unicorn")
|
|
2376
2650
|
})
|
|
2377
2651
|
);
|
|
2378
2652
|
}
|
|
2379
|
-
if (
|
|
2653
|
+
if (enableRegexp) {
|
|
2380
2654
|
configs2.push(
|
|
2381
2655
|
...regexp({
|
|
2382
2656
|
...resolveSubOptions(options, "regexp"),
|
|
@@ -2384,51 +2658,53 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2384
2658
|
})
|
|
2385
2659
|
);
|
|
2386
2660
|
}
|
|
2387
|
-
if (
|
|
2661
|
+
if (enableTypeScript) {
|
|
2388
2662
|
configs2.push(
|
|
2389
2663
|
...typescript({
|
|
2390
2664
|
...resolveSubOptions(options, "typescript"),
|
|
2665
|
+
extensions: supportedExtensions,
|
|
2391
2666
|
overrides: getOverrides(options, "typescript")
|
|
2392
2667
|
})
|
|
2393
2668
|
);
|
|
2394
2669
|
}
|
|
2395
|
-
if (
|
|
2670
|
+
if (enableVue) {
|
|
2671
|
+
configs2.push(
|
|
2672
|
+
...vue({
|
|
2673
|
+
...resolveSubOptions(options, "vue"),
|
|
2674
|
+
typescript: !!enableTypeScript,
|
|
2675
|
+
overrides: getOverrides(options, "vue")
|
|
2676
|
+
})
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2679
|
+
if (enableYML) {
|
|
2396
2680
|
configs2.push(
|
|
2397
2681
|
...yml({
|
|
2398
2682
|
overrides: getOverrides(options, "yml")
|
|
2399
2683
|
})
|
|
2400
2684
|
);
|
|
2401
2685
|
}
|
|
2402
|
-
if (
|
|
2686
|
+
if (enableTOML) {
|
|
2403
2687
|
configs2.push(
|
|
2404
2688
|
...toml({
|
|
2405
2689
|
overrides: getOverrides(options, "toml")
|
|
2406
2690
|
})
|
|
2407
2691
|
);
|
|
2408
2692
|
}
|
|
2409
|
-
if (
|
|
2693
|
+
if (enableJSONC) {
|
|
2410
2694
|
configs2.push(
|
|
2411
2695
|
...jsonc({
|
|
2412
2696
|
overrides: getOverrides(options, "jsonc")
|
|
2413
2697
|
})
|
|
2414
2698
|
);
|
|
2415
2699
|
}
|
|
2416
|
-
if (
|
|
2700
|
+
if (enableSort) {
|
|
2417
2701
|
configs2.push(
|
|
2418
2702
|
...sort({
|
|
2419
2703
|
...resolveSubOptions(options, "sort")
|
|
2420
2704
|
})
|
|
2421
2705
|
);
|
|
2422
2706
|
}
|
|
2423
|
-
if (
|
|
2424
|
-
configs2.push(
|
|
2425
|
-
...vue({
|
|
2426
|
-
...resolveSubOptions(options, "vue"),
|
|
2427
|
-
overrides: getOverrides(options, "vue")
|
|
2428
|
-
})
|
|
2429
|
-
);
|
|
2430
|
-
}
|
|
2431
|
-
if (options.test ?? hasVitest) {
|
|
2707
|
+
if (enableTest) {
|
|
2432
2708
|
configs2.push(
|
|
2433
2709
|
...test({
|
|
2434
2710
|
overrides: getOverrides(options, "test")
|
|
@@ -2438,48 +2714,50 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2438
2714
|
})
|
|
2439
2715
|
);
|
|
2440
2716
|
}
|
|
2441
|
-
if (
|
|
2717
|
+
if (enableUnoCSS) {
|
|
2442
2718
|
configs2.push(
|
|
2443
2719
|
...unocss({
|
|
2444
2720
|
overrides: getOverrides(options, "unocss")
|
|
2445
2721
|
})
|
|
2446
2722
|
);
|
|
2447
2723
|
}
|
|
2448
|
-
if (
|
|
2724
|
+
if (enableMarkdown) {
|
|
2449
2725
|
configs2.push(
|
|
2450
2726
|
...markdown({
|
|
2727
|
+
extensions: supportedExtensions,
|
|
2451
2728
|
overrides: getOverrides(options, "markdown")
|
|
2452
2729
|
})
|
|
2453
2730
|
);
|
|
2454
2731
|
}
|
|
2455
|
-
if (
|
|
2732
|
+
if (enableAntfu) {
|
|
2456
2733
|
configs2.push(
|
|
2457
2734
|
...antfu({
|
|
2458
2735
|
overrides: getOverrides(options, "antfu")
|
|
2459
2736
|
})
|
|
2460
2737
|
);
|
|
2461
2738
|
}
|
|
2462
|
-
if (
|
|
2739
|
+
if (enableStylistic) {
|
|
2463
2740
|
configs2.push(
|
|
2464
2741
|
...stylistic({
|
|
2465
2742
|
overrides: getOverrides(options, "stylistic")
|
|
2466
2743
|
})
|
|
2467
2744
|
);
|
|
2468
2745
|
}
|
|
2469
|
-
if (
|
|
2746
|
+
if (enableGitHubAction) {
|
|
2470
2747
|
configs2.push(
|
|
2471
2748
|
...githubAction({
|
|
2472
2749
|
overrides: getOverrides(options, "githubAction")
|
|
2473
2750
|
})
|
|
2474
2751
|
);
|
|
2475
2752
|
}
|
|
2476
|
-
const configSpecials = specials(
|
|
2477
|
-
|
|
2753
|
+
const configSpecials = specials({
|
|
2754
|
+
...resolveSubOptions(options, "specials")
|
|
2755
|
+
});
|
|
2756
|
+
const configPrettier = enablePrettier ? prettier({
|
|
2478
2757
|
...resolveSubOptions(options, "prettier"),
|
|
2479
2758
|
overrides: getOverrides(options, "prettier")
|
|
2480
2759
|
}) : [];
|
|
2481
|
-
const composer = new import_eslint_flat_config_utils.FlatConfigComposer(
|
|
2482
|
-
await composer.append(
|
|
2760
|
+
const composer = new import_eslint_flat_config_utils.FlatConfigComposer(
|
|
2483
2761
|
...configs2,
|
|
2484
2762
|
...userConfigs,
|
|
2485
2763
|
...configSpecials,
|