@ntnyq/eslint-config 3.5.1 → 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 +306 -85
- package/dist/index.d.cts +32 -19
- package/dist/index.d.ts +32 -19
- package/dist/index.js +306 -85
- package/package.json +10 -8
package/dist/index.cjs
CHANGED
|
@@ -1042,25 +1042,25 @@ var toml = (options = {}) => [
|
|
|
1042
1042
|
toml: import_eslint_plugin_toml.default
|
|
1043
1043
|
},
|
|
1044
1044
|
rules: {
|
|
1045
|
-
"toml/comma-style": "error",
|
|
1046
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",
|
|
1047
1050
|
"toml/no-space-dots": "error",
|
|
1048
|
-
"toml/
|
|
1049
|
-
"toml/precision-of-fractional-seconds": "error",
|
|
1051
|
+
"toml/spaced-comment": "error",
|
|
1050
1052
|
"toml/precision-of-integer": "error",
|
|
1051
|
-
"toml/
|
|
1052
|
-
"toml/indent": ["error", 2],
|
|
1053
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1053
|
+
"toml/table-bracket-spacing": "error",
|
|
1054
1054
|
"toml/array-bracket-newline": "error",
|
|
1055
|
-
"toml/array-bracket-spacing": ["error", "never"],
|
|
1056
|
-
"toml/array-element-newline": ["error", "never"],
|
|
1057
1055
|
"toml/inline-table-curly-spacing": "error",
|
|
1058
|
-
"toml/key-spacing": "error",
|
|
1059
1056
|
"toml/padding-line-between-pairs": "error",
|
|
1060
1057
|
"toml/padding-line-between-tables": "error",
|
|
1061
|
-
"toml/
|
|
1062
|
-
"toml/
|
|
1063
|
-
"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"],
|
|
1064
1064
|
// Overrides rules
|
|
1065
1065
|
...options.overrides
|
|
1066
1066
|
}
|
|
@@ -1116,6 +1116,13 @@ var antfu = (options = {}) => [
|
|
|
1116
1116
|
];
|
|
1117
1117
|
|
|
1118
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
|
+
};
|
|
1119
1126
|
var jsdoc = (options = {}) => [
|
|
1120
1127
|
{
|
|
1121
1128
|
name: "ntnyq/jsdoc",
|
|
@@ -1123,23 +1130,204 @@ var jsdoc = (options = {}) => [
|
|
|
1123
1130
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
1124
1131
|
},
|
|
1125
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
|
+
// ],
|
|
1126
1320
|
"jsdoc/check-access": "warn",
|
|
1127
|
-
"jsdoc/check-param-names": "warn",
|
|
1128
|
-
"jsdoc/check-property-names": "warn",
|
|
1129
|
-
"jsdoc/check-types": "warn",
|
|
1130
|
-
"jsdoc/empty-tags": "warn",
|
|
1131
1321
|
"jsdoc/implements-on-classes": "warn",
|
|
1132
|
-
"jsdoc/no-defaults": "warn",
|
|
1133
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
1134
1322
|
"jsdoc/require-param-name": "warn",
|
|
1135
1323
|
"jsdoc/require-property": "warn",
|
|
1136
|
-
"jsdoc/require-property-description": "warn",
|
|
1137
1324
|
"jsdoc/require-property-name": "warn",
|
|
1325
|
+
"jsdoc/require-property-description": "warn",
|
|
1138
1326
|
"jsdoc/require-returns-check": "warn",
|
|
1139
1327
|
"jsdoc/require-returns-description": "warn",
|
|
1140
1328
|
"jsdoc/require-yields-check": "warn",
|
|
1141
|
-
|
|
1142
|
-
|
|
1329
|
+
// TypeScript rules overrides
|
|
1330
|
+
...options.typescript ? typescriptRules : {},
|
|
1143
1331
|
// Overrides rules
|
|
1144
1332
|
...options.overrides
|
|
1145
1333
|
}
|
|
@@ -1159,10 +1347,12 @@ var jsonc = (options = {}) => [
|
|
|
1159
1347
|
},
|
|
1160
1348
|
rules: {
|
|
1161
1349
|
...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
|
|
1162
|
-
"jsonc/
|
|
1163
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1164
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1350
|
+
"jsonc/no-octal-escape": "error",
|
|
1165
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"],
|
|
1166
1356
|
"jsonc/key-spacing": [
|
|
1167
1357
|
"error",
|
|
1168
1358
|
{
|
|
@@ -1170,7 +1360,6 @@ var jsonc = (options = {}) => [
|
|
|
1170
1360
|
afterColon: true
|
|
1171
1361
|
}
|
|
1172
1362
|
],
|
|
1173
|
-
"jsonc/no-octal-escape": "error",
|
|
1174
1363
|
"jsonc/object-curly-newline": [
|
|
1175
1364
|
"error",
|
|
1176
1365
|
{
|
|
@@ -1178,7 +1367,6 @@ var jsonc = (options = {}) => [
|
|
|
1178
1367
|
consistent: true
|
|
1179
1368
|
}
|
|
1180
1369
|
],
|
|
1181
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1182
1370
|
"jsonc/object-property-newline": [
|
|
1183
1371
|
"error",
|
|
1184
1372
|
{
|
|
@@ -1208,23 +1396,23 @@ var ntnyq = (options = {}) => [
|
|
|
1208
1396
|
|
|
1209
1397
|
// src/configs/regexp.ts
|
|
1210
1398
|
var regexp = (options = {}) => {
|
|
1211
|
-
const
|
|
1212
|
-
const
|
|
1213
|
-
...
|
|
1399
|
+
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1400
|
+
const recommendedRules2 = {
|
|
1401
|
+
...recommendedConfig.rules
|
|
1214
1402
|
};
|
|
1215
1403
|
if (options.level === "warn") {
|
|
1216
|
-
for (const key in
|
|
1217
|
-
if (
|
|
1218
|
-
|
|
1404
|
+
for (const key in recommendedRules2) {
|
|
1405
|
+
if (recommendedRules2[key] === "error") {
|
|
1406
|
+
recommendedRules2[key] = "warn";
|
|
1219
1407
|
}
|
|
1220
1408
|
}
|
|
1221
1409
|
}
|
|
1222
1410
|
return [
|
|
1223
1411
|
{
|
|
1224
|
-
...
|
|
1412
|
+
...recommendedConfig,
|
|
1225
1413
|
name: "ntnyq/regexp",
|
|
1226
1414
|
rules: {
|
|
1227
|
-
...
|
|
1415
|
+
...recommendedRules2,
|
|
1228
1416
|
// Overrides rules
|
|
1229
1417
|
...options.overrides
|
|
1230
1418
|
}
|
|
@@ -1499,8 +1687,8 @@ var imports = (options = {}) => [
|
|
|
1499
1687
|
// src/configs/unicorn.ts
|
|
1500
1688
|
var disabledRules2 = {
|
|
1501
1689
|
"unicorn/better-regex": "off",
|
|
1502
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1503
1690
|
"unicorn/explicit-length-check": "off",
|
|
1691
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1504
1692
|
"unicorn/no-array-callback-reference": "off",
|
|
1505
1693
|
/**
|
|
1506
1694
|
* @see https://caniuse.com/?search=globalThis
|
|
@@ -1514,37 +1702,37 @@ var unicorn = (options = {}) => [
|
|
|
1514
1702
|
unicorn: import_eslint_plugin_unicorn.default
|
|
1515
1703
|
},
|
|
1516
1704
|
rules: {
|
|
1517
|
-
"unicorn/error-message": "error",
|
|
1518
1705
|
"unicorn/escape-case": "error",
|
|
1706
|
+
"unicorn/no-for-loop": "error",
|
|
1707
|
+
"unicorn/no-lonely-if": "error",
|
|
1708
|
+
"unicorn/error-message": "error",
|
|
1519
1709
|
"unicorn/no-new-buffer": "error",
|
|
1520
|
-
"unicorn/
|
|
1710
|
+
"unicorn/no-hex-escape": "error",
|
|
1711
|
+
"unicorn/throw-new-error": "error",
|
|
1521
1712
|
"unicorn/prefer-includes": "error",
|
|
1713
|
+
"unicorn/new-for-builtins": "error",
|
|
1522
1714
|
"unicorn/prefer-type-error": "error",
|
|
1523
|
-
"unicorn/
|
|
1524
|
-
"unicorn/no-
|
|
1525
|
-
"unicorn/
|
|
1526
|
-
"unicorn/no-typeof-undefined": "error",
|
|
1715
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1716
|
+
"unicorn/no-console-spaces": "error",
|
|
1717
|
+
"unicorn/no-zero-fractions": "error",
|
|
1527
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",
|
|
1528
1724
|
"unicorn/no-static-only-class": "error",
|
|
1529
|
-
"unicorn/
|
|
1725
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
1726
|
+
"unicorn/prefer-negative-index": "error",
|
|
1727
|
+
"unicorn/prefer-structured-clone": "error",
|
|
1530
1728
|
"unicorn/custom-error-definition": "error",
|
|
1531
1729
|
"unicorn/prefer-modern-math-apis": "error",
|
|
1532
|
-
"unicorn/new-for-builtins": "error",
|
|
1533
|
-
"unicorn/no-console-spaces": "error",
|
|
1534
|
-
"unicorn/no-for-loop": "error",
|
|
1535
|
-
"unicorn/no-hex-escape": "error",
|
|
1536
|
-
"unicorn/no-lonely-if": "error",
|
|
1537
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
1538
|
-
"unicorn/prefer-math-trunc": "error",
|
|
1539
|
-
"unicorn/prefer-negative-index": "error",
|
|
1540
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1541
1730
|
"unicorn/prefer-number-properties": "error",
|
|
1542
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1543
1731
|
"unicorn/prefer-prototype-methods": "error",
|
|
1544
|
-
"unicorn/prefer-
|
|
1545
|
-
"unicorn/prefer-
|
|
1546
|
-
"unicorn/prefer-structured-clone": "error",
|
|
1732
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
1733
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1547
1734
|
"unicorn/consistent-existence-index-check": "error",
|
|
1735
|
+
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1548
1736
|
"unicorn/catch-error-name": [
|
|
1549
1737
|
"error",
|
|
1550
1738
|
{
|
|
@@ -1559,24 +1747,24 @@ var unicorn = (options = {}) => [
|
|
|
1559
1747
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1560
1748
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1561
1749
|
// DOM
|
|
1562
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
1563
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1564
1750
|
"unicorn/prefer-query-selector": "error",
|
|
1565
1751
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
1752
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1566
1753
|
"unicorn/prefer-dom-node-append": "error",
|
|
1567
1754
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
1568
|
-
"unicorn/prefer-
|
|
1755
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1569
1756
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1757
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1570
1758
|
// Array
|
|
1571
1759
|
"unicorn/no-new-array": "error",
|
|
1572
|
-
"unicorn/no-instanceof-array": "error",
|
|
1573
1760
|
"unicorn/no-array-push-push": "error",
|
|
1574
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
1575
1761
|
"unicorn/prefer-array-find": "error",
|
|
1576
1762
|
"unicorn/prefer-array-some": "error",
|
|
1763
|
+
"unicorn/no-instanceof-array": "error",
|
|
1577
1764
|
"unicorn/prefer-array-flat-map": "error",
|
|
1578
1765
|
"unicorn/prefer-array-index-of": "error",
|
|
1579
1766
|
"unicorn/require-array-join-separator": "error",
|
|
1767
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1580
1768
|
// Set
|
|
1581
1769
|
"unicorn/prefer-set-has": "error",
|
|
1582
1770
|
"unicorn/prefer-set-size": "error",
|
|
@@ -1589,13 +1777,15 @@ var unicorn = (options = {}) => [
|
|
|
1589
1777
|
|
|
1590
1778
|
// src/configs/specials.ts
|
|
1591
1779
|
var import_globals = __toESM(require("globals"), 1);
|
|
1592
|
-
var specials = () => [
|
|
1780
|
+
var specials = (options = {}) => [
|
|
1593
1781
|
{
|
|
1594
1782
|
name: "ntnyq/specials/scripts",
|
|
1595
1783
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
1596
1784
|
rules: {
|
|
1597
1785
|
"no-console": "off",
|
|
1598
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1786
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1787
|
+
// Overrides rules
|
|
1788
|
+
...options.overridesScriptsRules
|
|
1599
1789
|
}
|
|
1600
1790
|
},
|
|
1601
1791
|
{
|
|
@@ -1603,7 +1793,9 @@ var specials = () => [
|
|
|
1603
1793
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1604
1794
|
rules: {
|
|
1605
1795
|
"no-console": "off",
|
|
1606
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1796
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1797
|
+
// Overrides rules
|
|
1798
|
+
...options.overridesCliRules
|
|
1607
1799
|
}
|
|
1608
1800
|
},
|
|
1609
1801
|
{
|
|
@@ -1620,9 +1812,14 @@ var specials = () => [
|
|
|
1620
1812
|
{
|
|
1621
1813
|
allow: ["^GM_.+"]
|
|
1622
1814
|
}
|
|
1623
|
-
]
|
|
1815
|
+
],
|
|
1816
|
+
// Overrides rules
|
|
1817
|
+
...options.overridesUserScriptsRules
|
|
1624
1818
|
}
|
|
1625
|
-
}
|
|
1819
|
+
},
|
|
1820
|
+
// More special case configs
|
|
1821
|
+
// So don't need to append configs to composer
|
|
1822
|
+
...options.specialCaseConfigs ? options.specialCaseConfigs : []
|
|
1626
1823
|
];
|
|
1627
1824
|
|
|
1628
1825
|
// src/configs/comments.ts
|
|
@@ -1713,6 +1910,7 @@ var markdown = (options = {}) => {
|
|
|
1713
1910
|
var prettier = (options = {}) => {
|
|
1714
1911
|
const {
|
|
1715
1912
|
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1913
|
+
// User defined disabled files
|
|
1716
1914
|
userDisabledFiles = []
|
|
1717
1915
|
} = options;
|
|
1718
1916
|
return [
|
|
@@ -2372,16 +2570,37 @@ var unusedImports = (options = {}) => [
|
|
|
2372
2570
|
];
|
|
2373
2571
|
|
|
2374
2572
|
// src/core.ts
|
|
2375
|
-
|
|
2376
|
-
const configs2 = [];
|
|
2573
|
+
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2377
2574
|
const {
|
|
2378
|
-
|
|
2379
|
-
|
|
2575
|
+
/**
|
|
2576
|
+
* Shared options
|
|
2577
|
+
*/
|
|
2578
|
+
extensions: supportedExtensions = [],
|
|
2579
|
+
/**
|
|
2580
|
+
* Conditional by deps
|
|
2581
|
+
*/
|
|
2380
2582
|
vue: enableVue = hasVue,
|
|
2583
|
+
test: enableTest = hasVitest,
|
|
2381
2584
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
2382
2585
|
typescript: enableTypeScript = hasTypeScript,
|
|
2383
|
-
|
|
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
|
|
2384
2602
|
} = options;
|
|
2603
|
+
const configs2 = [];
|
|
2385
2604
|
if (enableVue) {
|
|
2386
2605
|
supportedExtensions.push("vue");
|
|
2387
2606
|
}
|
|
@@ -2405,6 +2624,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2405
2624
|
overrides: getOverrides(options, "imports")
|
|
2406
2625
|
}),
|
|
2407
2626
|
...jsdoc({
|
|
2627
|
+
typescript: !!enableTypeScript,
|
|
2408
2628
|
overrides: getOverrides(options, "jsdoc")
|
|
2409
2629
|
}),
|
|
2410
2630
|
...comments({
|
|
@@ -2415,7 +2635,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2415
2635
|
overrides: getOverrides(options, "javascript")
|
|
2416
2636
|
})
|
|
2417
2637
|
);
|
|
2418
|
-
if (
|
|
2638
|
+
if (enablePerfectionist) {
|
|
2419
2639
|
configs2.push(
|
|
2420
2640
|
...perfectionist({
|
|
2421
2641
|
...resolveSubOptions(options, "perfectionist"),
|
|
@@ -2423,14 +2643,14 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2423
2643
|
})
|
|
2424
2644
|
);
|
|
2425
2645
|
}
|
|
2426
|
-
if (
|
|
2646
|
+
if (enableUnicorn) {
|
|
2427
2647
|
configs2.push(
|
|
2428
2648
|
...unicorn({
|
|
2429
2649
|
overrides: getOverrides(options, "unicorn")
|
|
2430
2650
|
})
|
|
2431
2651
|
);
|
|
2432
2652
|
}
|
|
2433
|
-
if (
|
|
2653
|
+
if (enableRegexp) {
|
|
2434
2654
|
configs2.push(
|
|
2435
2655
|
...regexp({
|
|
2436
2656
|
...resolveSubOptions(options, "regexp"),
|
|
@@ -2456,35 +2676,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2456
2676
|
})
|
|
2457
2677
|
);
|
|
2458
2678
|
}
|
|
2459
|
-
if (
|
|
2679
|
+
if (enableYML) {
|
|
2460
2680
|
configs2.push(
|
|
2461
2681
|
...yml({
|
|
2462
2682
|
overrides: getOverrides(options, "yml")
|
|
2463
2683
|
})
|
|
2464
2684
|
);
|
|
2465
2685
|
}
|
|
2466
|
-
if (
|
|
2686
|
+
if (enableTOML) {
|
|
2467
2687
|
configs2.push(
|
|
2468
2688
|
...toml({
|
|
2469
2689
|
overrides: getOverrides(options, "toml")
|
|
2470
2690
|
})
|
|
2471
2691
|
);
|
|
2472
2692
|
}
|
|
2473
|
-
if (
|
|
2693
|
+
if (enableJSONC) {
|
|
2474
2694
|
configs2.push(
|
|
2475
2695
|
...jsonc({
|
|
2476
2696
|
overrides: getOverrides(options, "jsonc")
|
|
2477
2697
|
})
|
|
2478
2698
|
);
|
|
2479
2699
|
}
|
|
2480
|
-
if (
|
|
2700
|
+
if (enableSort) {
|
|
2481
2701
|
configs2.push(
|
|
2482
2702
|
...sort({
|
|
2483
2703
|
...resolveSubOptions(options, "sort")
|
|
2484
2704
|
})
|
|
2485
2705
|
);
|
|
2486
2706
|
}
|
|
2487
|
-
if (
|
|
2707
|
+
if (enableTest) {
|
|
2488
2708
|
configs2.push(
|
|
2489
2709
|
...test({
|
|
2490
2710
|
overrides: getOverrides(options, "test")
|
|
@@ -2509,34 +2729,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2509
2729
|
})
|
|
2510
2730
|
);
|
|
2511
2731
|
}
|
|
2512
|
-
if (
|
|
2732
|
+
if (enableAntfu) {
|
|
2513
2733
|
configs2.push(
|
|
2514
2734
|
...antfu({
|
|
2515
2735
|
overrides: getOverrides(options, "antfu")
|
|
2516
2736
|
})
|
|
2517
2737
|
);
|
|
2518
2738
|
}
|
|
2519
|
-
if (
|
|
2739
|
+
if (enableStylistic) {
|
|
2520
2740
|
configs2.push(
|
|
2521
2741
|
...stylistic({
|
|
2522
2742
|
overrides: getOverrides(options, "stylistic")
|
|
2523
2743
|
})
|
|
2524
2744
|
);
|
|
2525
2745
|
}
|
|
2526
|
-
if (
|
|
2746
|
+
if (enableGitHubAction) {
|
|
2527
2747
|
configs2.push(
|
|
2528
2748
|
...githubAction({
|
|
2529
2749
|
overrides: getOverrides(options, "githubAction")
|
|
2530
2750
|
})
|
|
2531
2751
|
);
|
|
2532
2752
|
}
|
|
2533
|
-
const configSpecials = specials(
|
|
2534
|
-
|
|
2753
|
+
const configSpecials = specials({
|
|
2754
|
+
...resolveSubOptions(options, "specials")
|
|
2755
|
+
});
|
|
2756
|
+
const configPrettier = enablePrettier ? prettier({
|
|
2535
2757
|
...resolveSubOptions(options, "prettier"),
|
|
2536
2758
|
overrides: getOverrides(options, "prettier")
|
|
2537
2759
|
}) : [];
|
|
2538
|
-
const composer = new import_eslint_flat_config_utils.FlatConfigComposer(
|
|
2539
|
-
await composer.append(
|
|
2760
|
+
const composer = new import_eslint_flat_config_utils.FlatConfigComposer(
|
|
2540
2761
|
...configs2,
|
|
2541
2762
|
...userConfigs,
|
|
2542
2763
|
...configSpecials,
|