@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.js
CHANGED
|
@@ -901,25 +901,25 @@ var toml = (options = {}) => [
|
|
|
901
901
|
toml: default5
|
|
902
902
|
},
|
|
903
903
|
rules: {
|
|
904
|
-
"toml/comma-style": "error",
|
|
905
904
|
"toml/keys-order": "error",
|
|
905
|
+
"toml/key-spacing": "error",
|
|
906
|
+
"toml/quoted-keys": "error",
|
|
907
|
+
"toml/comma-style": "error",
|
|
908
|
+
"toml/tables-order": "error",
|
|
906
909
|
"toml/no-space-dots": "error",
|
|
907
|
-
"toml/
|
|
908
|
-
"toml/precision-of-fractional-seconds": "error",
|
|
910
|
+
"toml/spaced-comment": "error",
|
|
909
911
|
"toml/precision-of-integer": "error",
|
|
910
|
-
"toml/
|
|
911
|
-
"toml/indent": ["error", 2],
|
|
912
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
912
|
+
"toml/table-bracket-spacing": "error",
|
|
913
913
|
"toml/array-bracket-newline": "error",
|
|
914
|
-
"toml/array-bracket-spacing": ["error", "never"],
|
|
915
|
-
"toml/array-element-newline": ["error", "never"],
|
|
916
914
|
"toml/inline-table-curly-spacing": "error",
|
|
917
|
-
"toml/key-spacing": "error",
|
|
918
915
|
"toml/padding-line-between-pairs": "error",
|
|
919
916
|
"toml/padding-line-between-tables": "error",
|
|
920
|
-
"toml/
|
|
921
|
-
"toml/
|
|
922
|
-
"toml/
|
|
917
|
+
"toml/no-unreadable-number-separator": "error",
|
|
918
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
919
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
920
|
+
"toml/indent": ["error", 2],
|
|
921
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
922
|
+
"toml/array-element-newline": ["error", "never"],
|
|
923
923
|
// Overrides rules
|
|
924
924
|
...options.overrides
|
|
925
925
|
}
|
|
@@ -975,6 +975,13 @@ var antfu = (options = {}) => [
|
|
|
975
975
|
];
|
|
976
976
|
|
|
977
977
|
// src/configs/jsdoc.ts
|
|
978
|
+
var typescriptRules = {
|
|
979
|
+
"jsdoc/no-undefined-types": "off",
|
|
980
|
+
"jsdoc/require-param-type": "off",
|
|
981
|
+
"jsdoc/require-property-type": "off",
|
|
982
|
+
"jsdoc/require-returns-type": "off",
|
|
983
|
+
"jsdoc/no-types": "error"
|
|
984
|
+
};
|
|
978
985
|
var jsdoc = (options = {}) => [
|
|
979
986
|
{
|
|
980
987
|
name: "ntnyq/jsdoc",
|
|
@@ -982,23 +989,204 @@ var jsdoc = (options = {}) => [
|
|
|
982
989
|
jsdoc: default9
|
|
983
990
|
},
|
|
984
991
|
rules: {
|
|
992
|
+
// Disabled rules
|
|
993
|
+
"jsdoc/tag-lines": "off",
|
|
994
|
+
// Use `jsdoc/sort-tags`
|
|
995
|
+
"jsdoc/text-escaping": "off",
|
|
996
|
+
// No need
|
|
997
|
+
// Fixable rules
|
|
998
|
+
"jsdoc/check-alignment": "error",
|
|
999
|
+
"jsdoc/check-line-alignment": "error",
|
|
1000
|
+
"jsdoc/check-param-names": "error",
|
|
1001
|
+
"jsdoc/check-property-names": "error",
|
|
1002
|
+
"jsdoc/check-tag-names": "error",
|
|
1003
|
+
"jsdoc/check-types": "error",
|
|
1004
|
+
"jsdoc/empty-tags": "error",
|
|
1005
|
+
"jsdoc/multiline-blocks": "error",
|
|
1006
|
+
"jsdoc/no-bad-blocks": "error",
|
|
1007
|
+
"jsdoc/no-blank-block-descriptions": "error",
|
|
1008
|
+
"jsdoc/no-blank-blocks": "error",
|
|
1009
|
+
"jsdoc/no-defaults": "error",
|
|
1010
|
+
"jsdoc/no-multi-asterisks": "error",
|
|
1011
|
+
"jsdoc/require-asterisk-prefix": "error",
|
|
1012
|
+
"jsdoc/require-hyphen-before-param-description": "error",
|
|
1013
|
+
// TODO: this after investigate
|
|
1014
|
+
// 'jsdoc/sort-tags': [
|
|
1015
|
+
// 'error',
|
|
1016
|
+
// {
|
|
1017
|
+
// tagSequence: [
|
|
1018
|
+
// {
|
|
1019
|
+
// // Module/file-level
|
|
1020
|
+
// tags: ['module', 'exports', 'file', 'fileoverview', 'overview', 'import'],
|
|
1021
|
+
// },
|
|
1022
|
+
// {
|
|
1023
|
+
// // Identifying (name, type)
|
|
1024
|
+
// tags: [
|
|
1025
|
+
// 'typedef',
|
|
1026
|
+
// 'interface',
|
|
1027
|
+
// 'record',
|
|
1028
|
+
// 'template',
|
|
1029
|
+
// 'name',
|
|
1030
|
+
// 'kind',
|
|
1031
|
+
// 'type',
|
|
1032
|
+
// 'alias',
|
|
1033
|
+
// 'external',
|
|
1034
|
+
// 'host',
|
|
1035
|
+
// 'callback',
|
|
1036
|
+
// 'func',
|
|
1037
|
+
// 'function',
|
|
1038
|
+
// 'method',
|
|
1039
|
+
// 'class',
|
|
1040
|
+
// 'constructor',
|
|
1041
|
+
// ],
|
|
1042
|
+
// },
|
|
1043
|
+
// {
|
|
1044
|
+
// // Relationships
|
|
1045
|
+
// tags: [
|
|
1046
|
+
// 'modifies',
|
|
1047
|
+
// 'mixes',
|
|
1048
|
+
// 'mixin',
|
|
1049
|
+
// 'mixinClass',
|
|
1050
|
+
// 'mixinFunction',
|
|
1051
|
+
// 'namespace',
|
|
1052
|
+
// 'borrows',
|
|
1053
|
+
// 'constructs',
|
|
1054
|
+
// 'lends',
|
|
1055
|
+
// 'implements',
|
|
1056
|
+
// 'requires',
|
|
1057
|
+
// ],
|
|
1058
|
+
// },
|
|
1059
|
+
// {
|
|
1060
|
+
// // Long descriptions
|
|
1061
|
+
// tags: ['desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license'],
|
|
1062
|
+
// },
|
|
1063
|
+
// {
|
|
1064
|
+
// // Simple annotations
|
|
1065
|
+
// tags: [
|
|
1066
|
+
// 'const',
|
|
1067
|
+
// 'constant',
|
|
1068
|
+
// 'final',
|
|
1069
|
+
// 'global',
|
|
1070
|
+
// 'readonly',
|
|
1071
|
+
// 'abstract',
|
|
1072
|
+
// 'virtual',
|
|
1073
|
+
// 'var',
|
|
1074
|
+
// 'member',
|
|
1075
|
+
// 'memberof',
|
|
1076
|
+
// 'memberof!',
|
|
1077
|
+
// 'inner',
|
|
1078
|
+
// 'instance',
|
|
1079
|
+
// 'inheritdoc',
|
|
1080
|
+
// 'inheritDoc',
|
|
1081
|
+
// 'override',
|
|
1082
|
+
// 'hideconstructor',
|
|
1083
|
+
// ],
|
|
1084
|
+
// },
|
|
1085
|
+
// {
|
|
1086
|
+
// // Core function/object inf
|
|
1087
|
+
// tags: ['param', 'arg', 'argument', 'prop', 'property', 'return', 'returns'],
|
|
1088
|
+
// },
|
|
1089
|
+
// {
|
|
1090
|
+
// // Important behavior details
|
|
1091
|
+
// tags: [
|
|
1092
|
+
// 'async',
|
|
1093
|
+
// 'generator',
|
|
1094
|
+
// 'default',
|
|
1095
|
+
// 'defaultvalue',
|
|
1096
|
+
// 'enum',
|
|
1097
|
+
// 'augments',
|
|
1098
|
+
// 'extends',
|
|
1099
|
+
// 'throws',
|
|
1100
|
+
// 'exception',
|
|
1101
|
+
// 'yield',
|
|
1102
|
+
// 'yields',
|
|
1103
|
+
// 'event',
|
|
1104
|
+
// 'fires',
|
|
1105
|
+
// 'emits',
|
|
1106
|
+
// 'listens',
|
|
1107
|
+
// 'this',
|
|
1108
|
+
// ],
|
|
1109
|
+
// },
|
|
1110
|
+
// {
|
|
1111
|
+
// // Access
|
|
1112
|
+
// tags: ['static', 'private', 'protected', 'public', 'access', 'internal', 'package'],
|
|
1113
|
+
// },
|
|
1114
|
+
// {
|
|
1115
|
+
// // Other/unknown
|
|
1116
|
+
// tags: ['-other'],
|
|
1117
|
+
// },
|
|
1118
|
+
// {
|
|
1119
|
+
// // Supplementary descriptions
|
|
1120
|
+
// tags: ['see', 'example'],
|
|
1121
|
+
// },
|
|
1122
|
+
// {
|
|
1123
|
+
// // Other Closure (undocumented) metadata
|
|
1124
|
+
// tags: [
|
|
1125
|
+
// 'closurePrimitive',
|
|
1126
|
+
// 'customElement',
|
|
1127
|
+
// 'expose',
|
|
1128
|
+
// 'hidden',
|
|
1129
|
+
// 'idGenerator',
|
|
1130
|
+
// 'meaning',
|
|
1131
|
+
// 'ngInject',
|
|
1132
|
+
// 'owner',
|
|
1133
|
+
// 'wizaction',
|
|
1134
|
+
// ],
|
|
1135
|
+
// },
|
|
1136
|
+
// {
|
|
1137
|
+
// // Other Closure (documented) metadata
|
|
1138
|
+
// tags: [
|
|
1139
|
+
// 'define',
|
|
1140
|
+
// 'dict',
|
|
1141
|
+
// 'export',
|
|
1142
|
+
// 'externs',
|
|
1143
|
+
// 'implicitCast',
|
|
1144
|
+
// 'noalias',
|
|
1145
|
+
// 'nocollapse',
|
|
1146
|
+
// 'nocompile',
|
|
1147
|
+
// 'noinline',
|
|
1148
|
+
// 'nosideeffects',
|
|
1149
|
+
// 'polymer',
|
|
1150
|
+
// 'polymerBehavior',
|
|
1151
|
+
// 'preserve',
|
|
1152
|
+
// 'struct',
|
|
1153
|
+
// 'suppress',
|
|
1154
|
+
// 'unrestricted',
|
|
1155
|
+
// ],
|
|
1156
|
+
// },
|
|
1157
|
+
// {
|
|
1158
|
+
// // Metadata
|
|
1159
|
+
// tags: ['category'],
|
|
1160
|
+
// },
|
|
1161
|
+
// {
|
|
1162
|
+
// // Non-Closure metadata
|
|
1163
|
+
// tags: [
|
|
1164
|
+
// 'ignore',
|
|
1165
|
+
// 'author',
|
|
1166
|
+
// 'version',
|
|
1167
|
+
// 'variation',
|
|
1168
|
+
// 'since',
|
|
1169
|
+
// 'deprecated',
|
|
1170
|
+
// 'compatibility',
|
|
1171
|
+
// 'todo',
|
|
1172
|
+
// ],
|
|
1173
|
+
// },
|
|
1174
|
+
// ],
|
|
1175
|
+
// alphabetizeExtras: true,
|
|
1176
|
+
// linesBetween: 1,
|
|
1177
|
+
// },
|
|
1178
|
+
// ],
|
|
985
1179
|
"jsdoc/check-access": "warn",
|
|
986
|
-
"jsdoc/check-param-names": "warn",
|
|
987
|
-
"jsdoc/check-property-names": "warn",
|
|
988
|
-
"jsdoc/check-types": "warn",
|
|
989
|
-
"jsdoc/empty-tags": "warn",
|
|
990
1180
|
"jsdoc/implements-on-classes": "warn",
|
|
991
|
-
"jsdoc/no-defaults": "warn",
|
|
992
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
993
1181
|
"jsdoc/require-param-name": "warn",
|
|
994
1182
|
"jsdoc/require-property": "warn",
|
|
995
|
-
"jsdoc/require-property-description": "warn",
|
|
996
1183
|
"jsdoc/require-property-name": "warn",
|
|
1184
|
+
"jsdoc/require-property-description": "warn",
|
|
997
1185
|
"jsdoc/require-returns-check": "warn",
|
|
998
1186
|
"jsdoc/require-returns-description": "warn",
|
|
999
1187
|
"jsdoc/require-yields-check": "warn",
|
|
1000
|
-
|
|
1001
|
-
|
|
1188
|
+
// TypeScript rules overrides
|
|
1189
|
+
...options.typescript ? typescriptRules : {},
|
|
1002
1190
|
// Overrides rules
|
|
1003
1191
|
...options.overrides
|
|
1004
1192
|
}
|
|
@@ -1018,10 +1206,12 @@ var jsonc = (options = {}) => [
|
|
|
1018
1206
|
},
|
|
1019
1207
|
rules: {
|
|
1020
1208
|
...default10.configs["recommended-with-jsonc"].rules,
|
|
1021
|
-
"jsonc/
|
|
1022
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1023
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1209
|
+
"jsonc/no-octal-escape": "error",
|
|
1024
1210
|
"jsonc/indent": ["error", 2],
|
|
1211
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1212
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1213
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1214
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1025
1215
|
"jsonc/key-spacing": [
|
|
1026
1216
|
"error",
|
|
1027
1217
|
{
|
|
@@ -1029,7 +1219,6 @@ var jsonc = (options = {}) => [
|
|
|
1029
1219
|
afterColon: true
|
|
1030
1220
|
}
|
|
1031
1221
|
],
|
|
1032
|
-
"jsonc/no-octal-escape": "error",
|
|
1033
1222
|
"jsonc/object-curly-newline": [
|
|
1034
1223
|
"error",
|
|
1035
1224
|
{
|
|
@@ -1037,7 +1226,6 @@ var jsonc = (options = {}) => [
|
|
|
1037
1226
|
consistent: true
|
|
1038
1227
|
}
|
|
1039
1228
|
],
|
|
1040
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1041
1229
|
"jsonc/object-property-newline": [
|
|
1042
1230
|
"error",
|
|
1043
1231
|
{
|
|
@@ -1067,23 +1255,23 @@ var ntnyq = (options = {}) => [
|
|
|
1067
1255
|
|
|
1068
1256
|
// src/configs/regexp.ts
|
|
1069
1257
|
var regexp = (options = {}) => {
|
|
1070
|
-
const
|
|
1071
|
-
const
|
|
1072
|
-
...
|
|
1258
|
+
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1259
|
+
const recommendedRules2 = {
|
|
1260
|
+
...recommendedConfig.rules
|
|
1073
1261
|
};
|
|
1074
1262
|
if (options.level === "warn") {
|
|
1075
|
-
for (const key in
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1263
|
+
for (const key in recommendedRules2) {
|
|
1264
|
+
if (recommendedRules2[key] === "error") {
|
|
1265
|
+
recommendedRules2[key] = "warn";
|
|
1078
1266
|
}
|
|
1079
1267
|
}
|
|
1080
1268
|
}
|
|
1081
1269
|
return [
|
|
1082
1270
|
{
|
|
1083
|
-
...
|
|
1271
|
+
...recommendedConfig,
|
|
1084
1272
|
name: "ntnyq/regexp",
|
|
1085
1273
|
rules: {
|
|
1086
|
-
...
|
|
1274
|
+
...recommendedRules2,
|
|
1087
1275
|
// Overrides rules
|
|
1088
1276
|
...options.overrides
|
|
1089
1277
|
}
|
|
@@ -1358,8 +1546,8 @@ var imports = (options = {}) => [
|
|
|
1358
1546
|
// src/configs/unicorn.ts
|
|
1359
1547
|
var disabledRules2 = {
|
|
1360
1548
|
"unicorn/better-regex": "off",
|
|
1361
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1362
1549
|
"unicorn/explicit-length-check": "off",
|
|
1550
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1363
1551
|
"unicorn/no-array-callback-reference": "off",
|
|
1364
1552
|
/**
|
|
1365
1553
|
* @see https://caniuse.com/?search=globalThis
|
|
@@ -1373,37 +1561,37 @@ var unicorn = (options = {}) => [
|
|
|
1373
1561
|
unicorn: default15
|
|
1374
1562
|
},
|
|
1375
1563
|
rules: {
|
|
1376
|
-
"unicorn/error-message": "error",
|
|
1377
1564
|
"unicorn/escape-case": "error",
|
|
1565
|
+
"unicorn/no-for-loop": "error",
|
|
1566
|
+
"unicorn/no-lonely-if": "error",
|
|
1567
|
+
"unicorn/error-message": "error",
|
|
1378
1568
|
"unicorn/no-new-buffer": "error",
|
|
1379
|
-
"unicorn/
|
|
1569
|
+
"unicorn/no-hex-escape": "error",
|
|
1570
|
+
"unicorn/throw-new-error": "error",
|
|
1380
1571
|
"unicorn/prefer-includes": "error",
|
|
1572
|
+
"unicorn/new-for-builtins": "error",
|
|
1381
1573
|
"unicorn/prefer-type-error": "error",
|
|
1382
|
-
"unicorn/
|
|
1383
|
-
"unicorn/no-
|
|
1384
|
-
"unicorn/
|
|
1385
|
-
"unicorn/no-typeof-undefined": "error",
|
|
1574
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1575
|
+
"unicorn/no-console-spaces": "error",
|
|
1576
|
+
"unicorn/no-zero-fractions": "error",
|
|
1386
1577
|
"unicorn/prefer-regexp-test": "error",
|
|
1578
|
+
"unicorn/number-literal-case": "error",
|
|
1579
|
+
"unicorn/no-typeof-undefined": "error",
|
|
1580
|
+
"unicorn/prefer-math-min-max": "error",
|
|
1581
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1582
|
+
"unicorn/no-unnecessary-await": "error",
|
|
1387
1583
|
"unicorn/no-static-only-class": "error",
|
|
1388
|
-
"unicorn/
|
|
1584
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
1585
|
+
"unicorn/prefer-negative-index": "error",
|
|
1586
|
+
"unicorn/prefer-structured-clone": "error",
|
|
1389
1587
|
"unicorn/custom-error-definition": "error",
|
|
1390
1588
|
"unicorn/prefer-modern-math-apis": "error",
|
|
1391
|
-
"unicorn/new-for-builtins": "error",
|
|
1392
|
-
"unicorn/no-console-spaces": "error",
|
|
1393
|
-
"unicorn/no-for-loop": "error",
|
|
1394
|
-
"unicorn/no-hex-escape": "error",
|
|
1395
|
-
"unicorn/no-lonely-if": "error",
|
|
1396
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
1397
|
-
"unicorn/prefer-math-trunc": "error",
|
|
1398
|
-
"unicorn/prefer-negative-index": "error",
|
|
1399
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1400
1589
|
"unicorn/prefer-number-properties": "error",
|
|
1401
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1402
1590
|
"unicorn/prefer-prototype-methods": "error",
|
|
1403
|
-
"unicorn/prefer-
|
|
1404
|
-
"unicorn/prefer-
|
|
1405
|
-
"unicorn/prefer-structured-clone": "error",
|
|
1591
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
1592
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1406
1593
|
"unicorn/consistent-existence-index-check": "error",
|
|
1594
|
+
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1407
1595
|
"unicorn/catch-error-name": [
|
|
1408
1596
|
"error",
|
|
1409
1597
|
{
|
|
@@ -1418,24 +1606,24 @@ var unicorn = (options = {}) => [
|
|
|
1418
1606
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1419
1607
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1420
1608
|
// DOM
|
|
1421
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
1422
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1423
1609
|
"unicorn/prefer-query-selector": "error",
|
|
1424
1610
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
1611
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1425
1612
|
"unicorn/prefer-dom-node-append": "error",
|
|
1426
1613
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
1427
|
-
"unicorn/prefer-
|
|
1614
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1428
1615
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1616
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1429
1617
|
// Array
|
|
1430
1618
|
"unicorn/no-new-array": "error",
|
|
1431
|
-
"unicorn/no-instanceof-array": "error",
|
|
1432
1619
|
"unicorn/no-array-push-push": "error",
|
|
1433
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
1434
1620
|
"unicorn/prefer-array-find": "error",
|
|
1435
1621
|
"unicorn/prefer-array-some": "error",
|
|
1622
|
+
"unicorn/no-instanceof-array": "error",
|
|
1436
1623
|
"unicorn/prefer-array-flat-map": "error",
|
|
1437
1624
|
"unicorn/prefer-array-index-of": "error",
|
|
1438
1625
|
"unicorn/require-array-join-separator": "error",
|
|
1626
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1439
1627
|
// Set
|
|
1440
1628
|
"unicorn/prefer-set-has": "error",
|
|
1441
1629
|
"unicorn/prefer-set-size": "error",
|
|
@@ -1448,13 +1636,15 @@ var unicorn = (options = {}) => [
|
|
|
1448
1636
|
|
|
1449
1637
|
// src/configs/specials.ts
|
|
1450
1638
|
import globals from "globals";
|
|
1451
|
-
var specials = () => [
|
|
1639
|
+
var specials = (options = {}) => [
|
|
1452
1640
|
{
|
|
1453
1641
|
name: "ntnyq/specials/scripts",
|
|
1454
1642
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
1455
1643
|
rules: {
|
|
1456
1644
|
"no-console": "off",
|
|
1457
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1645
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1646
|
+
// Overrides rules
|
|
1647
|
+
...options.overridesScriptsRules
|
|
1458
1648
|
}
|
|
1459
1649
|
},
|
|
1460
1650
|
{
|
|
@@ -1462,7 +1652,9 @@ var specials = () => [
|
|
|
1462
1652
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1463
1653
|
rules: {
|
|
1464
1654
|
"no-console": "off",
|
|
1465
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1655
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1656
|
+
// Overrides rules
|
|
1657
|
+
...options.overridesCliRules
|
|
1466
1658
|
}
|
|
1467
1659
|
},
|
|
1468
1660
|
{
|
|
@@ -1479,9 +1671,14 @@ var specials = () => [
|
|
|
1479
1671
|
{
|
|
1480
1672
|
allow: ["^GM_.+"]
|
|
1481
1673
|
}
|
|
1482
|
-
]
|
|
1674
|
+
],
|
|
1675
|
+
// Overrides rules
|
|
1676
|
+
...options.overridesUserScriptsRules
|
|
1483
1677
|
}
|
|
1484
|
-
}
|
|
1678
|
+
},
|
|
1679
|
+
// More special case configs
|
|
1680
|
+
// So don't need to append configs to composer
|
|
1681
|
+
...options.specialCaseConfigs ? options.specialCaseConfigs : []
|
|
1485
1682
|
];
|
|
1486
1683
|
|
|
1487
1684
|
// src/configs/comments.ts
|
|
@@ -1572,6 +1769,7 @@ var markdown = (options = {}) => {
|
|
|
1572
1769
|
var prettier = (options = {}) => {
|
|
1573
1770
|
const {
|
|
1574
1771
|
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1772
|
+
// User defined disabled files
|
|
1575
1773
|
userDisabledFiles = []
|
|
1576
1774
|
} = options;
|
|
1577
1775
|
return [
|
|
@@ -2231,16 +2429,37 @@ var unusedImports = (options = {}) => [
|
|
|
2231
2429
|
];
|
|
2232
2430
|
|
|
2233
2431
|
// src/core.ts
|
|
2234
|
-
|
|
2235
|
-
const configs2 = [];
|
|
2432
|
+
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2236
2433
|
const {
|
|
2237
|
-
|
|
2238
|
-
|
|
2434
|
+
/**
|
|
2435
|
+
* Shared options
|
|
2436
|
+
*/
|
|
2437
|
+
extensions: supportedExtensions = [],
|
|
2438
|
+
/**
|
|
2439
|
+
* Conditional by deps
|
|
2440
|
+
*/
|
|
2239
2441
|
vue: enableVue = hasVue,
|
|
2442
|
+
test: enableTest = hasVitest,
|
|
2240
2443
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
2241
2444
|
typescript: enableTypeScript = hasTypeScript,
|
|
2242
|
-
|
|
2445
|
+
/**
|
|
2446
|
+
* Enabled by default
|
|
2447
|
+
*/
|
|
2448
|
+
yml: enableYML = true,
|
|
2449
|
+
sort: enableSort = true,
|
|
2450
|
+
toml: enableTOML = true,
|
|
2451
|
+
jsonc: enableJSONC = true,
|
|
2452
|
+
antfu: enableAntfu = true,
|
|
2453
|
+
regexp: enableRegexp = true,
|
|
2454
|
+
unicorn: enableUnicorn = true,
|
|
2455
|
+
prettier: enablePrettier = true,
|
|
2456
|
+
markdown: enableMarkdown = true,
|
|
2457
|
+
stylistic: enableStylistic = true,
|
|
2458
|
+
gitignore: enableGitIgnore = true,
|
|
2459
|
+
githubAction: enableGitHubAction = true,
|
|
2460
|
+
perfectionist: enablePerfectionist = true
|
|
2243
2461
|
} = options;
|
|
2462
|
+
const configs2 = [];
|
|
2244
2463
|
if (enableVue) {
|
|
2245
2464
|
supportedExtensions.push("vue");
|
|
2246
2465
|
}
|
|
@@ -2264,6 +2483,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2264
2483
|
overrides: getOverrides(options, "imports")
|
|
2265
2484
|
}),
|
|
2266
2485
|
...jsdoc({
|
|
2486
|
+
typescript: !!enableTypeScript,
|
|
2267
2487
|
overrides: getOverrides(options, "jsdoc")
|
|
2268
2488
|
}),
|
|
2269
2489
|
...comments({
|
|
@@ -2274,7 +2494,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2274
2494
|
overrides: getOverrides(options, "javascript")
|
|
2275
2495
|
})
|
|
2276
2496
|
);
|
|
2277
|
-
if (
|
|
2497
|
+
if (enablePerfectionist) {
|
|
2278
2498
|
configs2.push(
|
|
2279
2499
|
...perfectionist({
|
|
2280
2500
|
...resolveSubOptions(options, "perfectionist"),
|
|
@@ -2282,14 +2502,14 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2282
2502
|
})
|
|
2283
2503
|
);
|
|
2284
2504
|
}
|
|
2285
|
-
if (
|
|
2505
|
+
if (enableUnicorn) {
|
|
2286
2506
|
configs2.push(
|
|
2287
2507
|
...unicorn({
|
|
2288
2508
|
overrides: getOverrides(options, "unicorn")
|
|
2289
2509
|
})
|
|
2290
2510
|
);
|
|
2291
2511
|
}
|
|
2292
|
-
if (
|
|
2512
|
+
if (enableRegexp) {
|
|
2293
2513
|
configs2.push(
|
|
2294
2514
|
...regexp({
|
|
2295
2515
|
...resolveSubOptions(options, "regexp"),
|
|
@@ -2315,35 +2535,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2315
2535
|
})
|
|
2316
2536
|
);
|
|
2317
2537
|
}
|
|
2318
|
-
if (
|
|
2538
|
+
if (enableYML) {
|
|
2319
2539
|
configs2.push(
|
|
2320
2540
|
...yml({
|
|
2321
2541
|
overrides: getOverrides(options, "yml")
|
|
2322
2542
|
})
|
|
2323
2543
|
);
|
|
2324
2544
|
}
|
|
2325
|
-
if (
|
|
2545
|
+
if (enableTOML) {
|
|
2326
2546
|
configs2.push(
|
|
2327
2547
|
...toml({
|
|
2328
2548
|
overrides: getOverrides(options, "toml")
|
|
2329
2549
|
})
|
|
2330
2550
|
);
|
|
2331
2551
|
}
|
|
2332
|
-
if (
|
|
2552
|
+
if (enableJSONC) {
|
|
2333
2553
|
configs2.push(
|
|
2334
2554
|
...jsonc({
|
|
2335
2555
|
overrides: getOverrides(options, "jsonc")
|
|
2336
2556
|
})
|
|
2337
2557
|
);
|
|
2338
2558
|
}
|
|
2339
|
-
if (
|
|
2559
|
+
if (enableSort) {
|
|
2340
2560
|
configs2.push(
|
|
2341
2561
|
...sort({
|
|
2342
2562
|
...resolveSubOptions(options, "sort")
|
|
2343
2563
|
})
|
|
2344
2564
|
);
|
|
2345
2565
|
}
|
|
2346
|
-
if (
|
|
2566
|
+
if (enableTest) {
|
|
2347
2567
|
configs2.push(
|
|
2348
2568
|
...test({
|
|
2349
2569
|
overrides: getOverrides(options, "test")
|
|
@@ -2368,34 +2588,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2368
2588
|
})
|
|
2369
2589
|
);
|
|
2370
2590
|
}
|
|
2371
|
-
if (
|
|
2591
|
+
if (enableAntfu) {
|
|
2372
2592
|
configs2.push(
|
|
2373
2593
|
...antfu({
|
|
2374
2594
|
overrides: getOverrides(options, "antfu")
|
|
2375
2595
|
})
|
|
2376
2596
|
);
|
|
2377
2597
|
}
|
|
2378
|
-
if (
|
|
2598
|
+
if (enableStylistic) {
|
|
2379
2599
|
configs2.push(
|
|
2380
2600
|
...stylistic({
|
|
2381
2601
|
overrides: getOverrides(options, "stylistic")
|
|
2382
2602
|
})
|
|
2383
2603
|
);
|
|
2384
2604
|
}
|
|
2385
|
-
if (
|
|
2605
|
+
if (enableGitHubAction) {
|
|
2386
2606
|
configs2.push(
|
|
2387
2607
|
...githubAction({
|
|
2388
2608
|
overrides: getOverrides(options, "githubAction")
|
|
2389
2609
|
})
|
|
2390
2610
|
);
|
|
2391
2611
|
}
|
|
2392
|
-
const configSpecials = specials(
|
|
2393
|
-
|
|
2612
|
+
const configSpecials = specials({
|
|
2613
|
+
...resolveSubOptions(options, "specials")
|
|
2614
|
+
});
|
|
2615
|
+
const configPrettier = enablePrettier ? prettier({
|
|
2394
2616
|
...resolveSubOptions(options, "prettier"),
|
|
2395
2617
|
overrides: getOverrides(options, "prettier")
|
|
2396
2618
|
}) : [];
|
|
2397
|
-
const composer = new FlatConfigComposer(
|
|
2398
|
-
await composer.append(
|
|
2619
|
+
const composer = new FlatConfigComposer(
|
|
2399
2620
|
...configs2,
|
|
2400
2621
|
...userConfigs,
|
|
2401
2622
|
...configSpecials,
|