@ntnyq/eslint-config 3.5.1 → 3.7.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/README.md +2 -0
- package/dist/index.cjs +590 -195
- package/dist/index.d.cts +216 -146
- package/dist/index.d.ts +216 -146
- package/dist/index.js +589 -195
- package/package.json +18 -16
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ var GLOB_JSX = `${GLOB_JS}x`;
|
|
|
72
72
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
73
73
|
var GLOB_TSX = `${GLOB_TS}x`;
|
|
74
74
|
var GLOB_DTS = "**/*.d.?([cm])ts";
|
|
75
|
+
var GLOB_TYPES = [GLOB_DTS, `**/types/${GLOB_TS}`, `**/types.ts`];
|
|
75
76
|
var GLOB_TEST = [
|
|
76
77
|
`**/*.test.${GLOB_SRC_EXT}`,
|
|
77
78
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
@@ -254,12 +255,12 @@ var unCategorizedRules = {
|
|
|
254
255
|
"vue/no-multiple-objects-in-class": "error",
|
|
255
256
|
"vue/prefer-separate-static-class": "error",
|
|
256
257
|
"vue/no-ref-object-reactivity-loss": "error",
|
|
257
|
-
"vue/no-duplicate-attr-inheritance": "error",
|
|
258
258
|
"vue/prefer-prop-type-boolean-first": "error",
|
|
259
259
|
"vue/html-comment-indent": ["error", 2],
|
|
260
260
|
"vue/next-tick-style": ["error", "promise"],
|
|
261
261
|
"vue/v-for-delimiter-style": ["error", "in"],
|
|
262
262
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
263
|
+
"vue/slot-name-casing": ["error", "camelCase"],
|
|
263
264
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
264
265
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
265
266
|
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
@@ -274,6 +275,12 @@ var unCategorizedRules = {
|
|
|
274
275
|
reset: true
|
|
275
276
|
}
|
|
276
277
|
],
|
|
278
|
+
"vue/no-duplicate-attr-inheritance": [
|
|
279
|
+
"error",
|
|
280
|
+
{
|
|
281
|
+
checkMultiRootNodes: true
|
|
282
|
+
}
|
|
283
|
+
],
|
|
277
284
|
"vue/block-order": [
|
|
278
285
|
"error",
|
|
279
286
|
{
|
|
@@ -557,7 +564,13 @@ var node = (options = {}) => [
|
|
|
557
564
|
// src/configs/sort.ts
|
|
558
565
|
var sort = (options = {}) => {
|
|
559
566
|
const configs2 = [];
|
|
560
|
-
|
|
567
|
+
const {
|
|
568
|
+
tsconfig: enableSortTsconfig = true,
|
|
569
|
+
packageJson: enableSortPackageJson = true,
|
|
570
|
+
i18nLocale: enableSortI18nLocale = true,
|
|
571
|
+
pnpmWorkspace: enableSortPnpmWorkspace = true
|
|
572
|
+
} = options;
|
|
573
|
+
if (enableSortTsconfig) {
|
|
561
574
|
configs2.push({
|
|
562
575
|
name: "ntnyq/sort/tsconfig",
|
|
563
576
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
@@ -673,7 +686,7 @@ var sort = (options = {}) => {
|
|
|
673
686
|
}
|
|
674
687
|
});
|
|
675
688
|
}
|
|
676
|
-
if (
|
|
689
|
+
if (enableSortPackageJson) {
|
|
677
690
|
configs2.push({
|
|
678
691
|
name: "ntnyq/sort/package-json",
|
|
679
692
|
files: ["**/package.json"],
|
|
@@ -841,7 +854,7 @@ var sort = (options = {}) => {
|
|
|
841
854
|
}
|
|
842
855
|
});
|
|
843
856
|
}
|
|
844
|
-
if (
|
|
857
|
+
if (enableSortI18nLocale) {
|
|
845
858
|
configs2.push(
|
|
846
859
|
{
|
|
847
860
|
name: "ntnyq/sort/i18n-locale/json",
|
|
@@ -871,7 +884,7 @@ var sort = (options = {}) => {
|
|
|
871
884
|
}
|
|
872
885
|
);
|
|
873
886
|
}
|
|
874
|
-
if (
|
|
887
|
+
if (enableSortPnpmWorkspace) {
|
|
875
888
|
configs2.push({
|
|
876
889
|
name: "ntnyq/sort/pnpm-workspace",
|
|
877
890
|
files: ["**/pnpm-workspace.yaml"],
|
|
@@ -901,25 +914,25 @@ var toml = (options = {}) => [
|
|
|
901
914
|
toml: default5
|
|
902
915
|
},
|
|
903
916
|
rules: {
|
|
904
|
-
"toml/comma-style": "error",
|
|
905
917
|
"toml/keys-order": "error",
|
|
918
|
+
"toml/key-spacing": "error",
|
|
919
|
+
"toml/quoted-keys": "error",
|
|
920
|
+
"toml/comma-style": "error",
|
|
921
|
+
"toml/tables-order": "error",
|
|
906
922
|
"toml/no-space-dots": "error",
|
|
907
|
-
"toml/
|
|
908
|
-
"toml/precision-of-fractional-seconds": "error",
|
|
923
|
+
"toml/spaced-comment": "error",
|
|
909
924
|
"toml/precision-of-integer": "error",
|
|
910
|
-
"toml/
|
|
911
|
-
"toml/indent": ["error", 2],
|
|
912
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
925
|
+
"toml/table-bracket-spacing": "error",
|
|
913
926
|
"toml/array-bracket-newline": "error",
|
|
914
|
-
"toml/array-bracket-spacing": ["error", "never"],
|
|
915
|
-
"toml/array-element-newline": ["error", "never"],
|
|
916
927
|
"toml/inline-table-curly-spacing": "error",
|
|
917
|
-
"toml/key-spacing": "error",
|
|
918
928
|
"toml/padding-line-between-pairs": "error",
|
|
919
929
|
"toml/padding-line-between-tables": "error",
|
|
920
|
-
"toml/
|
|
921
|
-
"toml/
|
|
922
|
-
"toml/
|
|
930
|
+
"toml/no-unreadable-number-separator": "error",
|
|
931
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
932
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
933
|
+
"toml/indent": ["error", 2],
|
|
934
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
935
|
+
"toml/array-element-newline": ["error", "never"],
|
|
923
936
|
// Overrides rules
|
|
924
937
|
...options.overrides
|
|
925
938
|
}
|
|
@@ -975,6 +988,13 @@ var antfu = (options = {}) => [
|
|
|
975
988
|
];
|
|
976
989
|
|
|
977
990
|
// src/configs/jsdoc.ts
|
|
991
|
+
var typescriptRules = {
|
|
992
|
+
"jsdoc/no-undefined-types": "off",
|
|
993
|
+
"jsdoc/require-param-type": "off",
|
|
994
|
+
"jsdoc/require-property-type": "off",
|
|
995
|
+
"jsdoc/require-returns-type": "off",
|
|
996
|
+
"jsdoc/no-types": "error"
|
|
997
|
+
};
|
|
978
998
|
var jsdoc = (options = {}) => [
|
|
979
999
|
{
|
|
980
1000
|
name: "ntnyq/jsdoc",
|
|
@@ -982,23 +1002,204 @@ var jsdoc = (options = {}) => [
|
|
|
982
1002
|
jsdoc: default9
|
|
983
1003
|
},
|
|
984
1004
|
rules: {
|
|
1005
|
+
// Disabled rules
|
|
1006
|
+
"jsdoc/tag-lines": "off",
|
|
1007
|
+
// Use `jsdoc/sort-tags`
|
|
1008
|
+
"jsdoc/text-escaping": "off",
|
|
1009
|
+
// No need
|
|
1010
|
+
// Fixable rules
|
|
1011
|
+
"jsdoc/check-alignment": "error",
|
|
1012
|
+
"jsdoc/check-line-alignment": "error",
|
|
1013
|
+
"jsdoc/check-param-names": "error",
|
|
1014
|
+
"jsdoc/check-property-names": "error",
|
|
1015
|
+
"jsdoc/check-tag-names": "error",
|
|
1016
|
+
"jsdoc/check-types": "error",
|
|
1017
|
+
"jsdoc/empty-tags": "error",
|
|
1018
|
+
"jsdoc/multiline-blocks": "error",
|
|
1019
|
+
"jsdoc/no-bad-blocks": "error",
|
|
1020
|
+
"jsdoc/no-blank-block-descriptions": "error",
|
|
1021
|
+
"jsdoc/no-blank-blocks": "error",
|
|
1022
|
+
"jsdoc/no-defaults": "error",
|
|
1023
|
+
"jsdoc/no-multi-asterisks": "error",
|
|
1024
|
+
"jsdoc/require-asterisk-prefix": "error",
|
|
1025
|
+
"jsdoc/require-hyphen-before-param-description": "error",
|
|
1026
|
+
// TODO: this after investigate
|
|
1027
|
+
// 'jsdoc/sort-tags': [
|
|
1028
|
+
// 'error',
|
|
1029
|
+
// {
|
|
1030
|
+
// tagSequence: [
|
|
1031
|
+
// {
|
|
1032
|
+
// // Module/file-level
|
|
1033
|
+
// tags: ['module', 'exports', 'file', 'fileoverview', 'overview', 'import'],
|
|
1034
|
+
// },
|
|
1035
|
+
// {
|
|
1036
|
+
// // Identifying (name, type)
|
|
1037
|
+
// tags: [
|
|
1038
|
+
// 'typedef',
|
|
1039
|
+
// 'interface',
|
|
1040
|
+
// 'record',
|
|
1041
|
+
// 'template',
|
|
1042
|
+
// 'name',
|
|
1043
|
+
// 'kind',
|
|
1044
|
+
// 'type',
|
|
1045
|
+
// 'alias',
|
|
1046
|
+
// 'external',
|
|
1047
|
+
// 'host',
|
|
1048
|
+
// 'callback',
|
|
1049
|
+
// 'func',
|
|
1050
|
+
// 'function',
|
|
1051
|
+
// 'method',
|
|
1052
|
+
// 'class',
|
|
1053
|
+
// 'constructor',
|
|
1054
|
+
// ],
|
|
1055
|
+
// },
|
|
1056
|
+
// {
|
|
1057
|
+
// // Relationships
|
|
1058
|
+
// tags: [
|
|
1059
|
+
// 'modifies',
|
|
1060
|
+
// 'mixes',
|
|
1061
|
+
// 'mixin',
|
|
1062
|
+
// 'mixinClass',
|
|
1063
|
+
// 'mixinFunction',
|
|
1064
|
+
// 'namespace',
|
|
1065
|
+
// 'borrows',
|
|
1066
|
+
// 'constructs',
|
|
1067
|
+
// 'lends',
|
|
1068
|
+
// 'implements',
|
|
1069
|
+
// 'requires',
|
|
1070
|
+
// ],
|
|
1071
|
+
// },
|
|
1072
|
+
// {
|
|
1073
|
+
// // Long descriptions
|
|
1074
|
+
// tags: ['desc', 'description', 'classdesc', 'tutorial', 'copyright', 'license'],
|
|
1075
|
+
// },
|
|
1076
|
+
// {
|
|
1077
|
+
// // Simple annotations
|
|
1078
|
+
// tags: [
|
|
1079
|
+
// 'const',
|
|
1080
|
+
// 'constant',
|
|
1081
|
+
// 'final',
|
|
1082
|
+
// 'global',
|
|
1083
|
+
// 'readonly',
|
|
1084
|
+
// 'abstract',
|
|
1085
|
+
// 'virtual',
|
|
1086
|
+
// 'var',
|
|
1087
|
+
// 'member',
|
|
1088
|
+
// 'memberof',
|
|
1089
|
+
// 'memberof!',
|
|
1090
|
+
// 'inner',
|
|
1091
|
+
// 'instance',
|
|
1092
|
+
// 'inheritdoc',
|
|
1093
|
+
// 'inheritDoc',
|
|
1094
|
+
// 'override',
|
|
1095
|
+
// 'hideconstructor',
|
|
1096
|
+
// ],
|
|
1097
|
+
// },
|
|
1098
|
+
// {
|
|
1099
|
+
// // Core function/object inf
|
|
1100
|
+
// tags: ['param', 'arg', 'argument', 'prop', 'property', 'return', 'returns'],
|
|
1101
|
+
// },
|
|
1102
|
+
// {
|
|
1103
|
+
// // Important behavior details
|
|
1104
|
+
// tags: [
|
|
1105
|
+
// 'async',
|
|
1106
|
+
// 'generator',
|
|
1107
|
+
// 'default',
|
|
1108
|
+
// 'defaultvalue',
|
|
1109
|
+
// 'enum',
|
|
1110
|
+
// 'augments',
|
|
1111
|
+
// 'extends',
|
|
1112
|
+
// 'throws',
|
|
1113
|
+
// 'exception',
|
|
1114
|
+
// 'yield',
|
|
1115
|
+
// 'yields',
|
|
1116
|
+
// 'event',
|
|
1117
|
+
// 'fires',
|
|
1118
|
+
// 'emits',
|
|
1119
|
+
// 'listens',
|
|
1120
|
+
// 'this',
|
|
1121
|
+
// ],
|
|
1122
|
+
// },
|
|
1123
|
+
// {
|
|
1124
|
+
// // Access
|
|
1125
|
+
// tags: ['static', 'private', 'protected', 'public', 'access', 'internal', 'package'],
|
|
1126
|
+
// },
|
|
1127
|
+
// {
|
|
1128
|
+
// // Other/unknown
|
|
1129
|
+
// tags: ['-other'],
|
|
1130
|
+
// },
|
|
1131
|
+
// {
|
|
1132
|
+
// // Supplementary descriptions
|
|
1133
|
+
// tags: ['see', 'example'],
|
|
1134
|
+
// },
|
|
1135
|
+
// {
|
|
1136
|
+
// // Other Closure (undocumented) metadata
|
|
1137
|
+
// tags: [
|
|
1138
|
+
// 'closurePrimitive',
|
|
1139
|
+
// 'customElement',
|
|
1140
|
+
// 'expose',
|
|
1141
|
+
// 'hidden',
|
|
1142
|
+
// 'idGenerator',
|
|
1143
|
+
// 'meaning',
|
|
1144
|
+
// 'ngInject',
|
|
1145
|
+
// 'owner',
|
|
1146
|
+
// 'wizaction',
|
|
1147
|
+
// ],
|
|
1148
|
+
// },
|
|
1149
|
+
// {
|
|
1150
|
+
// // Other Closure (documented) metadata
|
|
1151
|
+
// tags: [
|
|
1152
|
+
// 'define',
|
|
1153
|
+
// 'dict',
|
|
1154
|
+
// 'export',
|
|
1155
|
+
// 'externs',
|
|
1156
|
+
// 'implicitCast',
|
|
1157
|
+
// 'noalias',
|
|
1158
|
+
// 'nocollapse',
|
|
1159
|
+
// 'nocompile',
|
|
1160
|
+
// 'noinline',
|
|
1161
|
+
// 'nosideeffects',
|
|
1162
|
+
// 'polymer',
|
|
1163
|
+
// 'polymerBehavior',
|
|
1164
|
+
// 'preserve',
|
|
1165
|
+
// 'struct',
|
|
1166
|
+
// 'suppress',
|
|
1167
|
+
// 'unrestricted',
|
|
1168
|
+
// ],
|
|
1169
|
+
// },
|
|
1170
|
+
// {
|
|
1171
|
+
// // Metadata
|
|
1172
|
+
// tags: ['category'],
|
|
1173
|
+
// },
|
|
1174
|
+
// {
|
|
1175
|
+
// // Non-Closure metadata
|
|
1176
|
+
// tags: [
|
|
1177
|
+
// 'ignore',
|
|
1178
|
+
// 'author',
|
|
1179
|
+
// 'version',
|
|
1180
|
+
// 'variation',
|
|
1181
|
+
// 'since',
|
|
1182
|
+
// 'deprecated',
|
|
1183
|
+
// 'compatibility',
|
|
1184
|
+
// 'todo',
|
|
1185
|
+
// ],
|
|
1186
|
+
// },
|
|
1187
|
+
// ],
|
|
1188
|
+
// alphabetizeExtras: true,
|
|
1189
|
+
// linesBetween: 1,
|
|
1190
|
+
// },
|
|
1191
|
+
// ],
|
|
985
1192
|
"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
1193
|
"jsdoc/implements-on-classes": "warn",
|
|
991
|
-
"jsdoc/no-defaults": "warn",
|
|
992
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
993
1194
|
"jsdoc/require-param-name": "warn",
|
|
994
1195
|
"jsdoc/require-property": "warn",
|
|
995
|
-
"jsdoc/require-property-description": "warn",
|
|
996
1196
|
"jsdoc/require-property-name": "warn",
|
|
1197
|
+
"jsdoc/require-property-description": "warn",
|
|
997
1198
|
"jsdoc/require-returns-check": "warn",
|
|
998
1199
|
"jsdoc/require-returns-description": "warn",
|
|
999
1200
|
"jsdoc/require-yields-check": "warn",
|
|
1000
|
-
|
|
1001
|
-
|
|
1201
|
+
// TypeScript rules overrides
|
|
1202
|
+
...options.typescript ? typescriptRules : {},
|
|
1002
1203
|
// Overrides rules
|
|
1003
1204
|
...options.overrides
|
|
1004
1205
|
}
|
|
@@ -1018,10 +1219,12 @@ var jsonc = (options = {}) => [
|
|
|
1018
1219
|
},
|
|
1019
1220
|
rules: {
|
|
1020
1221
|
...default10.configs["recommended-with-jsonc"].rules,
|
|
1021
|
-
"jsonc/
|
|
1022
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1023
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1222
|
+
"jsonc/no-octal-escape": "error",
|
|
1024
1223
|
"jsonc/indent": ["error", 2],
|
|
1224
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1225
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1226
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1227
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1025
1228
|
"jsonc/key-spacing": [
|
|
1026
1229
|
"error",
|
|
1027
1230
|
{
|
|
@@ -1029,7 +1232,6 @@ var jsonc = (options = {}) => [
|
|
|
1029
1232
|
afterColon: true
|
|
1030
1233
|
}
|
|
1031
1234
|
],
|
|
1032
|
-
"jsonc/no-octal-escape": "error",
|
|
1033
1235
|
"jsonc/object-curly-newline": [
|
|
1034
1236
|
"error",
|
|
1035
1237
|
{
|
|
@@ -1037,7 +1239,6 @@ var jsonc = (options = {}) => [
|
|
|
1037
1239
|
consistent: true
|
|
1038
1240
|
}
|
|
1039
1241
|
],
|
|
1040
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1041
1242
|
"jsonc/object-property-newline": [
|
|
1042
1243
|
"error",
|
|
1043
1244
|
{
|
|
@@ -1067,23 +1268,23 @@ var ntnyq = (options = {}) => [
|
|
|
1067
1268
|
|
|
1068
1269
|
// src/configs/regexp.ts
|
|
1069
1270
|
var regexp = (options = {}) => {
|
|
1070
|
-
const
|
|
1071
|
-
const
|
|
1072
|
-
...
|
|
1271
|
+
const recommendedConfig = pluginRegexp.configs["flat/recommended"];
|
|
1272
|
+
const recommendedRules2 = {
|
|
1273
|
+
...recommendedConfig.rules
|
|
1073
1274
|
};
|
|
1074
1275
|
if (options.level === "warn") {
|
|
1075
|
-
for (const key in
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1276
|
+
for (const key in recommendedRules2) {
|
|
1277
|
+
if (recommendedRules2[key] === "error") {
|
|
1278
|
+
recommendedRules2[key] = "warn";
|
|
1078
1279
|
}
|
|
1079
1280
|
}
|
|
1080
1281
|
}
|
|
1081
1282
|
return [
|
|
1082
1283
|
{
|
|
1083
|
-
...
|
|
1284
|
+
...recommendedConfig,
|
|
1084
1285
|
name: "ntnyq/regexp",
|
|
1085
1286
|
rules: {
|
|
1086
|
-
...
|
|
1287
|
+
...recommendedRules2,
|
|
1087
1288
|
// Overrides rules
|
|
1088
1289
|
...options.overrides
|
|
1089
1290
|
}
|
|
@@ -1109,51 +1310,51 @@ var unocss = (options = {}) => [
|
|
|
1109
1310
|
|
|
1110
1311
|
// src/constants.ts
|
|
1111
1312
|
var DEFAULT_PRETTIER_OPTIONS = {
|
|
1112
|
-
// Maximum line length
|
|
1113
|
-
printWidth: 100,
|
|
1114
1313
|
// Specify the number of spaces per indentation-level
|
|
1115
1314
|
tabWidth: 2,
|
|
1116
|
-
// Indent lines with tabs instead of spaces
|
|
1117
|
-
useTabs: false,
|
|
1118
1315
|
// Use semicolons or not
|
|
1119
1316
|
semi: false,
|
|
1317
|
+
// Format only a segment of a file.
|
|
1318
|
+
rangeStart: 0,
|
|
1319
|
+
// Indent lines with tabs instead of spaces
|
|
1320
|
+
useTabs: false,
|
|
1321
|
+
// Maximum line length
|
|
1322
|
+
printWidth: 100,
|
|
1323
|
+
// End of line
|
|
1324
|
+
endOfLine: "lf",
|
|
1120
1325
|
// Use single quotes instead of double quotes
|
|
1121
1326
|
singleQuote: true,
|
|
1122
|
-
//
|
|
1123
|
-
|
|
1327
|
+
// Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
|
|
1328
|
+
insertPragma: false,
|
|
1124
1329
|
// Use single quotes instead of double quotes in JSX
|
|
1125
1330
|
jsxSingleQuote: true,
|
|
1126
1331
|
// Print trailing commas wherever possible when multi-line
|
|
1127
1332
|
trailingComma: "all",
|
|
1128
1333
|
// Print spaces between brackets in object literals.
|
|
1129
1334
|
bracketSpacing: true,
|
|
1130
|
-
// Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
|
|
1131
|
-
bracketSameLine: false,
|
|
1132
1335
|
// Include parentheses around a sole arrow function parameter
|
|
1133
1336
|
arrowParens: "avoid",
|
|
1134
|
-
//
|
|
1135
|
-
|
|
1136
|
-
rangeEnd: Number.POSITIVE_INFINITY,
|
|
1337
|
+
// Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
1338
|
+
requirePragma: false,
|
|
1137
1339
|
// Specify which parser to use.
|
|
1138
1340
|
// parser: undefined,
|
|
1139
1341
|
// Specify the file name to use to infer which parser to use.
|
|
1140
1342
|
// filepath: undefined,
|
|
1141
|
-
// Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
1142
|
-
requirePragma: false,
|
|
1143
|
-
// Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
|
|
1144
|
-
insertPragma: false,
|
|
1145
1343
|
// By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
|
|
1146
1344
|
proseWrap: "preserve",
|
|
1147
|
-
//
|
|
1148
|
-
|
|
1345
|
+
// Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
|
|
1346
|
+
bracketSameLine: false,
|
|
1347
|
+
// Change when properties in objects are quoted
|
|
1348
|
+
quoteProps: "as-needed",
|
|
1349
|
+
// Enforce single attribute per line in HTML, Vue and JSX
|
|
1350
|
+
singleAttributePerLine: true,
|
|
1149
1351
|
// Whether or not to indent the code inside <script> and <style> tags in Vue files
|
|
1150
1352
|
vueIndentScriptAndStyle: false,
|
|
1151
|
-
//
|
|
1152
|
-
|
|
1353
|
+
// Specify the global whitespace sensitivity for HTML files
|
|
1354
|
+
htmlWhitespaceSensitivity: "css",
|
|
1355
|
+
rangeEnd: Number.POSITIVE_INFINITY,
|
|
1153
1356
|
// Control whether Prettier formats quoted code embedded in the file
|
|
1154
|
-
embeddedLanguageFormatting: "auto"
|
|
1155
|
-
// Enforce single attribute per line in HTML, Vue and JSX
|
|
1156
|
-
singleAttributePerLine: true
|
|
1357
|
+
embeddedLanguageFormatting: "auto"
|
|
1157
1358
|
};
|
|
1158
1359
|
|
|
1159
1360
|
// src/utils/env.ts
|
|
@@ -1358,8 +1559,8 @@ var imports = (options = {}) => [
|
|
|
1358
1559
|
// src/configs/unicorn.ts
|
|
1359
1560
|
var disabledRules2 = {
|
|
1360
1561
|
"unicorn/better-regex": "off",
|
|
1361
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1362
1562
|
"unicorn/explicit-length-check": "off",
|
|
1563
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1363
1564
|
"unicorn/no-array-callback-reference": "off",
|
|
1364
1565
|
/**
|
|
1365
1566
|
* @see https://caniuse.com/?search=globalThis
|
|
@@ -1373,37 +1574,37 @@ var unicorn = (options = {}) => [
|
|
|
1373
1574
|
unicorn: default15
|
|
1374
1575
|
},
|
|
1375
1576
|
rules: {
|
|
1376
|
-
"unicorn/error-message": "error",
|
|
1377
1577
|
"unicorn/escape-case": "error",
|
|
1578
|
+
"unicorn/no-for-loop": "error",
|
|
1579
|
+
"unicorn/no-lonely-if": "error",
|
|
1580
|
+
"unicorn/error-message": "error",
|
|
1378
1581
|
"unicorn/no-new-buffer": "error",
|
|
1379
|
-
"unicorn/
|
|
1582
|
+
"unicorn/no-hex-escape": "error",
|
|
1583
|
+
"unicorn/throw-new-error": "error",
|
|
1380
1584
|
"unicorn/prefer-includes": "error",
|
|
1585
|
+
"unicorn/new-for-builtins": "error",
|
|
1381
1586
|
"unicorn/prefer-type-error": "error",
|
|
1382
|
-
"unicorn/
|
|
1383
|
-
"unicorn/no-
|
|
1384
|
-
"unicorn/
|
|
1385
|
-
"unicorn/no-typeof-undefined": "error",
|
|
1587
|
+
"unicorn/prefer-math-trunc": "error",
|
|
1588
|
+
"unicorn/no-console-spaces": "error",
|
|
1589
|
+
"unicorn/no-zero-fractions": "error",
|
|
1386
1590
|
"unicorn/prefer-regexp-test": "error",
|
|
1591
|
+
"unicorn/number-literal-case": "error",
|
|
1592
|
+
"unicorn/no-typeof-undefined": "error",
|
|
1593
|
+
"unicorn/prefer-math-min-max": "error",
|
|
1594
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1595
|
+
"unicorn/no-unnecessary-await": "error",
|
|
1387
1596
|
"unicorn/no-static-only-class": "error",
|
|
1388
|
-
"unicorn/
|
|
1597
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
1598
|
+
"unicorn/prefer-negative-index": "error",
|
|
1599
|
+
"unicorn/prefer-structured-clone": "error",
|
|
1389
1600
|
"unicorn/custom-error-definition": "error",
|
|
1390
1601
|
"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
1602
|
"unicorn/prefer-number-properties": "error",
|
|
1401
|
-
"unicorn/prefer-optional-catch-binding": "error",
|
|
1402
1603
|
"unicorn/prefer-prototype-methods": "error",
|
|
1403
|
-
"unicorn/prefer-
|
|
1404
|
-
"unicorn/prefer-
|
|
1405
|
-
"unicorn/prefer-structured-clone": "error",
|
|
1604
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
1605
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
1406
1606
|
"unicorn/consistent-existence-index-check": "error",
|
|
1607
|
+
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1407
1608
|
"unicorn/catch-error-name": [
|
|
1408
1609
|
"error",
|
|
1409
1610
|
{
|
|
@@ -1418,24 +1619,24 @@ var unicorn = (options = {}) => [
|
|
|
1418
1619
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1419
1620
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1420
1621
|
// DOM
|
|
1421
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
1422
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1423
1622
|
"unicorn/prefer-query-selector": "error",
|
|
1424
1623
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
1624
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
1425
1625
|
"unicorn/prefer-dom-node-append": "error",
|
|
1426
1626
|
"unicorn/prefer-dom-node-dataset": "error",
|
|
1427
|
-
"unicorn/prefer-
|
|
1627
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
1428
1628
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
1629
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1429
1630
|
// Array
|
|
1430
1631
|
"unicorn/no-new-array": "error",
|
|
1431
|
-
"unicorn/no-instanceof-array": "error",
|
|
1432
1632
|
"unicorn/no-array-push-push": "error",
|
|
1433
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
1434
1633
|
"unicorn/prefer-array-find": "error",
|
|
1435
1634
|
"unicorn/prefer-array-some": "error",
|
|
1635
|
+
"unicorn/no-instanceof-array": "error",
|
|
1436
1636
|
"unicorn/prefer-array-flat-map": "error",
|
|
1437
1637
|
"unicorn/prefer-array-index-of": "error",
|
|
1438
1638
|
"unicorn/require-array-join-separator": "error",
|
|
1639
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
1439
1640
|
// Set
|
|
1440
1641
|
"unicorn/prefer-set-has": "error",
|
|
1441
1642
|
"unicorn/prefer-set-size": "error",
|
|
@@ -1448,13 +1649,15 @@ var unicorn = (options = {}) => [
|
|
|
1448
1649
|
|
|
1449
1650
|
// src/configs/specials.ts
|
|
1450
1651
|
import globals from "globals";
|
|
1451
|
-
var specials = () => [
|
|
1652
|
+
var specials = (options = {}) => [
|
|
1452
1653
|
{
|
|
1453
1654
|
name: "ntnyq/specials/scripts",
|
|
1454
1655
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
1455
1656
|
rules: {
|
|
1456
1657
|
"no-console": "off",
|
|
1457
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1658
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1659
|
+
// Overrides rules
|
|
1660
|
+
...options.overridesScriptsRules
|
|
1458
1661
|
}
|
|
1459
1662
|
},
|
|
1460
1663
|
{
|
|
@@ -1462,7 +1665,9 @@ var specials = () => [
|
|
|
1462
1665
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1463
1666
|
rules: {
|
|
1464
1667
|
"no-console": "off",
|
|
1465
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1668
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1669
|
+
// Overrides rules
|
|
1670
|
+
...options.overridesCliRules
|
|
1466
1671
|
}
|
|
1467
1672
|
},
|
|
1468
1673
|
{
|
|
@@ -1479,9 +1684,35 @@ var specials = () => [
|
|
|
1479
1684
|
{
|
|
1480
1685
|
allow: ["^GM_.+"]
|
|
1481
1686
|
}
|
|
1482
|
-
]
|
|
1687
|
+
],
|
|
1688
|
+
// Overrides rules
|
|
1689
|
+
...options.overridesUserScriptsRules
|
|
1483
1690
|
}
|
|
1484
|
-
}
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
name: "ntnyq/specials/config-file",
|
|
1694
|
+
files: [`**/*.config*.${GLOB_SRC_EXT}`],
|
|
1695
|
+
plugins: {
|
|
1696
|
+
import: default14,
|
|
1697
|
+
perfectionist: default19
|
|
1698
|
+
},
|
|
1699
|
+
rules: {
|
|
1700
|
+
"no-console": "off",
|
|
1701
|
+
"import/no-default-export": "off",
|
|
1702
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1703
|
+
"perfectionist/sort-objects": [
|
|
1704
|
+
"error",
|
|
1705
|
+
{
|
|
1706
|
+
type: "line-length",
|
|
1707
|
+
order: "asc"
|
|
1708
|
+
}
|
|
1709
|
+
],
|
|
1710
|
+
...options.overridesConfigFileRules
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
// More special case configs
|
|
1714
|
+
// So don't need to append configs to composer
|
|
1715
|
+
...options.specialCaseConfigs ? options.specialCaseConfigs : []
|
|
1485
1716
|
];
|
|
1486
1717
|
|
|
1487
1718
|
// src/configs/comments.ts
|
|
@@ -1572,6 +1803,7 @@ var markdown = (options = {}) => {
|
|
|
1572
1803
|
var prettier = (options = {}) => {
|
|
1573
1804
|
const {
|
|
1574
1805
|
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1806
|
+
// User defined disabled files
|
|
1575
1807
|
userDisabledFiles = []
|
|
1576
1808
|
} = options;
|
|
1577
1809
|
return [
|
|
@@ -2087,7 +2319,7 @@ var typescript = (options = {}) => {
|
|
|
2087
2319
|
] : [],
|
|
2088
2320
|
{
|
|
2089
2321
|
name: "ntnyq/ts/types",
|
|
2090
|
-
files: [
|
|
2322
|
+
files: [...GLOB_TYPES],
|
|
2091
2323
|
rules: {
|
|
2092
2324
|
"no-use-before-define": "off",
|
|
2093
2325
|
"no-restricted-syntax": "off",
|
|
@@ -2116,90 +2348,228 @@ var githubAction = (options = {}) => [
|
|
|
2116
2348
|
];
|
|
2117
2349
|
|
|
2118
2350
|
// src/configs/perfectionist.ts
|
|
2119
|
-
var perfectionist = (options = {}) =>
|
|
2120
|
-
{
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2351
|
+
var perfectionist = (options = {}) => {
|
|
2352
|
+
const {
|
|
2353
|
+
sortEnums: enableSortEnums = true,
|
|
2354
|
+
sortTypes: enableSortTypes = true,
|
|
2355
|
+
sortConstants: enableSortConstants = true
|
|
2356
|
+
} = options;
|
|
2357
|
+
const configs2 = [
|
|
2358
|
+
{
|
|
2359
|
+
name: "ntnyq/perfectionist/common",
|
|
2360
|
+
plugins: {
|
|
2361
|
+
perfectionist: default19
|
|
2362
|
+
},
|
|
2363
|
+
rules: {
|
|
2364
|
+
"perfectionist/sort-imports": [
|
|
2365
|
+
"error",
|
|
2366
|
+
{
|
|
2367
|
+
groups: [
|
|
2368
|
+
// Side effect style imports (e.g. 'normalize.css')
|
|
2369
|
+
"side-effect-style",
|
|
2370
|
+
// Styles (e.g. *.{css,scss,less})
|
|
2371
|
+
"style",
|
|
2372
|
+
// Node.js built-in modules. (e.g. fs, path)
|
|
2373
|
+
"builtin",
|
|
2374
|
+
// External modules installed in the project (e.g. vue, lodash)
|
|
2375
|
+
"external",
|
|
2376
|
+
// Internal modules (e.g. @/utils, @/components)
|
|
2377
|
+
"internal",
|
|
2378
|
+
// Modules from parent directory (e.g. ../utils)
|
|
2379
|
+
"parent",
|
|
2380
|
+
// Modules from the same directory (e.g. ./utils)
|
|
2381
|
+
"sibling",
|
|
2382
|
+
// Main file from the current directory (e.g. ./index)
|
|
2383
|
+
"index",
|
|
2384
|
+
// TypeScript object-imports (e.g. import log = console.log)
|
|
2385
|
+
"object",
|
|
2386
|
+
// Side effect imports (e.g. import 'babel-polyfill')
|
|
2387
|
+
"side-effect",
|
|
2388
|
+
/**
|
|
2389
|
+
* Type import at the end
|
|
2390
|
+
*/
|
|
2391
|
+
"builtin-type",
|
|
2392
|
+
"external-type",
|
|
2393
|
+
"internal-type",
|
|
2394
|
+
"parent-type",
|
|
2395
|
+
"sibling-type",
|
|
2396
|
+
"index-type",
|
|
2397
|
+
"type",
|
|
2398
|
+
/**
|
|
2399
|
+
* Imports that don’t fit into any other group
|
|
2400
|
+
*/
|
|
2401
|
+
"unknown"
|
|
2402
|
+
],
|
|
2403
|
+
order: "asc",
|
|
2404
|
+
type: "natural",
|
|
2405
|
+
ignoreCase: true,
|
|
2406
|
+
internalPattern: ["^~/.+", "^@/.+", "^#.+"],
|
|
2407
|
+
newlinesBetween: "ignore"
|
|
2408
|
+
}
|
|
2409
|
+
],
|
|
2410
|
+
"perfectionist/sort-exports": [
|
|
2411
|
+
"error",
|
|
2412
|
+
{
|
|
2413
|
+
order: "asc",
|
|
2414
|
+
type: "line-length"
|
|
2415
|
+
}
|
|
2416
|
+
],
|
|
2417
|
+
"perfectionist/sort-named-exports": [
|
|
2418
|
+
"error",
|
|
2419
|
+
{
|
|
2420
|
+
type: "alphabetical",
|
|
2421
|
+
order: "asc",
|
|
2422
|
+
ignoreCase: true,
|
|
2423
|
+
groupKind: "values-first"
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
"perfectionist/sort-named-imports": [
|
|
2427
|
+
"error",
|
|
2428
|
+
{
|
|
2429
|
+
type: "alphabetical",
|
|
2430
|
+
order: "asc",
|
|
2431
|
+
ignoreCase: true,
|
|
2432
|
+
ignoreAlias: false,
|
|
2433
|
+
groupKind: "values-first"
|
|
2434
|
+
}
|
|
2435
|
+
],
|
|
2436
|
+
// Overrides rules
|
|
2437
|
+
...options.overrides
|
|
2438
|
+
}
|
|
2200
2439
|
}
|
|
2440
|
+
];
|
|
2441
|
+
if (enableSortEnums) {
|
|
2442
|
+
configs2.push({
|
|
2443
|
+
name: "ntnyq/perfectionist/enums",
|
|
2444
|
+
files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
|
|
2445
|
+
plugins: {
|
|
2446
|
+
perfectionist: default19
|
|
2447
|
+
},
|
|
2448
|
+
rules: {
|
|
2449
|
+
"perfectionist/sort-enums": [
|
|
2450
|
+
"error",
|
|
2451
|
+
{
|
|
2452
|
+
type: "line-length",
|
|
2453
|
+
order: "asc"
|
|
2454
|
+
}
|
|
2455
|
+
],
|
|
2456
|
+
"perfectionist/sort-modules": [
|
|
2457
|
+
"error",
|
|
2458
|
+
{
|
|
2459
|
+
type: "line-length",
|
|
2460
|
+
order: "asc"
|
|
2461
|
+
}
|
|
2462
|
+
],
|
|
2463
|
+
// Overrides rules
|
|
2464
|
+
...options.overridesEnumsRules
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2201
2467
|
}
|
|
2202
|
-
|
|
2468
|
+
if (enableSortTypes) {
|
|
2469
|
+
configs2.push({
|
|
2470
|
+
name: "ntnyq/perfectionist/types",
|
|
2471
|
+
files: [...GLOB_TYPES],
|
|
2472
|
+
plugins: {
|
|
2473
|
+
perfectionist: default19
|
|
2474
|
+
},
|
|
2475
|
+
rules: {
|
|
2476
|
+
"perfectionist/sort-heritage-clauses": [
|
|
2477
|
+
"error",
|
|
2478
|
+
{
|
|
2479
|
+
type: "alphabetical",
|
|
2480
|
+
order: "asc"
|
|
2481
|
+
}
|
|
2482
|
+
],
|
|
2483
|
+
// 'perfectionist/sort-interfaces': [
|
|
2484
|
+
// 'error',
|
|
2485
|
+
// {
|
|
2486
|
+
// type: 'alphabetical',
|
|
2487
|
+
// order: 'asc',
|
|
2488
|
+
// },
|
|
2489
|
+
// ],
|
|
2490
|
+
"perfectionist/sort-intersection-types": [
|
|
2491
|
+
"error",
|
|
2492
|
+
{
|
|
2493
|
+
type: "alphabetical",
|
|
2494
|
+
order: "asc",
|
|
2495
|
+
groups: [
|
|
2496
|
+
"intersection",
|
|
2497
|
+
"named",
|
|
2498
|
+
"conditional",
|
|
2499
|
+
"function",
|
|
2500
|
+
"import",
|
|
2501
|
+
"keyword",
|
|
2502
|
+
"literal",
|
|
2503
|
+
"object",
|
|
2504
|
+
"operator",
|
|
2505
|
+
"tuple",
|
|
2506
|
+
"union",
|
|
2507
|
+
"nullish"
|
|
2508
|
+
]
|
|
2509
|
+
}
|
|
2510
|
+
],
|
|
2511
|
+
"perfectionist/sort-modules": [
|
|
2512
|
+
"error",
|
|
2513
|
+
{
|
|
2514
|
+
type: "line-length",
|
|
2515
|
+
order: "asc"
|
|
2516
|
+
}
|
|
2517
|
+
],
|
|
2518
|
+
"perfectionist/sort-object-types": [
|
|
2519
|
+
"error",
|
|
2520
|
+
{
|
|
2521
|
+
type: "alphabetical",
|
|
2522
|
+
order: "asc"
|
|
2523
|
+
}
|
|
2524
|
+
],
|
|
2525
|
+
"perfectionist/sort-union-types": [
|
|
2526
|
+
"error",
|
|
2527
|
+
{
|
|
2528
|
+
type: "line-length",
|
|
2529
|
+
order: "asc"
|
|
2530
|
+
}
|
|
2531
|
+
],
|
|
2532
|
+
// Overrides rules
|
|
2533
|
+
...options.overridesTypesRules
|
|
2534
|
+
}
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
if (enableSortConstants) {
|
|
2538
|
+
configs2.push({
|
|
2539
|
+
name: "ntnyq/perfectionist/constants",
|
|
2540
|
+
files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
|
|
2541
|
+
plugins: {
|
|
2542
|
+
perfectionist: default19
|
|
2543
|
+
},
|
|
2544
|
+
rules: {
|
|
2545
|
+
"perfectionist/sort-maps": [
|
|
2546
|
+
"error",
|
|
2547
|
+
{
|
|
2548
|
+
type: "alphabetical",
|
|
2549
|
+
order: "asc"
|
|
2550
|
+
}
|
|
2551
|
+
],
|
|
2552
|
+
"perfectionist/sort-objects": [
|
|
2553
|
+
"error",
|
|
2554
|
+
{
|
|
2555
|
+
type: "line-length",
|
|
2556
|
+
order: "asc"
|
|
2557
|
+
}
|
|
2558
|
+
],
|
|
2559
|
+
"perfectionist/sort-sets": [
|
|
2560
|
+
"error",
|
|
2561
|
+
{
|
|
2562
|
+
type: "line-length",
|
|
2563
|
+
order: "asc"
|
|
2564
|
+
}
|
|
2565
|
+
],
|
|
2566
|
+
// Overrides rules
|
|
2567
|
+
...options.overridesConstantsRules
|
|
2568
|
+
}
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
return configs2;
|
|
2572
|
+
};
|
|
2203
2573
|
|
|
2204
2574
|
// src/configs/unusedImports.ts
|
|
2205
2575
|
var unusedImports = (options = {}) => [
|
|
@@ -2231,16 +2601,37 @@ var unusedImports = (options = {}) => [
|
|
|
2231
2601
|
];
|
|
2232
2602
|
|
|
2233
2603
|
// src/core.ts
|
|
2234
|
-
|
|
2235
|
-
const configs2 = [];
|
|
2604
|
+
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2236
2605
|
const {
|
|
2237
|
-
|
|
2238
|
-
|
|
2606
|
+
/**
|
|
2607
|
+
* Shared options
|
|
2608
|
+
*/
|
|
2609
|
+
extensions: supportedExtensions = [],
|
|
2610
|
+
/**
|
|
2611
|
+
* Conditional by deps
|
|
2612
|
+
*/
|
|
2239
2613
|
vue: enableVue = hasVue,
|
|
2614
|
+
test: enableTest = hasVitest,
|
|
2240
2615
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
2241
2616
|
typescript: enableTypeScript = hasTypeScript,
|
|
2242
|
-
|
|
2617
|
+
/**
|
|
2618
|
+
* Enabled by default
|
|
2619
|
+
*/
|
|
2620
|
+
yml: enableYML = true,
|
|
2621
|
+
sort: enableSort = true,
|
|
2622
|
+
toml: enableTOML = true,
|
|
2623
|
+
jsonc: enableJSONC = true,
|
|
2624
|
+
antfu: enableAntfu = true,
|
|
2625
|
+
regexp: enableRegexp = true,
|
|
2626
|
+
unicorn: enableUnicorn = true,
|
|
2627
|
+
prettier: enablePrettier = true,
|
|
2628
|
+
markdown: enableMarkdown = true,
|
|
2629
|
+
stylistic: enableStylistic = true,
|
|
2630
|
+
gitignore: enableGitIgnore = true,
|
|
2631
|
+
githubAction: enableGitHubAction = true,
|
|
2632
|
+
perfectionist: enablePerfectionist = true
|
|
2243
2633
|
} = options;
|
|
2634
|
+
const configs2 = [];
|
|
2244
2635
|
if (enableVue) {
|
|
2245
2636
|
supportedExtensions.push("vue");
|
|
2246
2637
|
}
|
|
@@ -2264,6 +2655,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2264
2655
|
overrides: getOverrides(options, "imports")
|
|
2265
2656
|
}),
|
|
2266
2657
|
...jsdoc({
|
|
2658
|
+
typescript: !!enableTypeScript,
|
|
2267
2659
|
overrides: getOverrides(options, "jsdoc")
|
|
2268
2660
|
}),
|
|
2269
2661
|
...comments({
|
|
@@ -2274,7 +2666,7 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2274
2666
|
overrides: getOverrides(options, "javascript")
|
|
2275
2667
|
})
|
|
2276
2668
|
);
|
|
2277
|
-
if (
|
|
2669
|
+
if (enablePerfectionist) {
|
|
2278
2670
|
configs2.push(
|
|
2279
2671
|
...perfectionist({
|
|
2280
2672
|
...resolveSubOptions(options, "perfectionist"),
|
|
@@ -2282,14 +2674,14 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2282
2674
|
})
|
|
2283
2675
|
);
|
|
2284
2676
|
}
|
|
2285
|
-
if (
|
|
2677
|
+
if (enableUnicorn) {
|
|
2286
2678
|
configs2.push(
|
|
2287
2679
|
...unicorn({
|
|
2288
2680
|
overrides: getOverrides(options, "unicorn")
|
|
2289
2681
|
})
|
|
2290
2682
|
);
|
|
2291
2683
|
}
|
|
2292
|
-
if (
|
|
2684
|
+
if (enableRegexp) {
|
|
2293
2685
|
configs2.push(
|
|
2294
2686
|
...regexp({
|
|
2295
2687
|
...resolveSubOptions(options, "regexp"),
|
|
@@ -2315,35 +2707,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2315
2707
|
})
|
|
2316
2708
|
);
|
|
2317
2709
|
}
|
|
2318
|
-
if (
|
|
2710
|
+
if (enableYML) {
|
|
2319
2711
|
configs2.push(
|
|
2320
2712
|
...yml({
|
|
2321
2713
|
overrides: getOverrides(options, "yml")
|
|
2322
2714
|
})
|
|
2323
2715
|
);
|
|
2324
2716
|
}
|
|
2325
|
-
if (
|
|
2717
|
+
if (enableTOML) {
|
|
2326
2718
|
configs2.push(
|
|
2327
2719
|
...toml({
|
|
2328
2720
|
overrides: getOverrides(options, "toml")
|
|
2329
2721
|
})
|
|
2330
2722
|
);
|
|
2331
2723
|
}
|
|
2332
|
-
if (
|
|
2724
|
+
if (enableJSONC) {
|
|
2333
2725
|
configs2.push(
|
|
2334
2726
|
...jsonc({
|
|
2335
2727
|
overrides: getOverrides(options, "jsonc")
|
|
2336
2728
|
})
|
|
2337
2729
|
);
|
|
2338
2730
|
}
|
|
2339
|
-
if (
|
|
2731
|
+
if (enableSort) {
|
|
2340
2732
|
configs2.push(
|
|
2341
2733
|
...sort({
|
|
2342
2734
|
...resolveSubOptions(options, "sort")
|
|
2343
2735
|
})
|
|
2344
2736
|
);
|
|
2345
2737
|
}
|
|
2346
|
-
if (
|
|
2738
|
+
if (enableTest) {
|
|
2347
2739
|
configs2.push(
|
|
2348
2740
|
...test({
|
|
2349
2741
|
overrides: getOverrides(options, "test")
|
|
@@ -2368,34 +2760,35 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2368
2760
|
})
|
|
2369
2761
|
);
|
|
2370
2762
|
}
|
|
2371
|
-
if (
|
|
2763
|
+
if (enableAntfu) {
|
|
2372
2764
|
configs2.push(
|
|
2373
2765
|
...antfu({
|
|
2374
2766
|
overrides: getOverrides(options, "antfu")
|
|
2375
2767
|
})
|
|
2376
2768
|
);
|
|
2377
2769
|
}
|
|
2378
|
-
if (
|
|
2770
|
+
if (enableStylistic) {
|
|
2379
2771
|
configs2.push(
|
|
2380
2772
|
...stylistic({
|
|
2381
2773
|
overrides: getOverrides(options, "stylistic")
|
|
2382
2774
|
})
|
|
2383
2775
|
);
|
|
2384
2776
|
}
|
|
2385
|
-
if (
|
|
2777
|
+
if (enableGitHubAction) {
|
|
2386
2778
|
configs2.push(
|
|
2387
2779
|
...githubAction({
|
|
2388
2780
|
overrides: getOverrides(options, "githubAction")
|
|
2389
2781
|
})
|
|
2390
2782
|
);
|
|
2391
2783
|
}
|
|
2392
|
-
const configSpecials = specials(
|
|
2393
|
-
|
|
2784
|
+
const configSpecials = specials({
|
|
2785
|
+
...resolveSubOptions(options, "specials")
|
|
2786
|
+
});
|
|
2787
|
+
const configPrettier = enablePrettier ? prettier({
|
|
2394
2788
|
...resolveSubOptions(options, "prettier"),
|
|
2395
2789
|
overrides: getOverrides(options, "prettier")
|
|
2396
2790
|
}) : [];
|
|
2397
|
-
const composer = new FlatConfigComposer(
|
|
2398
|
-
await composer.append(
|
|
2791
|
+
const composer = new FlatConfigComposer(
|
|
2399
2792
|
...configs2,
|
|
2400
2793
|
...userConfigs,
|
|
2401
2794
|
...configSpecials,
|
|
@@ -2435,6 +2828,7 @@ export {
|
|
|
2435
2828
|
GLOB_TOML,
|
|
2436
2829
|
GLOB_TS,
|
|
2437
2830
|
GLOB_TSX,
|
|
2831
|
+
GLOB_TYPES,
|
|
2438
2832
|
GLOB_VUE,
|
|
2439
2833
|
GLOB_YAML,
|
|
2440
2834
|
antfu,
|