@isentinel/eslint-config 0.5.7 → 0.6.0-beta.1
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 +186 -168
- package/dist/index.d.cts +1754 -214
- package/dist/index.d.ts +1754 -214
- package/dist/index.js +213 -198
- package/package.json +28 -24
package/dist/index.cjs
CHANGED
|
@@ -33,16 +33,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// node_modules/.pnpm/tsup@8.
|
|
36
|
+
// node_modules/.pnpm/tsup@8.1.0_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"node_modules/.pnpm/tsup@8.
|
|
38
|
+
"node_modules/.pnpm/tsup@8.1.0_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
43
|
+
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/shared.js
|
|
44
44
|
var require_shared = __commonJS({
|
|
45
|
-
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
45
|
+
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/shared.js"(exports2, module2) {
|
|
46
46
|
"use strict";
|
|
47
47
|
init_cjs_shims();
|
|
48
48
|
function extractChunks(parentNode, isPartOfChunk) {
|
|
@@ -581,9 +581,9 @@ var require_shared = __commonJS({
|
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
|
|
584
|
-
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
584
|
+
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/imports.js
|
|
585
585
|
var require_imports = __commonJS({
|
|
586
|
-
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
586
|
+
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/imports.js"(exports2, module2) {
|
|
587
587
|
"use strict";
|
|
588
588
|
init_cjs_shims();
|
|
589
589
|
var shared = require_shared();
|
|
@@ -708,9 +708,9 @@ var require_imports = __commonJS({
|
|
|
708
708
|
}
|
|
709
709
|
});
|
|
710
710
|
|
|
711
|
-
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
711
|
+
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/exports.js
|
|
712
712
|
var require_exports = __commonJS({
|
|
713
|
-
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
713
|
+
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/exports.js"(exports2, module2) {
|
|
714
714
|
"use strict";
|
|
715
715
|
init_cjs_shims();
|
|
716
716
|
var shared = require_shared();
|
|
@@ -799,9 +799,9 @@ var require_exports = __commonJS({
|
|
|
799
799
|
}
|
|
800
800
|
});
|
|
801
801
|
|
|
802
|
-
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
802
|
+
// node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/index.js
|
|
803
803
|
var require_eslint_plugin_simple_import_sort = __commonJS({
|
|
804
|
-
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.
|
|
804
|
+
"node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.4.0/node_modules/eslint-plugin-simple-import-sort/index.js"(exports2, module2) {
|
|
805
805
|
"use strict";
|
|
806
806
|
init_cjs_shims();
|
|
807
807
|
var importsRule = require_imports();
|
|
@@ -858,10 +858,12 @@ __export(src_exports, {
|
|
|
858
858
|
jsdoc: () => jsdoc,
|
|
859
859
|
jsonc: () => jsonc,
|
|
860
860
|
markdown: () => markdown,
|
|
861
|
+
parserPlain: () => parserPlain,
|
|
861
862
|
perfectionist: () => perfectionist,
|
|
862
863
|
prettier: () => prettier,
|
|
863
864
|
promise: () => promise,
|
|
864
865
|
react: () => react,
|
|
866
|
+
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
865
867
|
renameRules: () => renameRules,
|
|
866
868
|
resolveSubOptions: () => resolveSubOptions,
|
|
867
869
|
roblox: () => roblox,
|
|
@@ -869,6 +871,7 @@ __export(src_exports, {
|
|
|
869
871
|
sonarjs: () => sonarjs,
|
|
870
872
|
sortPackageJson: () => sortPackageJson,
|
|
871
873
|
sortTsconfig: () => sortTsconfig,
|
|
874
|
+
spelling: () => spelling,
|
|
872
875
|
style: () => style,
|
|
873
876
|
stylistic: () => stylistic,
|
|
874
877
|
toArray: () => toArray,
|
|
@@ -885,14 +888,16 @@ init_cjs_shims();
|
|
|
885
888
|
|
|
886
889
|
// src/configs/comments.ts
|
|
887
890
|
init_cjs_shims();
|
|
891
|
+
var import_compat = require("@eslint/compat");
|
|
888
892
|
|
|
889
893
|
// src/plugins.ts
|
|
890
894
|
init_cjs_shims();
|
|
891
|
-
var import_eslint_plugin = __toESM(require("@
|
|
895
|
+
var import_eslint_plugin = __toESM(require("@cspell/eslint-plugin"), 1);
|
|
896
|
+
var import_eslint_plugin_comment_length = __toESM(require("@isentinel/eslint-plugin-comment-length"), 1);
|
|
897
|
+
var import_eslint_plugin2 = __toESM(require("@shopify/eslint-plugin"), 1);
|
|
892
898
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
893
899
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
894
900
|
var import_eslint_plugin_arrow_return_style = __toESM(require("eslint-plugin-arrow-return-style"), 1);
|
|
895
|
-
var import_eslint_plugin_comment_length = __toESM(require("eslint-plugin-comment-length"), 1);
|
|
896
901
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
897
902
|
var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
|
|
898
903
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
@@ -911,7 +916,7 @@ async function comments() {
|
|
|
911
916
|
{
|
|
912
917
|
name: "style:eslint-comments",
|
|
913
918
|
plugins: {
|
|
914
|
-
"comment-length": import_eslint_plugin_comment_length.default,
|
|
919
|
+
"comment-length": (0, import_compat.fixupPluginRules)(import_eslint_plugin_comment_length.default),
|
|
915
920
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
916
921
|
},
|
|
917
922
|
rules: {
|
|
@@ -934,9 +939,14 @@ async function comments() {
|
|
|
934
939
|
"eslint-comments/no-duplicate-disable": "error",
|
|
935
940
|
"eslint-comments/no-unlimited-disable": "error",
|
|
936
941
|
"eslint-comments/no-unused-enable": "error",
|
|
937
|
-
"eslint-comments/require-description":
|
|
938
|
-
|
|
939
|
-
|
|
942
|
+
"eslint-comments/require-description": [
|
|
943
|
+
"error",
|
|
944
|
+
{
|
|
945
|
+
ignore: ["eslint-enable"]
|
|
946
|
+
}
|
|
947
|
+
],
|
|
948
|
+
"no-inline-comments": "error",
|
|
949
|
+
"style/multiline-comment-style": ["error", "separate-lines"]
|
|
940
950
|
}
|
|
941
951
|
}
|
|
942
952
|
];
|
|
@@ -982,8 +992,6 @@ var GLOB_EXCLUDE = [
|
|
|
982
992
|
"**/tmp",
|
|
983
993
|
"**/.tmp",
|
|
984
994
|
"**/.history",
|
|
985
|
-
"**/.vitepress/cache",
|
|
986
|
-
"**/.nuxt",
|
|
987
995
|
"**/.next",
|
|
988
996
|
"**/.vercel",
|
|
989
997
|
"**/.changeset",
|
|
@@ -1007,6 +1015,28 @@ init_cjs_shims();
|
|
|
1007
1015
|
init_cjs_shims();
|
|
1008
1016
|
var import_local_pkg = require("local-pkg");
|
|
1009
1017
|
var import_node_process = __toESM(require("process"), 1);
|
|
1018
|
+
var parserPlain = {
|
|
1019
|
+
meta: {
|
|
1020
|
+
name: "parser-plain"
|
|
1021
|
+
},
|
|
1022
|
+
parseForESLint: (code) => {
|
|
1023
|
+
return {
|
|
1024
|
+
ast: {
|
|
1025
|
+
body: [],
|
|
1026
|
+
comments: [],
|
|
1027
|
+
loc: { end: code.length, start: 0 },
|
|
1028
|
+
range: [0, code.length],
|
|
1029
|
+
tokens: [],
|
|
1030
|
+
type: "Program"
|
|
1031
|
+
},
|
|
1032
|
+
scopeManager: null,
|
|
1033
|
+
services: { isPlain: true },
|
|
1034
|
+
visitorKeys: {
|
|
1035
|
+
Program: []
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1010
1040
|
async function combine(...configs) {
|
|
1011
1041
|
const resolved = await Promise.all(configs);
|
|
1012
1042
|
return resolved.flat();
|
|
@@ -1023,6 +1053,25 @@ function renameRules(rules, map) {
|
|
|
1023
1053
|
})
|
|
1024
1054
|
);
|
|
1025
1055
|
}
|
|
1056
|
+
function renamePluginInConfigs(configs, map) {
|
|
1057
|
+
return configs.map((index) => {
|
|
1058
|
+
const clone = { ...index };
|
|
1059
|
+
if (clone.rules) {
|
|
1060
|
+
clone.rules = renameRules(clone.rules, map);
|
|
1061
|
+
}
|
|
1062
|
+
if (clone.plugins) {
|
|
1063
|
+
clone.plugins = Object.fromEntries(
|
|
1064
|
+
Object.entries(clone.plugins).map(([key, value]) => {
|
|
1065
|
+
if (key in map) {
|
|
1066
|
+
return [map[key], value];
|
|
1067
|
+
}
|
|
1068
|
+
return [key, value];
|
|
1069
|
+
})
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
return clone;
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1026
1075
|
function toArray(value) {
|
|
1027
1076
|
return Array.isArray(value) ? value : [value];
|
|
1028
1077
|
}
|
|
@@ -1031,26 +1080,22 @@ async function interopDefault(dynamicImport) {
|
|
|
1031
1080
|
return resolved.default || resolved;
|
|
1032
1081
|
}
|
|
1033
1082
|
async function ensurePackages(packages) {
|
|
1034
|
-
if (import_node_process.default.env.CI
|
|
1083
|
+
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
|
|
1035
1084
|
return;
|
|
1036
1085
|
}
|
|
1037
|
-
const nonExistingPackages = packages.filter(
|
|
1086
|
+
const nonExistingPackages = packages.filter(
|
|
1087
|
+
(index) => index && !(0, import_local_pkg.isPackageExists)(index)
|
|
1088
|
+
);
|
|
1038
1089
|
if (nonExistingPackages.length === 0) {
|
|
1039
1090
|
return;
|
|
1040
1091
|
}
|
|
1041
|
-
const
|
|
1042
|
-
const
|
|
1043
|
-
{
|
|
1044
|
-
|
|
1045
|
-
", "
|
|
1046
|
-
)}. Do you want to install them?`,
|
|
1047
|
-
name: "result",
|
|
1048
|
-
type: "confirm"
|
|
1049
|
-
}
|
|
1050
|
-
]);
|
|
1092
|
+
const prompts = await import("@clack/prompts");
|
|
1093
|
+
const result = await prompts.confirm({
|
|
1094
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
1095
|
+
});
|
|
1051
1096
|
if (result) {
|
|
1052
1097
|
await import("@antfu/install-pkg").then(
|
|
1053
|
-
(
|
|
1098
|
+
(index) => index.installPackage(nonExistingPackages, { dev: true })
|
|
1054
1099
|
);
|
|
1055
1100
|
}
|
|
1056
1101
|
}
|
|
@@ -1266,7 +1311,7 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
1266
1311
|
});
|
|
1267
1312
|
}
|
|
1268
1313
|
if (options.markdown) {
|
|
1269
|
-
const
|
|
1314
|
+
const formatter = options.markdown === true ? "prettier" : options.markdown;
|
|
1270
1315
|
configs.push({
|
|
1271
1316
|
files: markdownEnabled ? ["**/*.__markdown_content__"] : [GLOB_MARKDOWN],
|
|
1272
1317
|
languageOptions: {
|
|
@@ -1274,9 +1319,9 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
1274
1319
|
},
|
|
1275
1320
|
name: "style:formatter:markdown",
|
|
1276
1321
|
rules: {
|
|
1277
|
-
[`format/${
|
|
1322
|
+
[`format/${formatter}`]: [
|
|
1278
1323
|
"error",
|
|
1279
|
-
|
|
1324
|
+
formatter === "prettier" ? {
|
|
1280
1325
|
...prettierOptions,
|
|
1281
1326
|
embeddedLanguageFormatting: "off",
|
|
1282
1327
|
parser: "markdown"
|
|
@@ -1502,53 +1547,36 @@ async function jsonc(options = {}) {
|
|
|
1502
1547
|
|
|
1503
1548
|
// src/configs/markdown.ts
|
|
1504
1549
|
init_cjs_shims();
|
|
1505
|
-
|
|
1550
|
+
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
1551
|
+
async function markdown(options = {}) {
|
|
1506
1552
|
const {
|
|
1507
1553
|
componentExts: componentExtensions = [],
|
|
1508
1554
|
files = [GLOB_MARKDOWN],
|
|
1509
1555
|
overrides = {}
|
|
1510
1556
|
} = options;
|
|
1511
1557
|
const markdownPlugin = await interopDefault(import("eslint-plugin-markdown"));
|
|
1512
|
-
const baseProcessor = markdownPlugin.processors.markdown;
|
|
1513
|
-
const processor = !formatMarkdown ? {
|
|
1514
|
-
meta: {
|
|
1515
|
-
name: "markdown-processor"
|
|
1516
|
-
},
|
|
1517
|
-
supportsAutofix: true,
|
|
1518
|
-
...baseProcessor
|
|
1519
|
-
} : {
|
|
1520
|
-
meta: {
|
|
1521
|
-
name: "markdown-processor-with-content"
|
|
1522
|
-
},
|
|
1523
|
-
postprocess(messages, filename) {
|
|
1524
|
-
const markdownContent = messages.pop();
|
|
1525
|
-
const codeSnippets = baseProcessor.postprocess(messages, filename);
|
|
1526
|
-
return [...markdownContent ?? [], ...codeSnippets ?? []];
|
|
1527
|
-
},
|
|
1528
|
-
preprocess(text, filename) {
|
|
1529
|
-
const result = baseProcessor.preprocess(text, filename);
|
|
1530
|
-
return [
|
|
1531
|
-
...result,
|
|
1532
|
-
{
|
|
1533
|
-
filename: ".__markdown_content__",
|
|
1534
|
-
text
|
|
1535
|
-
}
|
|
1536
|
-
];
|
|
1537
|
-
},
|
|
1538
|
-
supportsAutofix: true
|
|
1539
|
-
};
|
|
1540
1558
|
return [
|
|
1541
1559
|
{
|
|
1542
1560
|
name: "style:markdown:setup",
|
|
1543
1561
|
plugins: {
|
|
1544
|
-
|
|
1562
|
+
markdownPlugin
|
|
1545
1563
|
}
|
|
1546
1564
|
},
|
|
1547
1565
|
{
|
|
1548
1566
|
files,
|
|
1549
1567
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1550
1568
|
name: "style:markdown:processor",
|
|
1551
|
-
|
|
1569
|
+
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
1570
|
+
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
1571
|
+
// add a pass-through processor for the markdown file itself.
|
|
1572
|
+
processor: (0, import_eslint_merge_processors.mergeProcessors)([markdownPlugin.processors.markdown, import_eslint_merge_processors.processorPassThrough])
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
files,
|
|
1576
|
+
languageOptions: {
|
|
1577
|
+
parser: parserPlain
|
|
1578
|
+
},
|
|
1579
|
+
name: "style:markdown:parser"
|
|
1552
1580
|
},
|
|
1553
1581
|
{
|
|
1554
1582
|
files: [
|
|
@@ -1567,7 +1595,6 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
1567
1595
|
"import/newline-after-import": "off",
|
|
1568
1596
|
"no-alert": "off",
|
|
1569
1597
|
"no-console": "off",
|
|
1570
|
-
"no-inline-comments": "off",
|
|
1571
1598
|
"no-labels": "off",
|
|
1572
1599
|
"no-lone-blocks": "off",
|
|
1573
1600
|
"no-restricted-syntax": "off",
|
|
@@ -1575,32 +1602,16 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
1575
1602
|
"no-unused-expressions": "off",
|
|
1576
1603
|
"no-unused-labels": "off",
|
|
1577
1604
|
"no-unused-vars": "off",
|
|
1605
|
+
"node/prefer-global/process": "off",
|
|
1578
1606
|
"style/comma-dangle": "off",
|
|
1579
1607
|
"style/eol-last": "off",
|
|
1580
|
-
"ts/await-thenable": "off",
|
|
1581
1608
|
"ts/consistent-type-imports": "off",
|
|
1582
|
-
"ts/dot-notation": "off",
|
|
1583
|
-
"ts/no-floating-promises": "off",
|
|
1584
|
-
"ts/no-for-in-array": "off",
|
|
1585
|
-
"ts/no-implied-eval": "off",
|
|
1586
|
-
"ts/no-misused-promises": "off",
|
|
1587
1609
|
"ts/no-namespace": "off",
|
|
1588
1610
|
"ts/no-redeclare": "off",
|
|
1589
1611
|
"ts/no-require-imports": "off",
|
|
1590
|
-
// Type aware rules
|
|
1591
|
-
"ts/no-throw-literal": "off",
|
|
1592
|
-
"ts/no-unnecessary-type-assertion": "off",
|
|
1593
|
-
"ts/no-unsafe-argument": "off",
|
|
1594
|
-
"ts/no-unsafe-assignment": "off",
|
|
1595
|
-
"ts/no-unsafe-call": "off",
|
|
1596
|
-
"ts/no-unsafe-member-access": "off",
|
|
1597
|
-
"ts/no-unsafe-return": "off",
|
|
1598
1612
|
"ts/no-unused-vars": "off",
|
|
1599
1613
|
"ts/no-use-before-define": "off",
|
|
1600
1614
|
"ts/no-var-requires": "off",
|
|
1601
|
-
"ts/restrict-plus-operands": "off",
|
|
1602
|
-
"ts/restrict-template-expressions": "off",
|
|
1603
|
-
"ts/unbound-method": "off",
|
|
1604
1615
|
"unicode-bom": "off",
|
|
1605
1616
|
"unused-imports/no-unused-imports": "off",
|
|
1606
1617
|
"unused-imports/no-unused-vars": "off",
|
|
@@ -1770,13 +1781,13 @@ async function prettier(options) {
|
|
|
1770
1781
|
|
|
1771
1782
|
// src/configs/promise.ts
|
|
1772
1783
|
init_cjs_shims();
|
|
1773
|
-
var
|
|
1784
|
+
var import_compat2 = require("@eslint/compat");
|
|
1774
1785
|
async function promise() {
|
|
1775
1786
|
return [
|
|
1776
1787
|
{
|
|
1777
1788
|
name: "style:promise",
|
|
1778
1789
|
plugins: {
|
|
1779
|
-
promise: (0,
|
|
1790
|
+
promise: (0, import_compat2.fixupPluginRules)(import_eslint_plugin_promise.default)
|
|
1780
1791
|
},
|
|
1781
1792
|
rules: {
|
|
1782
1793
|
"promise/always-return": [
|
|
@@ -1794,7 +1805,8 @@ async function promise() {
|
|
|
1794
1805
|
}
|
|
1795
1806
|
],
|
|
1796
1807
|
"promise/no-callback-in-promise": "off",
|
|
1797
|
-
|
|
1808
|
+
// TODO: Enable this rule eslint-community/eslint-plugin-promise#472
|
|
1809
|
+
"promise/no-multiple-resolved": "off",
|
|
1798
1810
|
"promise/no-native": "off",
|
|
1799
1811
|
"promise/no-nesting": "warn",
|
|
1800
1812
|
"promise/no-new-statics": "off",
|
|
@@ -1811,15 +1823,22 @@ async function promise() {
|
|
|
1811
1823
|
|
|
1812
1824
|
// src/configs/react.ts
|
|
1813
1825
|
init_cjs_shims();
|
|
1814
|
-
var
|
|
1826
|
+
var import_compat3 = require("@eslint/compat");
|
|
1815
1827
|
async function react(options = {}) {
|
|
1816
|
-
const {
|
|
1828
|
+
const {
|
|
1829
|
+
filenameCase = "kebabCase",
|
|
1830
|
+
files = [GLOB_TS, GLOB_TSX],
|
|
1831
|
+
importSource,
|
|
1832
|
+
jsxPragma,
|
|
1833
|
+
overrides = {}
|
|
1834
|
+
} = options;
|
|
1817
1835
|
await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-hooks"]);
|
|
1818
|
-
const [pluginReact, pluginReactHooks, pluginStylistic, parserTs] = await Promise.all([
|
|
1836
|
+
const [pluginReact, pluginReactHooks, pluginStylistic, parserTs, pluginTs] = await Promise.all([
|
|
1819
1837
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1820
1838
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1821
1839
|
interopDefault(import("@stylistic/eslint-plugin")),
|
|
1822
|
-
interopDefault(import("@typescript-eslint/parser"))
|
|
1840
|
+
interopDefault(import("@typescript-eslint/parser")),
|
|
1841
|
+
interopDefault(import("@typescript-eslint/eslint-plugin"))
|
|
1823
1842
|
]);
|
|
1824
1843
|
const plugins = pluginReact.configs.all.plugins;
|
|
1825
1844
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
@@ -1828,10 +1847,12 @@ async function react(options = {}) {
|
|
|
1828
1847
|
name: "style:react:setup",
|
|
1829
1848
|
plugins: {
|
|
1830
1849
|
react: plugins["@eslint-react"],
|
|
1831
|
-
"react-hooks": (0,
|
|
1850
|
+
"react-hooks": (0, import_compat3.fixupPluginRules)(pluginReactHooks),
|
|
1832
1851
|
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1833
1852
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1834
|
-
style: pluginStylistic
|
|
1853
|
+
style: pluginStylistic,
|
|
1854
|
+
ts: pluginTs,
|
|
1855
|
+
unicorn: import_eslint_plugin_unicorn.default
|
|
1835
1856
|
}
|
|
1836
1857
|
},
|
|
1837
1858
|
{
|
|
@@ -1881,7 +1902,8 @@ async function react(options = {}) {
|
|
|
1881
1902
|
"react/no-unsafe-component-will-receive-props": "off",
|
|
1882
1903
|
"react/no-unsafe-component-will-update": "off",
|
|
1883
1904
|
"react/no-unstable-context-value": "error",
|
|
1884
|
-
|
|
1905
|
+
// TODO: False positives on roblox primitives.
|
|
1906
|
+
"react/no-unstable-default-props": "off",
|
|
1885
1907
|
"react/no-unused-class-component-members": "warn",
|
|
1886
1908
|
"react/no-unused-state": "warn",
|
|
1887
1909
|
"react/no-useless-fragment": "warn",
|
|
@@ -1897,63 +1919,8 @@ async function react(options = {}) {
|
|
|
1897
1919
|
"react-hooks-extra/ensure-use-memo-has-non-empty-deps": "error",
|
|
1898
1920
|
"react-hooks-extra/prefer-use-state-lazy-initialization": "error",
|
|
1899
1921
|
// recommended rules from @eslint-react/naming-convention
|
|
1922
|
+
"react-naming-convention/filename-extension": ["warn", "as-needed"],
|
|
1900
1923
|
"react-naming-convention/use-state": "error",
|
|
1901
|
-
// "react/destructuring-assignment": [
|
|
1902
|
-
// "error",
|
|
1903
|
-
// "always",
|
|
1904
|
-
// {
|
|
1905
|
-
// destructureInSignature: "always",
|
|
1906
|
-
// },
|
|
1907
|
-
// ],
|
|
1908
|
-
// "react/display-name": "off",
|
|
1909
|
-
// "react/function-component-definition": "error",
|
|
1910
|
-
// "react/hook-use-state": "error",
|
|
1911
|
-
// "react/jsx-boolean-value": ["error", "always"],
|
|
1912
|
-
// "react/jsx-fragments": "error",
|
|
1913
|
-
// "react/jsx-handler-names": "error",
|
|
1914
|
-
// "react/jsx-key": "error",
|
|
1915
|
-
// "react/jsx-max-depth": [
|
|
1916
|
-
// "error",
|
|
1917
|
-
// {
|
|
1918
|
-
// max: 5,
|
|
1919
|
-
// },
|
|
1920
|
-
// ],
|
|
1921
|
-
// "react/jsx-no-bind": "error",
|
|
1922
|
-
// "react/jsx-no-comment-textnodes": "error",
|
|
1923
|
-
// "react/jsx-no-duplicate-props": "error",
|
|
1924
|
-
// "react/jsx-no-leaked-render": "error",
|
|
1925
|
-
// "react/jsx-no-target-blank": "error",
|
|
1926
|
-
// "react/jsx-no-undef": "off",
|
|
1927
|
-
// "react/jsx-uses-react": "error",
|
|
1928
|
-
// "react/jsx-uses-vars": "error",
|
|
1929
|
-
// "react/no-children-prop": "error",
|
|
1930
|
-
// "react/no-danger-with-children": "off",
|
|
1931
|
-
// "react/no-deprecated": "error",
|
|
1932
|
-
// "react/no-direct-mutation-state": "error",
|
|
1933
|
-
// "react/no-find-dom-node": "off",
|
|
1934
|
-
// "react/no-is-mounted": "error",
|
|
1935
|
-
// "react/no-render-return-value": "error",
|
|
1936
|
-
// "react/no-string-refs": "error",
|
|
1937
|
-
// "react/no-unescaped-entities": "off",
|
|
1938
|
-
// "react/no-unknown-property": "off",
|
|
1939
|
-
// "react/no-unsafe": "off",
|
|
1940
|
-
// "react/no-unstable-nested-components": [
|
|
1941
|
-
// "error",
|
|
1942
|
-
// {
|
|
1943
|
-
// allowAsProps: true,
|
|
1944
|
-
// },
|
|
1945
|
-
// ],
|
|
1946
|
-
// "react/no-unused-prop-types": "error",
|
|
1947
|
-
// "react/prefer-read-only-props": "error",
|
|
1948
|
-
// "react/prop-types": "off",
|
|
1949
|
-
// "react/react-in-jsx-scope": "off",
|
|
1950
|
-
// "react/require-render-return": "error",
|
|
1951
|
-
// "react/self-closing-comp": [
|
|
1952
|
-
// "error",
|
|
1953
|
-
// {
|
|
1954
|
-
// component: true,
|
|
1955
|
-
// },
|
|
1956
|
-
// ],
|
|
1957
1924
|
"style/jsx-curly-brace-presence": [
|
|
1958
1925
|
"error",
|
|
1959
1926
|
{
|
|
@@ -1985,16 +1952,18 @@ async function react(options = {}) {
|
|
|
1985
1952
|
}
|
|
1986
1953
|
}
|
|
1987
1954
|
},
|
|
1988
|
-
{
|
|
1989
|
-
files: ["**/*.story.tsx"],
|
|
1990
|
-
rules: {
|
|
1991
|
-
"react-hooks/rules-of-hooks": "off"
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
1955
|
{
|
|
1995
1956
|
files: [GLOB_TSX],
|
|
1996
1957
|
rules: {
|
|
1997
|
-
"max-lines-per-function": "off"
|
|
1958
|
+
"max-lines-per-function": "off",
|
|
1959
|
+
"unicorn/filename-case": [
|
|
1960
|
+
"error",
|
|
1961
|
+
{
|
|
1962
|
+
case: filenameCase,
|
|
1963
|
+
ignore: ["README.md"],
|
|
1964
|
+
multipleFileExtensions: true
|
|
1965
|
+
}
|
|
1966
|
+
]
|
|
1998
1967
|
}
|
|
1999
1968
|
}
|
|
2000
1969
|
];
|
|
@@ -2061,13 +2030,13 @@ async function roblox(options = {}) {
|
|
|
2061
2030
|
|
|
2062
2031
|
// src/configs/shopify.ts
|
|
2063
2032
|
init_cjs_shims();
|
|
2064
|
-
var
|
|
2033
|
+
var import_compat4 = require("@eslint/compat");
|
|
2065
2034
|
async function shopify() {
|
|
2066
2035
|
return [
|
|
2067
2036
|
{
|
|
2068
2037
|
name: "style:shopify",
|
|
2069
2038
|
plugins: {
|
|
2070
|
-
shopify: (0,
|
|
2039
|
+
shopify: (0, import_compat4.fixupPluginRules)(import_eslint_plugin2.default)
|
|
2071
2040
|
},
|
|
2072
2041
|
rules: {
|
|
2073
2042
|
"shopify/prefer-class-properties": "error",
|
|
@@ -2157,6 +2126,7 @@ async function sortPackageJson() {
|
|
|
2157
2126
|
"packageManager",
|
|
2158
2127
|
"description",
|
|
2159
2128
|
"author",
|
|
2129
|
+
"contributors",
|
|
2160
2130
|
"license",
|
|
2161
2131
|
"funding",
|
|
2162
2132
|
"homepage",
|
|
@@ -2342,6 +2312,41 @@ function sortTsconfig() {
|
|
|
2342
2312
|
];
|
|
2343
2313
|
}
|
|
2344
2314
|
|
|
2315
|
+
// src/configs/spelling.ts
|
|
2316
|
+
init_cjs_shims();
|
|
2317
|
+
async function spelling(options = {}) {
|
|
2318
|
+
const { componentExts: componentExtensions = [] } = options;
|
|
2319
|
+
const files = options.files ?? [
|
|
2320
|
+
GLOB_SRC,
|
|
2321
|
+
...componentExtensions.map((extension) => `**/*.${extension}`)
|
|
2322
|
+
];
|
|
2323
|
+
return [
|
|
2324
|
+
{
|
|
2325
|
+
files,
|
|
2326
|
+
name: "style:spelling",
|
|
2327
|
+
plugins: {
|
|
2328
|
+
["@cspell"]: import_eslint_plugin.default
|
|
2329
|
+
},
|
|
2330
|
+
rules: {
|
|
2331
|
+
"@cspell/spellchecker": [
|
|
2332
|
+
"warn",
|
|
2333
|
+
{
|
|
2334
|
+
autoFix: false,
|
|
2335
|
+
checkComments: true,
|
|
2336
|
+
cspell: {
|
|
2337
|
+
import: ["@isentinel/dict-roblox"],
|
|
2338
|
+
language: "en-US",
|
|
2339
|
+
words: ["isentinel"]
|
|
2340
|
+
},
|
|
2341
|
+
generateSuggestions: true,
|
|
2342
|
+
numSuggestions: 8
|
|
2343
|
+
}
|
|
2344
|
+
]
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
];
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2345
2350
|
// src/configs/toml.ts
|
|
2346
2351
|
init_cjs_shims();
|
|
2347
2352
|
async function toml(options = {}) {
|
|
@@ -2614,8 +2619,7 @@ async function typescript(options = {}) {
|
|
|
2614
2619
|
"error",
|
|
2615
2620
|
{
|
|
2616
2621
|
argsIgnorePattern: "^_",
|
|
2617
|
-
caughtErrorsIgnorePattern: "^_"
|
|
2618
|
-
varsIgnorePattern: "^(Roact$|_)"
|
|
2622
|
+
caughtErrorsIgnorePattern: "^_"
|
|
2619
2623
|
}
|
|
2620
2624
|
],
|
|
2621
2625
|
"ts/no-use-before-define": "off",
|
|
@@ -2636,6 +2640,7 @@ async function typescript(options = {}) {
|
|
|
2636
2640
|
rules: {
|
|
2637
2641
|
"eslint-comments/no-unlimited-disable": "off",
|
|
2638
2642
|
"import/no-duplicates": "off",
|
|
2643
|
+
"max-lines": "off",
|
|
2639
2644
|
"no-restricted-syntax": "off",
|
|
2640
2645
|
"unused-imports/no-unused-vars": "off"
|
|
2641
2646
|
}
|
|
@@ -2667,7 +2672,8 @@ async function unicorn() {
|
|
|
2667
2672
|
"error",
|
|
2668
2673
|
{
|
|
2669
2674
|
case: "kebabCase",
|
|
2670
|
-
ignore: ["README.md"]
|
|
2675
|
+
ignore: ["README.md"],
|
|
2676
|
+
multipleFileExtensions: true
|
|
2671
2677
|
}
|
|
2672
2678
|
],
|
|
2673
2679
|
"unicorn/no-array-for-each": "error",
|
|
@@ -2697,6 +2703,7 @@ async function unicorn() {
|
|
|
2697
2703
|
"unicorn/prevent-abbreviations": [
|
|
2698
2704
|
"error",
|
|
2699
2705
|
{
|
|
2706
|
+
/* eslint-disable @cspell/spellchecker -- Used to correct abbreviations. */
|
|
2700
2707
|
replacements: {
|
|
2701
2708
|
args: false,
|
|
2702
2709
|
dist: {
|
|
@@ -2726,6 +2733,7 @@ async function unicorn() {
|
|
|
2726
2733
|
refs: false,
|
|
2727
2734
|
str: false
|
|
2728
2735
|
}
|
|
2736
|
+
/* eslint-enable @cspell/spellchecker */
|
|
2729
2737
|
}
|
|
2730
2738
|
],
|
|
2731
2739
|
"unicorn/switch-case-braces": "error"
|
|
@@ -2814,6 +2822,7 @@ function style(options = {}, ...userConfigs) {
|
|
|
2814
2822
|
const {
|
|
2815
2823
|
autoRenamePlugins = true,
|
|
2816
2824
|
componentExts: componentExtensions = [],
|
|
2825
|
+
enableSpellCheck,
|
|
2817
2826
|
gitignore: enableGitignore = true,
|
|
2818
2827
|
jsx,
|
|
2819
2828
|
react: enableReact = false,
|
|
@@ -2877,11 +2886,20 @@ function style(options = {}, ...userConfigs) {
|
|
|
2877
2886
|
if (enableReact) {
|
|
2878
2887
|
configs.push(
|
|
2879
2888
|
react({
|
|
2889
|
+
...resolveSubOptions(options, "react"),
|
|
2880
2890
|
overrides: getOverrides(options, "react"),
|
|
2881
2891
|
tsconfigPath: getOverrides(options, "typescript").tsconfigPath
|
|
2882
2892
|
})
|
|
2883
2893
|
);
|
|
2884
2894
|
}
|
|
2895
|
+
if (enableSpellCheck ?? true) {
|
|
2896
|
+
configs.push(
|
|
2897
|
+
spelling({
|
|
2898
|
+
...resolveSubOptions(options, "typescript"),
|
|
2899
|
+
componentExts: componentExtensions
|
|
2900
|
+
})
|
|
2901
|
+
);
|
|
2902
|
+
}
|
|
2885
2903
|
if (options.jsonc ?? true) {
|
|
2886
2904
|
configs.push(
|
|
2887
2905
|
jsonc({
|
|
@@ -2910,13 +2928,10 @@ function style(options = {}, ...userConfigs) {
|
|
|
2910
2928
|
}
|
|
2911
2929
|
if (options.markdown ?? true) {
|
|
2912
2930
|
configs.push(
|
|
2913
|
-
markdown(
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
},
|
|
2918
|
-
options.formatters === true || !!(options.formatters || {})?.markdown
|
|
2919
|
-
)
|
|
2931
|
+
markdown({
|
|
2932
|
+
componentExts: componentExtensions,
|
|
2933
|
+
overrides: getOverrides(options, "markdown")
|
|
2934
|
+
})
|
|
2920
2935
|
);
|
|
2921
2936
|
}
|
|
2922
2937
|
if (options.formatters) {
|
|
@@ -2992,10 +3007,12 @@ init_cjs_shims();
|
|
|
2992
3007
|
jsdoc,
|
|
2993
3008
|
jsonc,
|
|
2994
3009
|
markdown,
|
|
3010
|
+
parserPlain,
|
|
2995
3011
|
perfectionist,
|
|
2996
3012
|
prettier,
|
|
2997
3013
|
promise,
|
|
2998
3014
|
react,
|
|
3015
|
+
renamePluginInConfigs,
|
|
2999
3016
|
renameRules,
|
|
3000
3017
|
resolveSubOptions,
|
|
3001
3018
|
roblox,
|
|
@@ -3003,6 +3020,7 @@ init_cjs_shims();
|
|
|
3003
3020
|
sonarjs,
|
|
3004
3021
|
sortPackageJson,
|
|
3005
3022
|
sortTsconfig,
|
|
3023
|
+
spelling,
|
|
3006
3024
|
style,
|
|
3007
3025
|
stylistic,
|
|
3008
3026
|
toArray,
|