eslint-config-un 0.4.0 → 0.4.2
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 +143 -90
- package/dist/index.d.cts +1093 -638
- package/dist/index.d.ts +1093 -638
- package/dist/index.js +141 -89
- package/package.json +35 -32
package/dist/index.cjs
CHANGED
|
@@ -33,19 +33,19 @@ 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.3.
|
|
36
|
+
// node_modules/.pnpm/tsup@8.3.6_jiti@2.0.0_postcss@8.4.47_tsx@4.16.2_typescript@5.7.3_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"node_modules/.pnpm/tsup@8.3.
|
|
38
|
+
"node_modules/.pnpm/tsup@8.3.6_jiti@2.0.0_postcss@8.4.47_tsx@4.16.2_typescript@5.7.3_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
43
|
+
// node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/package.json
|
|
44
44
|
var require_package = __commonJS({
|
|
45
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
45
|
+
"node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/package.json"(exports2, module2) {
|
|
46
46
|
module2.exports = {
|
|
47
47
|
name: "@eslint/js",
|
|
48
|
-
version: "9.
|
|
48
|
+
version: "9.20.0",
|
|
49
49
|
description: "ESLint JavaScript language implementation",
|
|
50
50
|
main: "./src/index.js",
|
|
51
51
|
types: "./types/index.d.ts",
|
|
@@ -81,9 +81,9 @@ var require_package = __commonJS({
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
84
|
+
// node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/configs/eslint-all.js
|
|
85
85
|
var require_eslint_all = __commonJS({
|
|
86
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
86
|
+
"node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/configs/eslint-all.js"(exports2, module2) {
|
|
87
87
|
"use strict";
|
|
88
88
|
init_cjs_shims();
|
|
89
89
|
module2.exports = Object.freeze({
|
|
@@ -290,9 +290,9 @@ var require_eslint_all = __commonJS({
|
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
|
|
293
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
293
|
+
// node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/configs/eslint-recommended.js
|
|
294
294
|
var require_eslint_recommended = __commonJS({
|
|
295
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
295
|
+
"node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports2, module2) {
|
|
296
296
|
"use strict";
|
|
297
297
|
init_cjs_shims();
|
|
298
298
|
module2.exports = Object.freeze({
|
|
@@ -363,9 +363,9 @@ var require_eslint_recommended = __commonJS({
|
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
366
|
+
// node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/index.js
|
|
367
367
|
var require_src = __commonJS({
|
|
368
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
368
|
+
"node_modules/.pnpm/@eslint+js@9.20.0/node_modules/@eslint/js/src/index.js"(exports2, module2) {
|
|
369
369
|
"use strict";
|
|
370
370
|
init_cjs_shims();
|
|
371
371
|
var { name, version } = require_package();
|
|
@@ -386,7 +386,8 @@ var require_src = __commonJS({
|
|
|
386
386
|
var index_exports = {};
|
|
387
387
|
__export(index_exports, {
|
|
388
388
|
DEFAULT_GLOBAL_IGNORES: () => DEFAULT_GLOBAL_IGNORES,
|
|
389
|
-
eslintConfig: () => eslintConfig
|
|
389
|
+
eslintConfig: () => eslintConfig,
|
|
390
|
+
isInEditor: () => import_is_in_editor.isInEditor
|
|
390
391
|
});
|
|
391
392
|
module.exports = __toCommonJS(index_exports);
|
|
392
393
|
init_cjs_shims();
|
|
@@ -588,6 +589,24 @@ var eslintCommentsEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
588
589
|
return builder.getAllConfigs();
|
|
589
590
|
};
|
|
590
591
|
|
|
592
|
+
// src/configs/extra/cli.ts
|
|
593
|
+
init_cjs_shims();
|
|
594
|
+
var DEFAULT_CLI_DIRS = ["bin", "scripts", "cli"];
|
|
595
|
+
var cliEslintConfig = (options = {}, internalOptions = {}) => {
|
|
596
|
+
const { onlyTopLevelDirs } = options;
|
|
597
|
+
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
598
|
+
builder.addConfig([
|
|
599
|
+
"cli",
|
|
600
|
+
{
|
|
601
|
+
includeDefaultFilesAndIgnores: true,
|
|
602
|
+
filesFallback: DEFAULT_CLI_DIRS.map(
|
|
603
|
+
(dir) => `${onlyTopLevelDirs ? "" : "**/"}${dir}/**/*.${GLOB_JS_TS_X_EXTENSION}`
|
|
604
|
+
)
|
|
605
|
+
}
|
|
606
|
+
]).addRule("node/no-process-exit", OFF).addRule("unicorn/no-process-exit", OFF).addRule("no-console", OFF);
|
|
607
|
+
return builder.getAllConfigs();
|
|
608
|
+
};
|
|
609
|
+
|
|
591
610
|
// src/configs/import.ts
|
|
592
611
|
init_cjs_shims();
|
|
593
612
|
var import_eslint_import_resolver_typescript = require("eslint-import-resolver-typescript");
|
|
@@ -669,11 +688,15 @@ var import_local_pkg = require("local-pkg");
|
|
|
669
688
|
var generateDefaultTestFiles = (extensions) => [
|
|
670
689
|
`**/*.spec.${extensions}`,
|
|
671
690
|
// GitHub: 2.3M .ts files as of 2024-12-08 (https://github.com/search?q=path%3A**%2F*.spec.ts&type=code&query=path%3A%2F**%2F__tests__%2F**%2F*.ts)
|
|
691
|
+
`**/-spec.${extensions}`,
|
|
692
|
+
// 165k
|
|
693
|
+
`**/_spec.${extensions}`,
|
|
694
|
+
// 40k
|
|
672
695
|
`**/*.test.${extensions}`,
|
|
673
696
|
// 1.9M
|
|
674
|
-
|
|
697
|
+
`**/__tests__/**/*.${extensions}`,
|
|
675
698
|
// 155k
|
|
676
|
-
|
|
699
|
+
`**/__test__/**/*.${extensions}`
|
|
677
700
|
// 14k
|
|
678
701
|
];
|
|
679
702
|
var jestEslintConfig = (options = {}, internalOptions = {}) => {
|
|
@@ -1029,8 +1052,8 @@ var markdownEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1029
1052
|
} = options;
|
|
1030
1053
|
const defaultDialect = typeof language === "string" ? language : "commonmark";
|
|
1031
1054
|
const defaultConfigLanguage = `markdown/${defaultDialect}`;
|
|
1032
|
-
const recommendedConfigs = arraify(import_markdown.default.configs
|
|
1033
|
-
const processorConfigs = arraify(import_markdown.default.configs
|
|
1055
|
+
const recommendedConfigs = arraify(import_markdown.default.configs.recommended);
|
|
1056
|
+
const processorConfigs = arraify(import_markdown.default.configs.processor);
|
|
1034
1057
|
const allowedFencedCodeBlocksLanguages = Array.isArray(codeBlocksAllowedLanguages) && codeBlocksAllowedLanguages.length > 0 && codeBlocksAllowedLanguages;
|
|
1035
1058
|
builder.addConfig(["markdown/setup", { doNotIgnoreMarkdown: true }], {
|
|
1036
1059
|
plugins: {
|
|
@@ -1090,7 +1113,6 @@ var markdownEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1090
1113
|
}
|
|
1091
1114
|
}
|
|
1092
1115
|
const processorAllowingLintingBothMarkdownAndCodeBlocks = (0, import_eslint_merge_processors.mergeProcessors)([
|
|
1093
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1094
1116
|
import_markdown.default.processors.markdown,
|
|
1095
1117
|
import_eslint_merge_processors.processorPassThrough
|
|
1096
1118
|
]);
|
|
@@ -1195,7 +1217,7 @@ var packageJsonEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1195
1217
|
parser: import_jsonc_eslint_parser2.default
|
|
1196
1218
|
}
|
|
1197
1219
|
}
|
|
1198
|
-
).addBulkRules(import_recommended.default.rules).addRule("package-json/order-properties", ERROR, [
|
|
1220
|
+
).addBulkRules(import_recommended.default.rules).addRule("package-json/no-redundant-files", ERROR).addRule("package-json/order-properties", ERROR, [
|
|
1199
1221
|
{ order: options.order ?? "sort-package-json" }
|
|
1200
1222
|
]).addRule("package-json/repository-shorthand", ERROR, [
|
|
1201
1223
|
{ form: options.repositoryShorthand ?? "object" }
|
|
@@ -1228,9 +1250,8 @@ var preferArrowFunctionsEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1228
1250
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1229
1251
|
builder.addConfig(["prefer-arrow-functions", { includeDefaultFilesAndIgnores: true }], {
|
|
1230
1252
|
plugins: {
|
|
1231
|
-
// @ts-expect-error
|
|
1232
|
-
|
|
1233
|
-
"prefer-arrow-functions": import_eslint_plugin_prefer_arrow_functions.default.default
|
|
1253
|
+
// @ts-expect-error types mismatch
|
|
1254
|
+
"prefer-arrow-functions": import_eslint_plugin_prefer_arrow_functions.default
|
|
1234
1255
|
}
|
|
1235
1256
|
}).addRule("prefer-arrow-functions/prefer-arrow-functions", WARNING).addOverrides();
|
|
1236
1257
|
return builder.getAllConfigs();
|
|
@@ -1275,6 +1296,7 @@ var securityEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1275
1296
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1276
1297
|
builder.addConfig(["security", { includeDefaultFilesAndIgnores: true }], {
|
|
1277
1298
|
plugins: {
|
|
1299
|
+
// @ts-expect-error types mismatch
|
|
1278
1300
|
security: import_eslint_plugin_security.default
|
|
1279
1301
|
}
|
|
1280
1302
|
}).addBulkRules(import_eslint_plugin_security.default.configs.recommended.rules).addRule("security/detect-bidi-characters", ERROR).addRule("security/detect-buffer-noassert", ERROR).addRule("security/detect-child-process", WARNING).addRule("security/detect-disable-mustache-escape", ERROR).addRule("security/detect-eval-with-expression", ERROR).addRule("security/detect-new-buffer", ERROR).addRule("security/detect-no-csrf-before-method-override", WARNING).addRule("security/detect-non-literal-fs-filename", OFF).addRule("security/detect-non-literal-regexp", OFF).addRule("security/detect-non-literal-require", OFF).addRule("security/detect-object-injection", OFF).addRule("security/detect-possible-timing-attacks", OFF).addRule("security/detect-pseudoRandomBytes", WARNING).addRule("security/detect-unsafe-regex", WARNING).addOverrides();
|
|
@@ -1294,7 +1316,7 @@ var sonarEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1294
1316
|
sonarjs: import_eslint_plugin_sonarjs.default
|
|
1295
1317
|
}
|
|
1296
1318
|
});
|
|
1297
|
-
builder.addConfig(["sonar", { includeDefaultFilesAndIgnores: true }]).addBulkRules(import_eslint_plugin_sonarjs.default.configs.recommended.rules).addRule("sonarjs/argument-type", OFF).addRule("sonarjs/array-callback-without-return", OFF).addRule("sonarjs/assertions-in-tests", testsRulesSeverity).addRule("sonarjs/aws-apigateway-public-api", awsRulesSeverity).addRule("sonarjs/aws-ec2-rds-dms-public", awsRulesSeverity).addRule("sonarjs/aws-ec2-unencrypted-ebs-volume", awsRulesSeverity).addRule("sonarjs/aws-efs-unencrypted", awsRulesSeverity).addRule("sonarjs/aws-iam-all-privileges", awsRulesSeverity).addRule("sonarjs/aws-iam-all-resources-accessible", OFF).addRule("sonarjs/aws-iam-privilege-escalation", awsRulesSeverity).addRule("sonarjs/aws-iam-public-access", awsRulesSeverity).addRule("sonarjs/aws-opensearchservice-domain", awsRulesSeverity).addRule("sonarjs/aws-rds-unencrypted-databases", awsRulesSeverity).addRule("sonarjs/aws-restricted-ip-admin-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-granted-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-insecure-http", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-public-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-server-encryption", OFF).addRule("sonarjs/aws-s3-bucket-versioning", awsRulesSeverity).addRule("sonarjs/aws-sagemaker-unencrypted-notebook", awsRulesSeverity).addRule("sonarjs/aws-sns-unencrypted-topics", awsRulesSeverity).addRule("sonarjs/aws-sqs-unencrypted-queue", awsRulesSeverity).addRule("sonarjs/block-scoped-var", OFF).addRule("sonarjs/call-argument-line", OFF).addRule("sonarjs/chai-determinate-assertion", testsRulesSeverity).addRule("sonarjs/class-name", OFF).addRule("sonarjs/code-eval", OFF).addRule("sonarjs/cognitive-complexity", OFF).addRule("sonarjs/concise-regex", OFF).addRule("sonarjs/conditional-indentation", OFF).addRule("sonarjs/constructor-for-side-effects", OFF).addRule("sonarjs/deprecation", OFF).addRule("sonarjs/different-types-comparison", OFF).addRule("sonarjs/disabled-timeout", testsRulesSeverity).addRule("sonarjs/duplicates-in-character-class", OFF).addRule("sonarjs/empty-string-repetition", OFF).addRule("sonarjs/fixme-tag", OFF).addRule("sonarjs/function-inside-loop", OFF).addRule("sonarjs/function-return-type", OFF).addRule("sonarjs/generator-without-yield", OFF).addRule("sonarjs/in-operator-type-error", OFF).addRule("sonarjs/inverted-assertion-arguments", testsRulesSeverity).addRule("sonarjs/label-position", OFF).addRule("sonarjs/max-switch-cases", OFF).addRule("sonarjs/misplaced-loop-counter", WARNING).addRule("sonarjs/new-operator-misuse", OFF).addRule("sonarjs/no-alphabetical-sort", OFF).addRule("sonarjs/no-array-delete", OFF).addRule("sonarjs/no-associative-arrays", OFF).addRule("sonarjs/no-async-constructor", OFF).addRule("sonarjs/no-code-after-done", testsRulesSeverity).addRule("sonarjs/no-commented-code", OFF).addRule("sonarjs/no-control-regex", OFF).addRule("sonarjs/no-dead-store", OFF).addRule("sonarjs/no-duplicate-in-composite", OFF).addRule("sonarjs/no-empty-alternatives", OFF).addRule("sonarjs/no-empty-character-class", OFF).addRule("sonarjs/no-empty-group", OFF).addRule("sonarjs/no-empty-test-file", OFF).addRule("sonarjs/no-exclusive-tests", OFF).addRule("sonarjs/no-fallthrough", OFF).addRule("sonarjs/no-for-in-iterable", ERROR).addRule("sonarjs/no-hardcoded-ip", WARNING).addRule("sonarjs/no-identical-conditions", OFF).addRule("sonarjs/no-implicit-dependencies", OFF).addRule("sonarjs/no-incomplete-assertions", testsRulesSeverity).addRule("sonarjs/no-invalid-await", OFF).addRule("sonarjs/no-invalid-regexp", OFF).addRule("sonarjs/no-labels", OFF).addRule("sonarjs/no-misleading-character-class", OFF).addRule("sonarjs/no-nested-assignment", OFF).addRule("sonarjs/no-nested-conditional", OFF).addRule("sonarjs/no-nested-functions", OFF).addRule("sonarjs/no-nested-template-literals", OFF).addRule("sonarjs/no-one-iteration-loop", OFF).addRule("sonarjs/no-primitive-wrappers", OFF).addRule("sonarjs/no-regex-spaces", OFF).addRule("sonarjs/no-same-argument-assert", testsRulesSeverity).addRule("sonarjs/no-same-line-conditional", OFF).addRule("sonarjs/no-selector-parameter", OFF).addRule("sonarjs/no-skipped-tests", OFF).addRule("sonarjs/no-try-promise", OFF).addRule("sonarjs/no-unenclosed-multiline-block", OFF).addRule("sonarjs/no-unthrown-error", OFF).addRule("sonarjs/no-unused-vars", OFF).addRule("sonarjs/no-useless-catch", OFF).addRule("sonarjs/no-useless-intersection", OFF).addRule("sonarjs/no-vue-bypass-sanitization", OFF).addRule("sonarjs/null-dereference", OFF).addRule("sonarjs/prefer-default-last", OFF).addRule("sonarjs/prefer-object-literal", ERROR).addRule("sonarjs/prefer-read-only-props", OFF).addRule("sonarjs/prefer-regexp-exec", OFF).addRule("sonarjs/production-debug", ERROR).addRule("sonarjs/pseudo-random", OFF).addRule("sonarjs/redundant-type-aliases", OFF).addRule("sonarjs/regex-complexity", WARNING, [{ threshold: 40 }]).addRule("sonarjs/single-char-in-character-classes", OFF).addRule("sonarjs/single-character-alternation", OFF).addRule("sonarjs/slow-regex", OFF).addRule("sonarjs/stable-tests", testsRulesSeverity).addRule("sonarjs/strings-comparison", WARNING).addRule("sonarjs/super-invocation", OFF).addRule("sonarjs/table-header", WARNING).addRule("sonarjs/table-header-reference", WARNING).addRule("sonarjs/todo-tag", OFF).addRule("sonarjs/unused-import", OFF).addRule("sonarjs/unverified-hostname", ERROR).addRule("sonarjs/updated-const-var", OFF).addRule("sonarjs/updated-loop-counter", WARNING).addRule("sonarjs/use-type-alias", WARNING).addRule("sonarjs/void-use", OFF).addOverrides();
|
|
1319
|
+
builder.addConfig(["sonar", { includeDefaultFilesAndIgnores: true }]).addBulkRules(import_eslint_plugin_sonarjs.default.configs.recommended.rules).addRule("sonarjs/argument-type", OFF).addRule("sonarjs/array-callback-without-return", OFF).addRule("sonarjs/assertions-in-tests", testsRulesSeverity).addRule("sonarjs/aws-apigateway-public-api", awsRulesSeverity).addRule("sonarjs/aws-ec2-rds-dms-public", awsRulesSeverity).addRule("sonarjs/aws-ec2-unencrypted-ebs-volume", awsRulesSeverity).addRule("sonarjs/aws-efs-unencrypted", awsRulesSeverity).addRule("sonarjs/aws-iam-all-privileges", awsRulesSeverity).addRule("sonarjs/aws-iam-all-resources-accessible", OFF).addRule("sonarjs/aws-iam-privilege-escalation", awsRulesSeverity).addRule("sonarjs/aws-iam-public-access", awsRulesSeverity).addRule("sonarjs/aws-opensearchservice-domain", awsRulesSeverity).addRule("sonarjs/aws-rds-unencrypted-databases", awsRulesSeverity).addRule("sonarjs/aws-restricted-ip-admin-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-granted-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-insecure-http", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-public-access", awsRulesSeverity).addRule("sonarjs/aws-s3-bucket-server-encryption", OFF).addRule("sonarjs/aws-s3-bucket-versioning", awsRulesSeverity).addRule("sonarjs/aws-sagemaker-unencrypted-notebook", awsRulesSeverity).addRule("sonarjs/aws-sns-unencrypted-topics", awsRulesSeverity).addRule("sonarjs/aws-sqs-unencrypted-queue", awsRulesSeverity).addRule("sonarjs/block-scoped-var", OFF).addRule("sonarjs/call-argument-line", OFF).addRule("sonarjs/chai-determinate-assertion", testsRulesSeverity).addRule("sonarjs/class-name", OFF).addRule("sonarjs/code-eval", OFF).addRule("sonarjs/cognitive-complexity", OFF).addRule("sonarjs/concise-regex", OFF).addRule("sonarjs/conditional-indentation", OFF).addRule("sonarjs/constructor-for-side-effects", OFF).addRule("sonarjs/deprecation", OFF).addRule("sonarjs/different-types-comparison", OFF).addRule("sonarjs/disabled-timeout", testsRulesSeverity).addRule("sonarjs/duplicates-in-character-class", OFF).addRule("sonarjs/empty-string-repetition", OFF).addRule("sonarjs/fixme-tag", OFF).addRule("sonarjs/function-inside-loop", OFF).addRule("sonarjs/function-return-type", OFF).addRule("sonarjs/generator-without-yield", OFF).addRule("sonarjs/in-operator-type-error", OFF).addRule("sonarjs/inverted-assertion-arguments", testsRulesSeverity).addRule("sonarjs/label-position", OFF).addRule("sonarjs/max-switch-cases", OFF).addRule("sonarjs/misplaced-loop-counter", WARNING).addRule("sonarjs/new-operator-misuse", OFF).addRule("sonarjs/no-alphabetical-sort", OFF).addRule("sonarjs/no-array-delete", OFF).addRule("sonarjs/no-associative-arrays", OFF).addRule("sonarjs/no-async-constructor", OFF).addRule("sonarjs/no-code-after-done", testsRulesSeverity).addRule("sonarjs/no-commented-code", OFF).addRule("sonarjs/no-control-regex", OFF).addRule("sonarjs/no-dead-store", OFF).addRule("sonarjs/no-duplicate-in-composite", OFF).addRule("sonarjs/no-empty-alternatives", OFF).addRule("sonarjs/no-empty-character-class", OFF).addRule("sonarjs/no-empty-group", OFF).addRule("sonarjs/no-empty-test-file", OFF).addRule("sonarjs/no-exclusive-tests", OFF).addRule("sonarjs/no-fallthrough", OFF).addRule("sonarjs/no-for-in-iterable", ERROR).addRule("sonarjs/no-hardcoded-ip", WARNING).addRule("sonarjs/no-identical-conditions", OFF).addRule("sonarjs/no-implicit-dependencies", OFF).addRule("sonarjs/no-incomplete-assertions", testsRulesSeverity).addRule("sonarjs/no-invalid-await", OFF).addRule("sonarjs/no-invalid-regexp", OFF).addRule("sonarjs/no-labels", OFF).addRule("sonarjs/no-misleading-character-class", OFF).addRule("sonarjs/no-nested-assignment", OFF).addRule("sonarjs/no-nested-conditional", OFF).addRule("sonarjs/no-nested-functions", OFF).addRule("sonarjs/no-nested-template-literals", OFF).addRule("sonarjs/no-one-iteration-loop", OFF).addRule("sonarjs/no-primitive-wrappers", OFF).addRule("sonarjs/no-regex-spaces", OFF).addRule("sonarjs/no-same-argument-assert", testsRulesSeverity).addRule("sonarjs/no-same-line-conditional", OFF).addRule("sonarjs/no-selector-parameter", OFF).addRule("sonarjs/no-skipped-tests", OFF).addRule("sonarjs/no-try-promise", OFF).addRule("sonarjs/no-unenclosed-multiline-block", OFF).addRule("sonarjs/no-unthrown-error", OFF).addRule("sonarjs/no-unused-vars", OFF).addRule("sonarjs/no-useless-catch", OFF).addRule("sonarjs/no-useless-intersection", OFF).addRule("sonarjs/no-vue-bypass-sanitization", OFF).addRule("sonarjs/null-dereference", OFF).addRule("sonarjs/prefer-default-last", OFF).addRule("sonarjs/prefer-object-literal", ERROR).addRule("sonarjs/prefer-read-only-props", OFF).addRule("sonarjs/prefer-regexp-exec", OFF).addRule("sonarjs/prefer-single-boolean-return", WARNING).addRule("sonarjs/production-debug", ERROR).addRule("sonarjs/pseudo-random", OFF).addRule("sonarjs/redundant-type-aliases", OFF).addRule("sonarjs/regex-complexity", WARNING, [{ threshold: 40 }]).addRule("sonarjs/single-char-in-character-classes", OFF).addRule("sonarjs/single-character-alternation", OFF).addRule("sonarjs/slow-regex", OFF).addRule("sonarjs/stable-tests", testsRulesSeverity).addRule("sonarjs/strings-comparison", WARNING).addRule("sonarjs/super-invocation", OFF).addRule("sonarjs/table-header", WARNING).addRule("sonarjs/table-header-reference", WARNING).addRule("sonarjs/todo-tag", OFF).addRule("sonarjs/unused-import", OFF).addRule("sonarjs/unverified-hostname", ERROR).addRule("sonarjs/updated-const-var", OFF).addRule("sonarjs/updated-loop-counter", WARNING).addRule("sonarjs/use-type-alias", WARNING).addRule("sonarjs/void-use", OFF).addOverrides();
|
|
1298
1320
|
return builder.getAllConfigs();
|
|
1299
1321
|
};
|
|
1300
1322
|
|
|
@@ -1312,6 +1334,7 @@ var tailwindEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1312
1334
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1313
1335
|
builder.addConfig(["tailwind", { includeDefaultFilesAndIgnores: true }], {
|
|
1314
1336
|
plugins: {
|
|
1337
|
+
// @ts-expect-error types mismatch
|
|
1315
1338
|
tailwindcss: import_eslint_plugin_tailwindcss.default
|
|
1316
1339
|
},
|
|
1317
1340
|
...settings && {
|
|
@@ -1386,32 +1409,40 @@ var tomlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1386
1409
|
init_cjs_shims();
|
|
1387
1410
|
var import_eslint_plugin_no_type_assertion = __toESM(require("eslint-plugin-no-type-assertion"), 1);
|
|
1388
1411
|
var import_typescript_eslint = require("typescript-eslint");
|
|
1412
|
+
var TS_FILES_DEFAULT = [GLOB_TS, GLOB_TSX];
|
|
1389
1413
|
var tsEslintConfig = (options = {}, internalOptions = {}) => {
|
|
1390
|
-
const
|
|
1391
|
-
const
|
|
1392
|
-
const
|
|
1414
|
+
const extraFilesNONTypeAware = [];
|
|
1415
|
+
const extraFilesTypeAware = [];
|
|
1416
|
+
const extraFilesToIgnoreNONTypeAware = [];
|
|
1393
1417
|
const extraFilesToIgnoreTypeAware = [
|
|
1394
1418
|
GLOB_MARKDOWN_SUPPORTED_CODE_BLOCKS
|
|
1395
1419
|
];
|
|
1396
1420
|
const { vueOptions } = internalOptions;
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1421
|
+
const enforceTsInVueOptions = vueOptions?.enforceTypescriptInScriptSection;
|
|
1422
|
+
if (enforceTsInVueOptions) {
|
|
1423
|
+
const tsInVueOptions = typeof enforceTsInVueOptions === "object" ? enforceTsInVueOptions : { files: vueOptions.files || [GLOB_VUE] };
|
|
1424
|
+
if (tsInVueOptions.typescriptRules !== false) {
|
|
1425
|
+
const vueFilesWithTs = tsInVueOptions.files || [];
|
|
1426
|
+
extraFilesNONTypeAware.push(...vueFilesWithTs);
|
|
1427
|
+
if (tsInVueOptions.typescriptRules !== "only-non-type-aware") {
|
|
1428
|
+
extraFilesTypeAware.push(...vueFilesWithTs);
|
|
1429
|
+
}
|
|
1430
|
+
extraFilesToIgnoreNONTypeAware.push(...tsInVueOptions.ignores || []);
|
|
1431
|
+
extraFilesToIgnoreTypeAware.push(...tsInVueOptions.ignores || []);
|
|
1432
|
+
}
|
|
1403
1433
|
}
|
|
1404
|
-
const
|
|
1405
|
-
const
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
...
|
|
1434
|
+
const filesNONTypeAwareDefault = [...options.files || TS_FILES_DEFAULT];
|
|
1435
|
+
const filesNONTypeAware = [...filesNONTypeAwareDefault, ...extraFilesNONTypeAware];
|
|
1436
|
+
const ignoresNONTypeAware = [...options.ignores || [], ...extraFilesToIgnoreNONTypeAware];
|
|
1437
|
+
const filesTypeAware = options.filesTypeAware === false ? [] : [
|
|
1438
|
+
...Array.isArray(options.filesTypeAware) ? options.filesTypeAware : filesNONTypeAwareDefault,
|
|
1439
|
+
// Lint the same files, excluding extra non-TA ones
|
|
1440
|
+
...extraFilesTypeAware
|
|
1409
1441
|
];
|
|
1410
1442
|
const ignoresTypeAware = [
|
|
1411
1443
|
...options.ignoresTypeAware === true ? options.ignores || [] : options.ignoresTypeAware || [],
|
|
1412
1444
|
...extraFilesToIgnoreTypeAware
|
|
1413
1445
|
];
|
|
1414
|
-
const filesAll = [...onlyTsFiles, ...filesTypeAware];
|
|
1415
1446
|
const tsVersion = options.typescriptVersion ? Number.parseFloat(options.typescriptVersion) : void 0;
|
|
1416
1447
|
const generateBaseOptions = (isTypeAware) => ({
|
|
1417
1448
|
languageOptions: {
|
|
@@ -1438,8 +1469,8 @@ var tsEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1438
1469
|
const noUnsafeRulesSeverity = options.disableNoUnsafeRules ? OFF : WARNING;
|
|
1439
1470
|
builder.addConfig("ts/rules-regular", {
|
|
1440
1471
|
...generateBaseOptions(false),
|
|
1441
|
-
files:
|
|
1442
|
-
...
|
|
1472
|
+
files: filesNONTypeAware,
|
|
1473
|
+
...ignoresNONTypeAware.length > 0 && { ignores: ignoresNONTypeAware }
|
|
1443
1474
|
}).addBulkRules(
|
|
1444
1475
|
import_typescript_eslint.configs.strict.reduce(
|
|
1445
1476
|
(result, config) => Object.assign(result, config.rules),
|
|
@@ -1476,57 +1507,68 @@ var tsEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1476
1507
|
).addRule("@typescript-eslint/no-use-before-define", ERROR, RULE_NO_USE_BEFORE_DEFINE_OPTIONS, {
|
|
1477
1508
|
overrideBaseRule: true
|
|
1478
1509
|
}).addRule("@typescript-eslint/no-useless-empty-export", ERROR).addAnyRule("no-useless-constructor", OFF).addAnyRule("dot-notation", OFF).addOverrides();
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
ignoreArrowShorthand: true
|
|
1496
|
-
}
|
|
1497
|
-
]).addRule("@typescript-eslint/no-deprecated", WARNING).addRule("@typescript-eslint/no-floating-promises", ERROR, [
|
|
1498
|
-
{
|
|
1499
|
-
checkThenables: true,
|
|
1500
|
-
ignoreVoid: true
|
|
1501
|
-
// Default
|
|
1502
|
-
}
|
|
1503
|
-
]).addRule("@typescript-eslint/no-implied-eval", ERROR, [], { overrideBaseRule: true }).addRule(
|
|
1504
|
-
"@typescript-eslint/no-unnecessary-condition",
|
|
1505
|
-
ERROR,
|
|
1506
|
-
[
|
|
1510
|
+
if (filesTypeAware.length > 0) {
|
|
1511
|
+
builder.addConfig("ts/rules-type-aware", {
|
|
1512
|
+
...generateBaseOptions(true),
|
|
1513
|
+
files: filesTypeAware,
|
|
1514
|
+
...ignoresTypeAware.length > 0 && { ignores: ignoresTypeAware }
|
|
1515
|
+
}).addBulkRules(
|
|
1516
|
+
import_typescript_eslint.configs.strictTypeCheckedOnly.reduce(
|
|
1517
|
+
(result, config) => Object.assign(result, config.rules),
|
|
1518
|
+
{}
|
|
1519
|
+
)
|
|
1520
|
+
).addBulkRules(
|
|
1521
|
+
import_typescript_eslint.configs.stylisticTypeCheckedOnly.reduce(
|
|
1522
|
+
(result, config) => Object.assign(result, config.rules),
|
|
1523
|
+
{}
|
|
1524
|
+
)
|
|
1525
|
+
).addRule("@typescript-eslint/no-confusing-void-expression", ERROR, [
|
|
1507
1526
|
{
|
|
1508
|
-
|
|
1509
|
-
checkTypePredicates: true
|
|
1510
|
-
// >=8.8.0
|
|
1527
|
+
ignoreArrowShorthand: true
|
|
1511
1528
|
}
|
|
1512
|
-
],
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
ERROR,
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1529
|
+
]).addRule("@typescript-eslint/no-deprecated", WARNING).addRule("@typescript-eslint/no-floating-promises", ERROR, [
|
|
1530
|
+
{
|
|
1531
|
+
checkThenables: true,
|
|
1532
|
+
ignoreVoid: true
|
|
1533
|
+
// Default
|
|
1534
|
+
}
|
|
1535
|
+
]).addRule("@typescript-eslint/no-implied-eval", ERROR, [], { overrideBaseRule: true }).addRule("@typescript-eslint/no-misused-spread", ERROR).addRule(
|
|
1536
|
+
"@typescript-eslint/no-unnecessary-condition",
|
|
1537
|
+
ERROR,
|
|
1538
|
+
[
|
|
1539
|
+
{
|
|
1540
|
+
allowConstantLoopConditions: "only-allowed-literals",
|
|
1541
|
+
checkTypePredicates: true
|
|
1542
|
+
// >=8.8.0
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
{ disableAutofix: true }
|
|
1546
|
+
).addRule("@typescript-eslint/no-unnecessary-type-arguments", ERROR, [], {
|
|
1547
|
+
disableAutofix: true
|
|
1548
|
+
}).addRule("@typescript-eslint/no-unsafe-argument", noUnsafeRulesSeverity).addRule("@typescript-eslint/no-unsafe-assignment", noUnsafeRulesSeverity).addRule("@typescript-eslint/no-unsafe-call", noUnsafeRulesSeverity).addRule("@typescript-eslint/no-unsafe-enum-comparison", noUnsafeRulesSeverity).addRule("@typescript-eslint/no-unsafe-member-access", noUnsafeRulesSeverity).addRule("@typescript-eslint/no-unsafe-return", noUnsafeRulesSeverity).addAnyRule("no-throw-literal", OFF).addRule("@typescript-eslint/prefer-promise-reject-errors", ERROR, [], {
|
|
1549
|
+
overrideBaseRule: true
|
|
1550
|
+
}).addRule("@typescript-eslint/require-await", ERROR, [], { overrideBaseRule: true }).addRule("@typescript-eslint/restrict-template-expressions", ERROR, [
|
|
1551
|
+
{ allowAny: false, allowRegExp: false }
|
|
1552
|
+
]).addRule(
|
|
1553
|
+
"@typescript-eslint/dot-notation",
|
|
1554
|
+
ERROR,
|
|
1555
|
+
[{ allowIndexSignaturePropertyAccess: true }],
|
|
1556
|
+
{ overrideBaseRule: true }
|
|
1557
|
+
).addAnyRule("unicorn/prefer-includes", OFF).addRule("@typescript-eslint/prefer-nullish-coalescing", OFF).addRule("@typescript-eslint/prefer-regexp-exec", OFF).addRule("@typescript-eslint/prefer-string-starts-ends-with", ERROR, [
|
|
1558
|
+
{ allowSingleElementEquality: "always" }
|
|
1559
|
+
]).addRule("@typescript-eslint/consistent-type-exports", ERROR, [
|
|
1560
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true }
|
|
1561
|
+
]).addRule(
|
|
1562
|
+
"@typescript-eslint/prefer-destructuring",
|
|
1563
|
+
ERROR,
|
|
1564
|
+
RULE_PREFER_DESTRUCTURING_OPTIONS,
|
|
1565
|
+
{
|
|
1566
|
+
overrideBaseRule: true
|
|
1567
|
+
}
|
|
1568
|
+
).addAnyRule("unicorn/prefer-array-find", OFF).addRule("@typescript-eslint/prefer-readonly", ERROR).addAnyRule("no-return-await", OFF).addRule("@typescript-eslint/return-await", ERROR, ["always"]).addRule("@typescript-eslint/switch-exhaustiveness-check", ERROR).addBulkRules(options.overridesTypeAware);
|
|
1569
|
+
}
|
|
1528
1570
|
builder.addConfig("ts/disable-handled-by-ts-compiler-rules", {
|
|
1529
|
-
files:
|
|
1571
|
+
files: [...TS_FILES_DEFAULT, ...filesNONTypeAware, ...filesTypeAware]
|
|
1530
1572
|
}).addAnyRule("constructor-super", OFF).addAnyRule("getter-return", OFF).addAnyRule("no-const-assign", OFF).addAnyRule("no-dupe-args", OFF).addAnyRule("no-dupe-class-members", OFF).addAnyRule("no-dupe-keys", OFF).addAnyRule("no-func-assign", OFF).addAnyRule("no-new-native-nonconstructor", OFF).addAnyRule("no-obj-calls", OFF).addAnyRule("no-setter-return", OFF).addAnyRule("no-this-before-super", OFF).addAnyRule("no-undef", OFF).addAnyRule("no-unsafe-negation", OFF).addAnyRule("no-duplicate-imports", OFF);
|
|
1531
1573
|
builder.addConfig("ts/dts", {
|
|
1532
1574
|
files: ["**/*.d.?([cm])ts"]
|
|
@@ -1617,7 +1659,7 @@ var vitestEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1617
1659
|
restrictedMatchers || {}
|
|
1618
1660
|
]).addRule("vitest/no-restricted-vi-methods", hasRestrictedMethods ? ERROR : OFF, [
|
|
1619
1661
|
restrictedMethods || {}
|
|
1620
|
-
]).addRule("vitest/no-standalone-expect", ERROR).addRule("vitest/no-test-prefixes", ERROR).addRule("vitest/no-test-return-statement", ERROR).addRule("vitest/prefer-comparison-matcher", ERROR).addRule("vitest/prefer-each", WARNING).addRule("vitest/prefer-equality-matcher", ERROR).addRule("vitest/prefer-expect-resolves", ERROR).addRule("vitest/prefer-hooks-in-order", ERROR).addRule("vitest/prefer-hooks-on-top", ERROR).addRule("vitest/prefer-lowercase-title", ERROR).addRule("vitest/prefer-mock-promise-shorthand", ERROR).addRule("vitest/prefer-spy-on", ERROR).addRule("vitest/prefer-strict-equal", WARNING).addRule("vitest/prefer-to-be", ERROR).addRule("vitest/prefer-to-be-falsy", ERROR).addRule("vitest/prefer-to-be-object", ERROR).addRule("vitest/prefer-to-be-truthy", ERROR).addRule("vitest/prefer-to-contain", ERROR).addRule("vitest/prefer-to-have-length", ERROR).addRule("vitest/prefer-todo", WARNING).addRule("vitest/require-hook", WARNING).addRule("vitest/require-to-throw-message", OFF).addRule("vitest/require-top-level-describe", OFF).addRule("vitest/valid-expect", ERROR, [
|
|
1662
|
+
]).addRule("vitest/no-standalone-expect", ERROR).addRule("vitest/no-test-prefixes", ERROR).addRule("vitest/no-test-return-statement", ERROR).addRule("vitest/prefer-comparison-matcher", ERROR).addRule("vitest/prefer-each", WARNING).addRule("vitest/prefer-equality-matcher", ERROR).addRule("vitest/prefer-expect-resolves", ERROR).addRule("vitest/prefer-hooks-in-order", ERROR).addRule("vitest/prefer-hooks-on-top", ERROR).addRule("vitest/prefer-lowercase-title", ERROR).addRule("vitest/prefer-mock-promise-shorthand", ERROR).addRule("vitest/prefer-spy-on", ERROR).addRule("vitest/prefer-strict-equal", WARNING).addRule("vitest/prefer-to-be", ERROR).addRule("vitest/prefer-to-be-falsy", ERROR).addRule("vitest/prefer-to-be-object", ERROR).addRule("vitest/prefer-to-be-truthy", ERROR).addRule("vitest/prefer-to-contain", ERROR).addRule("vitest/prefer-to-have-length", ERROR).addRule("vitest/prefer-todo", WARNING).addRule("vitest/require-hook", WARNING).addRule("vitest/require-mock-type-parameters", WARNING).addRule("vitest/require-to-throw-message", OFF).addRule("vitest/require-top-level-describe", OFF).addRule("vitest/valid-expect", ERROR, [
|
|
1621
1663
|
{
|
|
1622
1664
|
alwaysAwait: true,
|
|
1623
1665
|
// Default: false
|
|
@@ -1961,7 +2003,12 @@ var yamlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1961
2003
|
};
|
|
1962
2004
|
|
|
1963
2005
|
// src/index.ts
|
|
1964
|
-
var
|
|
2006
|
+
var import_is_in_editor = require("is-in-editor");
|
|
2007
|
+
var RULES_NOT_TO_DISABLE_IN_CONFIG_PRETTIER = /* @__PURE__ */ new Set([
|
|
2008
|
+
"curly",
|
|
2009
|
+
"unicorn/template-indent",
|
|
2010
|
+
"@stylistic/quotes"
|
|
2011
|
+
]);
|
|
1965
2012
|
var eslintConfig = (options = {}) => {
|
|
1966
2013
|
const globalIgnores = [
|
|
1967
2014
|
...options.overrideIgnores ? [] : DEFAULT_GLOBAL_IGNORES,
|
|
@@ -2076,6 +2123,10 @@ var eslintConfig = (options = {}) => {
|
|
|
2076
2123
|
const perfectionistOptions = {
|
|
2077
2124
|
...assignOptions(configsOptions, "perfectionist")
|
|
2078
2125
|
};
|
|
2126
|
+
const isCliEnabled = Boolean(configsOptions.cli ?? true);
|
|
2127
|
+
const cliOptions = {
|
|
2128
|
+
...assignOptions(configsOptions, "cli")
|
|
2129
|
+
};
|
|
2079
2130
|
const internalOptions = {
|
|
2080
2131
|
globalOptions: options,
|
|
2081
2132
|
isTypescriptEnabled,
|
|
@@ -2162,6 +2213,7 @@ var eslintConfig = (options = {}) => {
|
|
|
2162
2213
|
"import/no-default-export": OFF
|
|
2163
2214
|
}
|
|
2164
2215
|
},
|
|
2216
|
+
isCliEnabled && cliEslintConfig(cliOptions, internalOptions),
|
|
2165
2217
|
...options.extraConfigs || [],
|
|
2166
2218
|
// MUST be last
|
|
2167
2219
|
!options.disablePrettierIncompatibleRules && {
|
|
@@ -2177,5 +2229,6 @@ var eslintConfig = (options = {}) => {
|
|
|
2177
2229
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2178
2230
|
0 && (module.exports = {
|
|
2179
2231
|
DEFAULT_GLOBAL_IGNORES,
|
|
2180
|
-
eslintConfig
|
|
2232
|
+
eslintConfig,
|
|
2233
|
+
isInEditor
|
|
2181
2234
|
});
|