@ghettoddos/eslint-config 1.6.2 → 1.8.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 +3 -3
- package/dist/index.d.ts +3897 -1718
- package/dist/index.js +331 -129
- package/package.json +51 -32
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
|
2
2
|
import { isPackageExists } from "local-pkg";
|
|
3
3
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
4
4
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
5
|
-
import
|
|
5
|
+
import pluginImportLite from "eslint-plugin-import-lite";
|
|
6
6
|
import pluginNode from "eslint-plugin-n";
|
|
7
7
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
8
8
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
@@ -45,6 +45,7 @@ const GLOB_JSON5 = "**/*.json5";
|
|
|
45
45
|
const GLOB_JSONC = "**/*.jsonc";
|
|
46
46
|
const GLOB_MARKDOWN = "**/*.md";
|
|
47
47
|
const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
48
|
+
const GLOB_VUE = "**/*.vue";
|
|
48
49
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
49
50
|
const GLOB_TOML = "**/*.toml";
|
|
50
51
|
const GLOB_XML = "**/*.xml";
|
|
@@ -113,7 +114,6 @@ async function disables() {
|
|
|
113
114
|
name: "disables/dts",
|
|
114
115
|
rules: {
|
|
115
116
|
"eslint-comments/no-unlimited-disable": "off",
|
|
116
|
-
"import/no-duplicates": "off",
|
|
117
117
|
"no-restricted-syntax": "off",
|
|
118
118
|
"unused-imports/no-unused-vars": "off"
|
|
119
119
|
}
|
|
@@ -137,6 +137,13 @@ const ReactRouterPackages = [
|
|
|
137
137
|
"@react-router/dev"
|
|
138
138
|
];
|
|
139
139
|
const NextJsPackages = ["next"];
|
|
140
|
+
const VuePackages = [
|
|
141
|
+
"vue",
|
|
142
|
+
"nuxt",
|
|
143
|
+
"vitepress",
|
|
144
|
+
"@slidev/cli"
|
|
145
|
+
];
|
|
146
|
+
const ReactNativePackages = ["react-native", "expo"];
|
|
140
147
|
|
|
141
148
|
//#endregion
|
|
142
149
|
//#region src/utils.ts
|
|
@@ -414,115 +421,6 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
414
421
|
return configs$1;
|
|
415
422
|
}
|
|
416
423
|
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region src/configs/fsd.ts
|
|
419
|
-
const FS_LAYERS = [
|
|
420
|
-
"app",
|
|
421
|
-
"processes",
|
|
422
|
-
"pages",
|
|
423
|
-
"widgets",
|
|
424
|
-
"features",
|
|
425
|
-
"entities",
|
|
426
|
-
"shared"
|
|
427
|
-
];
|
|
428
|
-
const FS_SEGMENTS = [
|
|
429
|
-
"ui",
|
|
430
|
-
"model",
|
|
431
|
-
"lib",
|
|
432
|
-
"api",
|
|
433
|
-
"config",
|
|
434
|
-
"assets"
|
|
435
|
-
];
|
|
436
|
-
function getLowerLayers(layer) {
|
|
437
|
-
return FS_LAYERS.slice(FS_LAYERS.indexOf(layer) + 1);
|
|
438
|
-
}
|
|
439
|
-
function getUpperLayers(layer) {
|
|
440
|
-
return FS_LAYERS.slice(0, FS_LAYERS.indexOf(layer));
|
|
441
|
-
}
|
|
442
|
-
const FS_SLICED_LAYERS_REG = getUpperLayers("shared").join("|");
|
|
443
|
-
const FS_SEGMENTS_REG = [...FS_SEGMENTS, ...FS_SEGMENTS.map((seg) => `${seg}.*`)].join("|");
|
|
444
|
-
function getNotSharedLayersRules() {
|
|
445
|
-
return getUpperLayers("shared").map((layer) => ({
|
|
446
|
-
allow: getLowerLayers(layer),
|
|
447
|
-
from: layer
|
|
448
|
-
}));
|
|
449
|
-
}
|
|
450
|
-
const slicelessLayerRules = [{
|
|
451
|
-
allow: "shared",
|
|
452
|
-
from: "shared"
|
|
453
|
-
}, {
|
|
454
|
-
allow: "app",
|
|
455
|
-
from: "app"
|
|
456
|
-
}];
|
|
457
|
-
function getLayersBoundariesElements() {
|
|
458
|
-
return FS_LAYERS.map((layer) => ({
|
|
459
|
-
capture: ["slices"],
|
|
460
|
-
mode: "folder",
|
|
461
|
-
pattern: `${layer}/!(_*){,/*}`,
|
|
462
|
-
type: layer
|
|
463
|
-
}));
|
|
464
|
-
}
|
|
465
|
-
function getGodModeRules() {
|
|
466
|
-
return FS_LAYERS.map((layer) => ({
|
|
467
|
-
allow: [layer, ...getLowerLayers(layer)],
|
|
468
|
-
from: `gm_${layer}`
|
|
469
|
-
}));
|
|
470
|
-
}
|
|
471
|
-
function getGodModeElements() {
|
|
472
|
-
return FS_LAYERS.map((layer) => ({
|
|
473
|
-
capture: ["slices"],
|
|
474
|
-
mode: "folder",
|
|
475
|
-
pattern: `${layer}/_*`,
|
|
476
|
-
type: `gm_${layer}`
|
|
477
|
-
}));
|
|
478
|
-
}
|
|
479
|
-
async function fsd(options = {}) {
|
|
480
|
-
const { layersSlices: enableLayersSlices = true, publicApi: enablePublicApi = true } = options;
|
|
481
|
-
const configs$1 = [];
|
|
482
|
-
if (enablePublicApi) {
|
|
483
|
-
const { lite = true } = resolveSubOptions(options, "publicApi");
|
|
484
|
-
configs$1.push({
|
|
485
|
-
name: "fsd/public-api",
|
|
486
|
-
rules: {
|
|
487
|
-
"import/no-internal-modules": ["error", { allow: [
|
|
488
|
-
`**/*(${FS_SLICED_LAYERS_REG})/!(${FS_SEGMENTS_REG})`,
|
|
489
|
-
`**/*(${FS_SLICED_LAYERS_REG})/!(${FS_SEGMENTS_REG})/!(${FS_SEGMENTS_REG})`,
|
|
490
|
-
`**/*shared/*(${FS_SEGMENTS_REG})/!(${FS_SEGMENTS_REG})`,
|
|
491
|
-
`**/*shared/*(${FS_SEGMENTS_REG})`,
|
|
492
|
-
`**/node_modules/**`,
|
|
493
|
-
`**/*shared/_*`,
|
|
494
|
-
`**/*shared/_*/*`,
|
|
495
|
-
...lite ? [`./**`] : []
|
|
496
|
-
] }],
|
|
497
|
-
...getOverrides(options, "publicApi")
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
if (enableLayersSlices) {
|
|
502
|
-
await ensurePackages(["eslint-plugin-boundaries"]);
|
|
503
|
-
const [pluginBoundaries] = await Promise.all([interopDefault(import("eslint-plugin-boundaries"))]);
|
|
504
|
-
configs$1.push({
|
|
505
|
-
name: "fsd/layers-slices",
|
|
506
|
-
plugins: { boundaries: pluginBoundaries },
|
|
507
|
-
rules: {
|
|
508
|
-
...pluginBoundaries.configs.recommended.rules,
|
|
509
|
-
"boundaries/element-types": [2, {
|
|
510
|
-
default: "disallow",
|
|
511
|
-
message: "\"${file.type}\" is not allowed to import \"${dependency.type}\" | See rules: https://feature-sliced.design/docs/reference/layers/overview ",
|
|
512
|
-
rules: [
|
|
513
|
-
...getNotSharedLayersRules(),
|
|
514
|
-
...slicelessLayerRules,
|
|
515
|
-
...getGodModeRules()
|
|
516
|
-
]
|
|
517
|
-
}],
|
|
518
|
-
...getOverrides(options, "layersSlices")
|
|
519
|
-
},
|
|
520
|
-
settings: { "boundaries/elements": [...getLayersBoundariesElements(), ...getGodModeElements()] }
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
return configs$1;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
424
|
//#endregion
|
|
527
425
|
//#region src/configs/ignores.ts
|
|
528
426
|
async function ignores(userIgnores = []) {
|
|
@@ -535,25 +433,24 @@ async function ignores(userIgnores = []) {
|
|
|
535
433
|
//#endregion
|
|
536
434
|
//#region src/configs/imports.ts
|
|
537
435
|
async function imports(options = {}) {
|
|
538
|
-
const { stylistic: stylistic$1 = true } = options;
|
|
436
|
+
const { overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
539
437
|
return [{
|
|
540
438
|
name: "imports/rules",
|
|
541
439
|
plugins: {
|
|
542
440
|
antfu: pluginAntfu,
|
|
543
|
-
import:
|
|
441
|
+
import: pluginImportLite
|
|
544
442
|
},
|
|
545
443
|
rules: {
|
|
546
444
|
"antfu/import-dedupe": "error",
|
|
547
445
|
"antfu/no-import-dist": "error",
|
|
548
446
|
"antfu/no-import-node-modules-by-path": "error",
|
|
549
|
-
"import/consistent-type-specifier-style": ["error", "
|
|
447
|
+
"import/consistent-type-specifier-style": ["error", "top-level"],
|
|
550
448
|
"import/first": "error",
|
|
551
449
|
"import/no-duplicates": "error",
|
|
552
450
|
"import/no-mutable-exports": "error",
|
|
553
451
|
"import/no-named-default": "error",
|
|
554
|
-
"import/
|
|
555
|
-
|
|
556
|
-
...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {}
|
|
452
|
+
...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
453
|
+
...overrides
|
|
557
454
|
}
|
|
558
455
|
}];
|
|
559
456
|
}
|
|
@@ -841,7 +738,7 @@ async function jsonc(options = {}) {
|
|
|
841
738
|
multiline: true
|
|
842
739
|
}],
|
|
843
740
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
844
|
-
"jsonc/object-property-newline": ["error", {
|
|
741
|
+
"jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
845
742
|
"jsonc/quote-props": "error",
|
|
846
743
|
"jsonc/quotes": "error"
|
|
847
744
|
} : {},
|
|
@@ -912,7 +809,6 @@ async function markdown(options = {}) {
|
|
|
912
809
|
name: "markdown/disables",
|
|
913
810
|
rules: {
|
|
914
811
|
"antfu/no-top-level-await": "off",
|
|
915
|
-
"import/newline-after-import": "off",
|
|
916
812
|
"no-alert": "off",
|
|
917
813
|
"no-console": "off",
|
|
918
814
|
"no-labels": "off",
|
|
@@ -925,6 +821,7 @@ async function markdown(options = {}) {
|
|
|
925
821
|
"node/prefer-global/process": "off",
|
|
926
822
|
"style/comma-dangle": "off",
|
|
927
823
|
"style/eol-last": "off",
|
|
824
|
+
"style/padding-line-between-statements": "off",
|
|
928
825
|
"ts/consistent-type-imports": "off",
|
|
929
826
|
"ts/explicit-function-return-type": "off",
|
|
930
827
|
"ts/no-namespace": "off",
|
|
@@ -945,12 +842,19 @@ async function markdown(options = {}) {
|
|
|
945
842
|
//#endregion
|
|
946
843
|
//#region src/configs/next.ts
|
|
947
844
|
async function next(options = {}) {
|
|
948
|
-
const { overrides = {} } = options;
|
|
845
|
+
const { files = [GLOB_SRC], overrides = {} } = options;
|
|
949
846
|
await ensurePackages(["@next/eslint-plugin-next"]);
|
|
950
|
-
const
|
|
847
|
+
const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
|
|
951
848
|
return [{
|
|
849
|
+
name: "next/setup",
|
|
850
|
+
plugins: { next: pluginNextJS }
|
|
851
|
+
}, {
|
|
852
|
+
files,
|
|
853
|
+
languageOptions: {
|
|
854
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
855
|
+
sourceType: "module"
|
|
856
|
+
},
|
|
952
857
|
name: "next/rules",
|
|
953
|
-
plugins: { next: pluginNext },
|
|
954
858
|
rules: {
|
|
955
859
|
"next/google-font-display": "warn",
|
|
956
860
|
"next/google-font-preconnect": "warn",
|
|
@@ -974,7 +878,8 @@ async function next(options = {}) {
|
|
|
974
878
|
"next/no-typos": "warn",
|
|
975
879
|
"next/no-unwanted-polyfillio": "warn",
|
|
976
880
|
...overrides
|
|
977
|
-
}
|
|
881
|
+
},
|
|
882
|
+
settings: { react: { version: "detect" } }
|
|
978
883
|
}];
|
|
979
884
|
}
|
|
980
885
|
|
|
@@ -1154,6 +1059,10 @@ async function react(options = {}) {
|
|
|
1154
1059
|
"react/no-unused-state": "warn",
|
|
1155
1060
|
"react/no-use-context": "warn",
|
|
1156
1061
|
"react/no-useless-forward-ref": "warn",
|
|
1062
|
+
"react/prefer-shorthand-boolean": "warn",
|
|
1063
|
+
"react/prefer-destructuring-assignment": "warn",
|
|
1064
|
+
"react/no-missing-context-display-name": "warn",
|
|
1065
|
+
"react/no-missing-component-display-name": "warn",
|
|
1157
1066
|
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1158
1067
|
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1159
1068
|
"react-dom/no-find-dom-node": "error",
|
|
@@ -1178,6 +1087,8 @@ async function react(options = {}) {
|
|
|
1178
1087
|
"react-web-api/no-leaked-interval": "warn",
|
|
1179
1088
|
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1180
1089
|
"react-web-api/no-leaked-timeout": "warn",
|
|
1090
|
+
"react-naming-convention/context-name": "warn",
|
|
1091
|
+
"react-naming-convention/use-state": "warn",
|
|
1181
1092
|
"react-refresh/only-export-components": ["warn", {
|
|
1182
1093
|
allowConstantExport: isAllowConstantExport,
|
|
1183
1094
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1199,7 +1110,11 @@ async function react(options = {}) {
|
|
|
1199
1110
|
"links",
|
|
1200
1111
|
"headers",
|
|
1201
1112
|
"loader",
|
|
1202
|
-
"action"
|
|
1113
|
+
"action",
|
|
1114
|
+
"clientLoader",
|
|
1115
|
+
"clientAction",
|
|
1116
|
+
"handle",
|
|
1117
|
+
"shouldRevalidate"
|
|
1203
1118
|
] : []]
|
|
1204
1119
|
}],
|
|
1205
1120
|
...overrides
|
|
@@ -1214,6 +1129,73 @@ async function react(options = {}) {
|
|
|
1214
1129
|
];
|
|
1215
1130
|
}
|
|
1216
1131
|
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region src/configs/react-native.ts
|
|
1134
|
+
async function reactNative(options = {}) {
|
|
1135
|
+
const { expo = isPackageExists("expo"), files = [GLOB_SRC], overrides = {} } = options;
|
|
1136
|
+
await ensurePackages([
|
|
1137
|
+
"@react-native/eslint-plugin",
|
|
1138
|
+
"eslint-plugin-react-native",
|
|
1139
|
+
...expo ? ["eslint-plugin-expo"] : []
|
|
1140
|
+
]);
|
|
1141
|
+
const [pluginReactNative, pluginReactNativeCommunity, pluginExpo] = await Promise.all([
|
|
1142
|
+
interopDefault(import("@react-native/eslint-plugin")),
|
|
1143
|
+
interopDefault(import("eslint-plugin-react-native")),
|
|
1144
|
+
...expo ? [interopDefault(import("eslint-plugin-expo"))] : []
|
|
1145
|
+
]);
|
|
1146
|
+
return [{
|
|
1147
|
+
name: "react-native/setup",
|
|
1148
|
+
plugins: {
|
|
1149
|
+
"react-native": pluginReactNative,
|
|
1150
|
+
"react-native-community": pluginReactNativeCommunity,
|
|
1151
|
+
...expo ? { expo: pluginExpo } : {}
|
|
1152
|
+
}
|
|
1153
|
+
}, {
|
|
1154
|
+
files,
|
|
1155
|
+
languageOptions: {
|
|
1156
|
+
globals: {
|
|
1157
|
+
"__DEV__": "readonly",
|
|
1158
|
+
"__fbBatchedBridgeConfig": false,
|
|
1159
|
+
"Blob": true,
|
|
1160
|
+
"clearImmediate": true,
|
|
1161
|
+
"document": false,
|
|
1162
|
+
"ErrorUtils": false,
|
|
1163
|
+
"exports": false,
|
|
1164
|
+
"File": true,
|
|
1165
|
+
"Map": true,
|
|
1166
|
+
"navigator": false,
|
|
1167
|
+
"Promise": true,
|
|
1168
|
+
"queueMicrotask": true,
|
|
1169
|
+
"requestAnimationFrame": true,
|
|
1170
|
+
"requestIdleCallback": true,
|
|
1171
|
+
"Set": true,
|
|
1172
|
+
"setImmediate": true,
|
|
1173
|
+
"shared-node-browser": true,
|
|
1174
|
+
"WebSocket": true,
|
|
1175
|
+
"window": false
|
|
1176
|
+
},
|
|
1177
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
1178
|
+
sourceType: "module"
|
|
1179
|
+
},
|
|
1180
|
+
name: "react-native/rules",
|
|
1181
|
+
rules: {
|
|
1182
|
+
"react-native-community/no-inline-styles": "warn",
|
|
1183
|
+
"react-native-community/no-single-element-style-arrays": "warn",
|
|
1184
|
+
"react-native-community/no-unused-styles": "warn",
|
|
1185
|
+
"react-native/no-deep-imports": "error",
|
|
1186
|
+
"react-native/no-raw-text": "warn",
|
|
1187
|
+
...expo ? {
|
|
1188
|
+
"expo/no-dynamic-env-var": "error",
|
|
1189
|
+
"expo/no-env-var-destructuring": "error",
|
|
1190
|
+
"expo/prefer-box-shadow": "warn",
|
|
1191
|
+
"expo/use-dom-exports": "error"
|
|
1192
|
+
} : {},
|
|
1193
|
+
...overrides
|
|
1194
|
+
},
|
|
1195
|
+
settings: { react: { version: "detect" } }
|
|
1196
|
+
}];
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1217
1199
|
//#endregion
|
|
1218
1200
|
//#region src/configs/regexp.ts
|
|
1219
1201
|
async function regexp(options = {}) {
|
|
@@ -1343,7 +1325,7 @@ async function sortPackageJson() {
|
|
|
1343
1325
|
*/
|
|
1344
1326
|
function sortTsconfig() {
|
|
1345
1327
|
return [{
|
|
1346
|
-
files: ["**/
|
|
1328
|
+
files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
|
|
1347
1329
|
name: "sort/tsconfig-json",
|
|
1348
1330
|
rules: { "jsonc/sort-keys": [
|
|
1349
1331
|
"error",
|
|
@@ -1680,6 +1662,212 @@ async function unocss(options = {}) {
|
|
|
1680
1662
|
}];
|
|
1681
1663
|
}
|
|
1682
1664
|
|
|
1665
|
+
//#endregion
|
|
1666
|
+
//#region src/configs/vue.ts
|
|
1667
|
+
async function vue(options = {}) {
|
|
1668
|
+
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true, vueVersion = 3 } = options;
|
|
1669
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1670
|
+
const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1671
|
+
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
1672
|
+
const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
|
|
1673
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1674
|
+
interopDefault(import("vue-eslint-parser")),
|
|
1675
|
+
interopDefault(import("eslint-processor-vue-blocks")),
|
|
1676
|
+
...a11y ? [interopDefault(import("eslint-plugin-vuejs-accessibility"))] : []
|
|
1677
|
+
]);
|
|
1678
|
+
return [{
|
|
1679
|
+
languageOptions: { globals: {
|
|
1680
|
+
computed: "readonly",
|
|
1681
|
+
defineEmits: "readonly",
|
|
1682
|
+
defineExpose: "readonly",
|
|
1683
|
+
defineProps: "readonly",
|
|
1684
|
+
onMounted: "readonly",
|
|
1685
|
+
onUnmounted: "readonly",
|
|
1686
|
+
reactive: "readonly",
|
|
1687
|
+
ref: "readonly",
|
|
1688
|
+
shallowReactive: "readonly",
|
|
1689
|
+
shallowRef: "readonly",
|
|
1690
|
+
toRef: "readonly",
|
|
1691
|
+
toRefs: "readonly",
|
|
1692
|
+
watch: "readonly",
|
|
1693
|
+
watchEffect: "readonly"
|
|
1694
|
+
} },
|
|
1695
|
+
name: "vue/setup",
|
|
1696
|
+
plugins: {
|
|
1697
|
+
vue: pluginVue,
|
|
1698
|
+
...a11y ? { "vue-a11y": pluginVueA11y } : {}
|
|
1699
|
+
}
|
|
1700
|
+
}, {
|
|
1701
|
+
files,
|
|
1702
|
+
languageOptions: {
|
|
1703
|
+
parser: parserVue,
|
|
1704
|
+
parserOptions: {
|
|
1705
|
+
ecmaFeatures: { jsx: true },
|
|
1706
|
+
extraFileExtensions: [".vue"],
|
|
1707
|
+
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
1708
|
+
sourceType: "module"
|
|
1709
|
+
}
|
|
1710
|
+
},
|
|
1711
|
+
name: "vue/rules",
|
|
1712
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([pluginVue.processors[".vue"], processorVueBlocks({
|
|
1713
|
+
...sfcBlocks,
|
|
1714
|
+
blocks: {
|
|
1715
|
+
styles: true,
|
|
1716
|
+
...sfcBlocks.blocks
|
|
1717
|
+
}
|
|
1718
|
+
})]),
|
|
1719
|
+
rules: {
|
|
1720
|
+
...pluginVue.configs.base.rules,
|
|
1721
|
+
...vueVersion === 2 ? {
|
|
1722
|
+
...pluginVue.configs["vue2-essential"].rules,
|
|
1723
|
+
...pluginVue.configs["vue2-strongly-recommended"].rules,
|
|
1724
|
+
...pluginVue.configs["vue2-recommended"].rules
|
|
1725
|
+
} : {
|
|
1726
|
+
...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1727
|
+
...acc,
|
|
1728
|
+
...c
|
|
1729
|
+
}), {}),
|
|
1730
|
+
...pluginVue.configs["flat/strongly-recommended"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1731
|
+
...acc,
|
|
1732
|
+
...c
|
|
1733
|
+
}), {}),
|
|
1734
|
+
...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1735
|
+
...acc,
|
|
1736
|
+
...c
|
|
1737
|
+
}), {})
|
|
1738
|
+
},
|
|
1739
|
+
"antfu/no-top-level-await": "off",
|
|
1740
|
+
"node/prefer-global/process": "off",
|
|
1741
|
+
"ts/explicit-function-return-type": "off",
|
|
1742
|
+
"vue/block-order": ["error", { order: [
|
|
1743
|
+
"script",
|
|
1744
|
+
"template",
|
|
1745
|
+
"style"
|
|
1746
|
+
] }],
|
|
1747
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1748
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1749
|
+
"vue/component-tags-order": "off",
|
|
1750
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1751
|
+
"vue/define-macros-order": ["error", { order: [
|
|
1752
|
+
"defineOptions",
|
|
1753
|
+
"defineProps",
|
|
1754
|
+
"defineEmits",
|
|
1755
|
+
"defineSlots"
|
|
1756
|
+
] }],
|
|
1757
|
+
"vue/dot-location": ["error", "property"],
|
|
1758
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1759
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1760
|
+
"vue/html-indent": ["error", indent],
|
|
1761
|
+
"vue/html-quotes": ["error", "double"],
|
|
1762
|
+
"vue/max-attributes-per-line": "off",
|
|
1763
|
+
"vue/multi-word-component-names": "off",
|
|
1764
|
+
"vue/no-dupe-keys": "off",
|
|
1765
|
+
"vue/no-empty-pattern": "error",
|
|
1766
|
+
"vue/no-irregular-whitespace": "error",
|
|
1767
|
+
"vue/no-loss-of-precision": "error",
|
|
1768
|
+
"vue/no-restricted-syntax": [
|
|
1769
|
+
"error",
|
|
1770
|
+
"DebuggerStatement",
|
|
1771
|
+
"LabeledStatement",
|
|
1772
|
+
"WithStatement"
|
|
1773
|
+
],
|
|
1774
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1775
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1776
|
+
"vue/no-sparse-arrays": "error",
|
|
1777
|
+
"vue/no-unused-refs": "error",
|
|
1778
|
+
"vue/no-useless-v-bind": "error",
|
|
1779
|
+
"vue/no-v-html": "off",
|
|
1780
|
+
"vue/object-shorthand": [
|
|
1781
|
+
"error",
|
|
1782
|
+
"always",
|
|
1783
|
+
{
|
|
1784
|
+
avoidQuotes: true,
|
|
1785
|
+
ignoreConstructors: false
|
|
1786
|
+
}
|
|
1787
|
+
],
|
|
1788
|
+
"vue/prefer-separate-static-class": "error",
|
|
1789
|
+
"vue/prefer-template": "error",
|
|
1790
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1791
|
+
"vue/require-default-prop": "off",
|
|
1792
|
+
"vue/require-prop-types": "off",
|
|
1793
|
+
"vue/space-infix-ops": "error",
|
|
1794
|
+
"vue/space-unary-ops": ["error", {
|
|
1795
|
+
nonwords: false,
|
|
1796
|
+
words: true
|
|
1797
|
+
}],
|
|
1798
|
+
...stylistic$1 ? {
|
|
1799
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1800
|
+
"vue/arrow-spacing": ["error", {
|
|
1801
|
+
after: true,
|
|
1802
|
+
before: true
|
|
1803
|
+
}],
|
|
1804
|
+
"vue/block-spacing": ["error", "always"],
|
|
1805
|
+
"vue/block-tag-newline": ["error", {
|
|
1806
|
+
multiline: "always",
|
|
1807
|
+
singleline: "always"
|
|
1808
|
+
}],
|
|
1809
|
+
"vue/brace-style": [
|
|
1810
|
+
"error",
|
|
1811
|
+
"stroustrup",
|
|
1812
|
+
{ allowSingleLine: true }
|
|
1813
|
+
],
|
|
1814
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1815
|
+
"vue/comma-spacing": ["error", {
|
|
1816
|
+
after: true,
|
|
1817
|
+
before: false
|
|
1818
|
+
}],
|
|
1819
|
+
"vue/comma-style": ["error", "last"],
|
|
1820
|
+
"vue/html-comment-content-spacing": [
|
|
1821
|
+
"error",
|
|
1822
|
+
"always",
|
|
1823
|
+
{ exceptions: ["-"] }
|
|
1824
|
+
],
|
|
1825
|
+
"vue/key-spacing": ["error", {
|
|
1826
|
+
afterColon: true,
|
|
1827
|
+
beforeColon: false
|
|
1828
|
+
}],
|
|
1829
|
+
"vue/keyword-spacing": ["error", {
|
|
1830
|
+
after: true,
|
|
1831
|
+
before: true
|
|
1832
|
+
}],
|
|
1833
|
+
"vue/object-curly-newline": "off",
|
|
1834
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1835
|
+
"vue/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
1836
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1837
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1838
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1839
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1840
|
+
"vue/template-curly-spacing": "error"
|
|
1841
|
+
} : {},
|
|
1842
|
+
...a11y ? {
|
|
1843
|
+
"vue-a11y/alt-text": "error",
|
|
1844
|
+
"vue-a11y/anchor-has-content": "error",
|
|
1845
|
+
"vue-a11y/aria-props": "error",
|
|
1846
|
+
"vue-a11y/aria-role": "error",
|
|
1847
|
+
"vue-a11y/aria-unsupported-elements": "error",
|
|
1848
|
+
"vue-a11y/click-events-have-key-events": "error",
|
|
1849
|
+
"vue-a11y/form-control-has-label": "error",
|
|
1850
|
+
"vue-a11y/heading-has-content": "error",
|
|
1851
|
+
"vue-a11y/iframe-has-title": "error",
|
|
1852
|
+
"vue-a11y/interactive-supports-focus": "error",
|
|
1853
|
+
"vue-a11y/label-has-for": "error",
|
|
1854
|
+
"vue-a11y/media-has-caption": "warn",
|
|
1855
|
+
"vue-a11y/mouse-events-have-key-events": "error",
|
|
1856
|
+
"vue-a11y/no-access-key": "error",
|
|
1857
|
+
"vue-a11y/no-aria-hidden-on-focusable": "error",
|
|
1858
|
+
"vue-a11y/no-autofocus": "warn",
|
|
1859
|
+
"vue-a11y/no-distracting-elements": "error",
|
|
1860
|
+
"vue-a11y/no-redundant-roles": "error",
|
|
1861
|
+
"vue-a11y/no-role-presentation-on-focusable": "error",
|
|
1862
|
+
"vue-a11y/no-static-element-interactions": "error",
|
|
1863
|
+
"vue-a11y/role-has-required-aria-props": "error",
|
|
1864
|
+
"vue-a11y/tabindex-no-positive": "warn"
|
|
1865
|
+
} : {},
|
|
1866
|
+
...overrides
|
|
1867
|
+
}
|
|
1868
|
+
}];
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1683
1871
|
//#endregion
|
|
1684
1872
|
//#region src/configs/yaml.ts
|
|
1685
1873
|
async function yaml(options = {}) {
|
|
@@ -1777,7 +1965,7 @@ const defaultPluginRenaming = {
|
|
|
1777
1965
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
1778
1966
|
"@stylistic": "style",
|
|
1779
1967
|
"@typescript-eslint": "ts",
|
|
1780
|
-
"import-
|
|
1968
|
+
"import-lite": "import",
|
|
1781
1969
|
"n": "node",
|
|
1782
1970
|
"yml": "yaml"
|
|
1783
1971
|
};
|
|
@@ -1793,7 +1981,7 @@ const defaultPluginRenaming = {
|
|
|
1793
1981
|
*/
|
|
1794
1982
|
function config(options = {}, ...userConfigs) {
|
|
1795
1983
|
const isUsingReact = ReactPackages.some((i) => isPackageExists(i));
|
|
1796
|
-
const { autoRenamePlugins = true, componentExts = [], effector: enableEffector = isPackageExists("effector"),
|
|
1984
|
+
const { autoRenamePlugins = true, componentExts = [], effector: enableEffector = isPackageExists("effector"), gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, jsxA11y: enableJsxA11y = isUsingReact, next: enableNext = NextJsPackages.some((i) => isPackageExists(i)), pnpm: enableCatalogs = false, react: enableReact = isUsingReact, reactNative: enableReactNative = ReactNativePackages.some((i) => isPackageExists(i)), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1797
1985
|
let isInEditor = options.isInEditor;
|
|
1798
1986
|
if (isInEditor == null) {
|
|
1799
1987
|
isInEditor = isInEditorEnv();
|
|
@@ -1816,7 +2004,12 @@ function config(options = {}, ...userConfigs) {
|
|
|
1816
2004
|
isInEditor,
|
|
1817
2005
|
overrides: getOverrides(options, "javascript")
|
|
1818
2006
|
}), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
|
|
2007
|
+
if (enableImports) configs$1.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
|
|
2008
|
+
stylistic: stylisticOptions,
|
|
2009
|
+
...enableImports
|
|
2010
|
+
}));
|
|
1819
2011
|
if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2012
|
+
if (enableVue) componentExts.push("vue");
|
|
1820
2013
|
if (enableJsx) configs$1.push(jsx());
|
|
1821
2014
|
if (enableTypeScript) configs$1.push(typescript({
|
|
1822
2015
|
...typescriptOptions,
|
|
@@ -1829,14 +2022,23 @@ function config(options = {}, ...userConfigs) {
|
|
|
1829
2022
|
overrides: getOverrides(options, "stylistic")
|
|
1830
2023
|
}));
|
|
1831
2024
|
if (enableRegexp) configs$1.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2025
|
+
if (enableVue) configs$1.push(vue({
|
|
2026
|
+
...resolveSubOptions(options, "vue"),
|
|
2027
|
+
overrides: getOverrides(options, "vue"),
|
|
2028
|
+
stylistic: stylisticOptions,
|
|
2029
|
+
typescript: !!enableTypeScript
|
|
2030
|
+
}));
|
|
1832
2031
|
if (enableReact) configs$1.push(react({
|
|
1833
2032
|
...typescriptOptions,
|
|
1834
2033
|
overrides: getOverrides(options, "react"),
|
|
1835
2034
|
tsconfigPath
|
|
1836
2035
|
}));
|
|
2036
|
+
if (enableReactNative) configs$1.push(reactNative({
|
|
2037
|
+
...resolveSubOptions(options, "reactNative"),
|
|
2038
|
+
overrides: getOverrides(options, "reactNative")
|
|
2039
|
+
}));
|
|
1837
2040
|
if (enableJsxA11y) configs$1.push(jsxA11y({ overrides: getOverrides(options, "jsxA11y") }));
|
|
1838
2041
|
if (enableNext) configs$1.push(next({ overrides: getOverrides(options, "next") }));
|
|
1839
|
-
if (enableFsd) configs$1.push(fsd({ ...resolveSubOptions(options, "fsd") }));
|
|
1840
2042
|
if (enableEffector) configs$1.push(effector({
|
|
1841
2043
|
...resolveSubOptions(options, "effector"),
|
|
1842
2044
|
overrides: getOverrides(options, "effector")
|
|
@@ -1882,4 +2084,4 @@ function config(options = {}, ...userConfigs) {
|
|
|
1882
2084
|
var src_default = config;
|
|
1883
2085
|
|
|
1884
2086
|
//#endregion
|
|
1885
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, config, src_default as default, defaultPluginRenaming, disables, effector, ensurePackages, formatters,
|
|
2087
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, config, src_default as default, defaultPluginRenaming, disables, effector, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsonc, jsx, jsxA11y, markdown, next, node, parserPlain, perfectionist, pnpm, react, reactNative, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, toml, typescript, unicorn, unocss, vue, yaml };
|