@ota-meshi/eslint-plugin 0.15.2 → 0.16.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/lib/config-builder/+astro-with-ts.js +38 -0
- package/lib/config-builder/+astro.js +30 -0
- package/lib/config-builder/+eslint-plugin.js +26 -0
- package/lib/config-builder/+json.js +32 -0
- package/lib/config-builder/+md.js +43 -0
- package/lib/config-builder/+node.js +29 -0
- package/lib/config-builder/+package-json.js +29 -0
- package/lib/config-builder/+prettier.js +28 -0
- package/lib/config-builder/+svelte-with-ts.js +42 -0
- package/lib/config-builder/+svelte.js +30 -0
- package/lib/config-builder/+toml.js +32 -0
- package/lib/config-builder/+typescript.js +17 -0
- package/lib/config-builder/+vue2-with-ts.js +38 -0
- package/lib/config-builder/+vue2.js +30 -0
- package/lib/config-builder/+vue3-with-ts.js +38 -0
- package/lib/config-builder/+vue3.js +30 -0
- package/lib/config-builder/+yaml.js +32 -0
- package/lib/config-builder/base-plugins/eslint-comments.js +20 -0
- package/lib/config-builder/base-plugins/regexp.js +20 -0
- package/lib/config-builder/fallback.js +22 -0
- package/lib/config-builder/index.js +50 -0
- package/lib/config-builder/plugins/json-schema.js +30 -0
- package/lib/config-builder/plugins/ts/base-config.js +44 -0
- package/lib/config-builder/plugins/ts/index.js +5 -0
- package/lib/config-builder/recommended.js +38 -0
- package/lib/config-helpers/+astro.js +5 -0
- package/lib/config-helpers/+eslint-plugin.js +102 -0
- package/lib/config-helpers/+json.js +10 -0
- package/lib/config-helpers/+md.js +44 -0
- package/lib/config-helpers/+node.js +25 -0
- package/lib/config-helpers/+package-json.js +4 -0
- package/lib/config-helpers/+prettier.js +44 -0
- package/lib/config-helpers/+svelte.js +16 -0
- package/lib/config-helpers/+toml.js +5 -0
- package/lib/config-helpers/+typescript.js +18 -0
- package/lib/config-helpers/+vue.js +5 -0
- package/lib/config-helpers/+yaml.js +7 -0
- package/lib/config-helpers/base-plugins/eslint-comments.js +7 -0
- package/lib/config-helpers/base-plugins/regexp.js +10 -0
- package/lib/config-helpers/plugins/json-schema.js +31 -0
- package/lib/config-helpers/plugins/ts/base-config.js +114 -0
- package/lib/config-helpers/plugins/ts/index.js +21 -0
- package/lib/config-helpers/recommended.js +241 -0
- package/lib/configs/+eslint-plugin.js +22 -95
- package/lib/configs/+json.js +22 -22
- package/lib/configs/+md.js +30 -20
- package/lib/configs/+node.js +23 -29
- package/lib/configs/+package-json.js +20 -20
- package/lib/configs/+prettier.js +23 -70
- package/lib/configs/+svelte-with-ts.js +47 -25
- package/lib/configs/+svelte.js +23 -32
- package/lib/configs/+toml.js +20 -18
- package/lib/configs/+typescript.js +48 -32
- package/lib/configs/+vue2-with-ts.js +48 -25
- package/lib/configs/+vue2.js +24 -25
- package/lib/configs/+vue3-with-ts.js +48 -25
- package/lib/configs/+vue3.js +24 -25
- package/lib/configs/+yaml.js +22 -22
- package/lib/configs/base-plugins/eslint-comments.js +7 -9
- package/lib/configs/base-plugins/regexp.js +6 -11
- package/lib/configs/fallback.js +15 -0
- package/lib/configs/json-schema/config.js +14 -31
- package/lib/configs/recommended.js +25 -255
- package/lib/configs/ts/base-config.js +10 -118
- package/lib/configs/ts/index.js +4 -16
- package/lib/index.js +15 -23
- package/lib/parsers/any-parser.js +29 -0
- package/lib/rules/missing-module-for-config.js +35 -53
- package/lib/utils/find-root-dir.js +21 -18
- package/lib/utils/get-linters.js +27 -27
- package/lib/utils/module.js +81 -59
- package/package.json +26 -18
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildConfig = void 0;
|
|
4
|
+
const recommended_js_1 = require("./recommended.js");
|
|
5
|
+
const _eslint_plugin_js_1 = require("./+eslint-plugin.js");
|
|
6
|
+
const _node_js_1 = require("./+node.js");
|
|
7
|
+
const _json_js_1 = require("./+json.js");
|
|
8
|
+
const _md_js_1 = require("./+md.js");
|
|
9
|
+
const _package_json_js_1 = require("./+package-json.js");
|
|
10
|
+
const _prettier_js_1 = require("./+prettier.js");
|
|
11
|
+
const _svelte_js_1 = require("./+svelte.js");
|
|
12
|
+
const _svelte_with_ts_js_1 = require("./+svelte-with-ts.js");
|
|
13
|
+
const _toml_js_1 = require("./+toml.js");
|
|
14
|
+
const _typescript_js_1 = require("./+typescript.js");
|
|
15
|
+
const _yaml_js_1 = require("./+yaml.js");
|
|
16
|
+
const _vue3_js_1 = require("./+vue3.js");
|
|
17
|
+
const _vue3_with_ts_js_1 = require("./+vue3-with-ts.js");
|
|
18
|
+
const _vue2_js_1 = require("./+vue2.js");
|
|
19
|
+
const _vue2_with_ts_js_1 = require("./+vue2-with-ts.js");
|
|
20
|
+
const _astro_js_1 = require("./+astro.js");
|
|
21
|
+
const _astro_with_ts_js_1 = require("./+astro-with-ts.js");
|
|
22
|
+
/**
|
|
23
|
+
* Build config
|
|
24
|
+
*/
|
|
25
|
+
function buildConfig(options) {
|
|
26
|
+
return [
|
|
27
|
+
...(0, recommended_js_1.buildRecommended)(),
|
|
28
|
+
...(options?.node ? (0, _node_js_1.buildNode)() : []),
|
|
29
|
+
...(options?.packageJson ? (0, _package_json_js_1.buildPackageJson)() : []),
|
|
30
|
+
// kind of package
|
|
31
|
+
...(options?.eslintPlugin ? (0, _eslint_plugin_js_1.buildESLintPlugin)() : []),
|
|
32
|
+
// languages
|
|
33
|
+
...(options?.vue3 ? (0, _vue3_js_1.buildVue3)() : []),
|
|
34
|
+
...(options?.vue3 && options?.ts ? (0, _vue3_with_ts_js_1.buildVue3Ts)() : []),
|
|
35
|
+
...(options?.vue2 ? (0, _vue2_js_1.buildVue2)() : []),
|
|
36
|
+
...(options?.vue2 && options?.ts ? (0, _vue2_with_ts_js_1.buildVue2Ts)() : []),
|
|
37
|
+
...(options?.svelte ? (0, _svelte_js_1.buildSvelte)() : []),
|
|
38
|
+
...(options?.svelte && options?.ts ? (0, _svelte_with_ts_js_1.buildSvelteTs)() : []),
|
|
39
|
+
...(options?.astro ? (0, _astro_js_1.buildAstro)() : []),
|
|
40
|
+
...(options?.astro && options?.ts ? (0, _astro_with_ts_js_1.buildAstroTs)() : []),
|
|
41
|
+
...(options?.ts ? (0, _typescript_js_1.buildTs)() : []),
|
|
42
|
+
...(options?.json ? (0, _json_js_1.buildJson)() : []),
|
|
43
|
+
...(options?.yaml ? (0, _yaml_js_1.buildYaml)() : []),
|
|
44
|
+
...(options?.toml ? (0, _toml_js_1.buildToml)() : []),
|
|
45
|
+
...(options?.md ? (0, _md_js_1.buildMd)() : []),
|
|
46
|
+
// format
|
|
47
|
+
...(options?.prettier ? (0, _prettier_js_1.buildPrettier)() : []),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
exports.buildConfig = buildConfig;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildJsonSchema = void 0;
|
|
4
|
+
const module_js_1 = require("../../utils/module.js");
|
|
5
|
+
const json_schema_js_1 = require("../../config-helpers/plugins/json-schema.js");
|
|
6
|
+
const fallback_js_1 = require("../fallback.js");
|
|
7
|
+
const any_parser_js_1 = require("../../parsers/any-parser.js");
|
|
8
|
+
function buildJsonSchema(files) {
|
|
9
|
+
return (0, module_js_1.requireOf)(["eslint-plugin-json-schema-validator@5.0.0"], () => {
|
|
10
|
+
const eslintPluginJsonSchemaValidator = (0, module_js_1.requireFromCwd)("eslint-plugin-json-schema-validator");
|
|
11
|
+
return [
|
|
12
|
+
...eslintPluginJsonSchemaValidator.configs["flat/recommended"].map((config) => ({ files, ...config })),
|
|
13
|
+
{
|
|
14
|
+
files,
|
|
15
|
+
rules: {
|
|
16
|
+
...json_schema_js_1.jsonSchemaExtendRules,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}, (missingList) => [
|
|
21
|
+
{
|
|
22
|
+
files,
|
|
23
|
+
languageOptions: {
|
|
24
|
+
parser: any_parser_js_1.anyParser,
|
|
25
|
+
},
|
|
26
|
+
...(0, fallback_js_1.buildFallback)(missingList),
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
exports.buildJsonSchema = buildJsonSchema;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildTS = void 0;
|
|
4
|
+
const module_js_1 = require("../../../utils/module.js");
|
|
5
|
+
const index_js_1 = require("../../../config-helpers/plugins/ts/index.js");
|
|
6
|
+
const fallback_js_1 = require("../../fallback.js");
|
|
7
|
+
const any_parser_js_1 = require("../../../parsers/any-parser.js");
|
|
8
|
+
function buildTS(files) {
|
|
9
|
+
return (0, module_js_1.requireOf)([
|
|
10
|
+
"typescript",
|
|
11
|
+
"typescript-eslint",
|
|
12
|
+
"@typescript-eslint/eslint-plugin",
|
|
13
|
+
"@typescript-eslint/parser",
|
|
14
|
+
], () => {
|
|
15
|
+
const tseslint = (0, module_js_1.requireFromCwd)("typescript-eslint");
|
|
16
|
+
return [
|
|
17
|
+
...tseslint.config({
|
|
18
|
+
files,
|
|
19
|
+
extends: [
|
|
20
|
+
...tseslint.configs.recommended,
|
|
21
|
+
{
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parserOptions: {
|
|
24
|
+
...index_js_1.tsParserOptions,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
rules: {
|
|
30
|
+
...index_js_1.tsExtendRules,
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
];
|
|
34
|
+
}, (missingList) => [
|
|
35
|
+
{
|
|
36
|
+
files,
|
|
37
|
+
languageOptions: {
|
|
38
|
+
parser: any_parser_js_1.anyParser,
|
|
39
|
+
},
|
|
40
|
+
...(0, fallback_js_1.buildFallback)(missingList),
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
exports.buildTS = buildTS;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildTS = void 0;
|
|
4
|
+
var base_config_js_1 = require("./base-config.js");
|
|
5
|
+
Object.defineProperty(exports, "buildTS", { enumerable: true, get: function () { return base_config_js_1.buildTS; } });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-check
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.buildRecommended = void 0;
|
|
8
|
+
const js_1 = __importDefault(require("@eslint/js"));
|
|
9
|
+
const eslint_comments_js_1 = require("./base-plugins/eslint-comments.js");
|
|
10
|
+
const regexp_js_1 = require("./base-plugins/regexp.js");
|
|
11
|
+
const recommended_js_1 = require("../config-helpers/recommended.js");
|
|
12
|
+
/**
|
|
13
|
+
* Build recommended config
|
|
14
|
+
*/
|
|
15
|
+
function buildRecommended() {
|
|
16
|
+
return [
|
|
17
|
+
js_1.default.configs.recommended,
|
|
18
|
+
...(0, eslint_comments_js_1.buildESLintComments)(),
|
|
19
|
+
...(0, regexp_js_1.buildRegexp)(),
|
|
20
|
+
{
|
|
21
|
+
rules: {
|
|
22
|
+
...recommended_js_1.recommendedRules,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
files: recommended_js_1.recommendedTestFiles,
|
|
27
|
+
languageOptions: {
|
|
28
|
+
globals: {
|
|
29
|
+
...recommended_js_1.recommendedTestGlobals,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
...recommended_js_1.recommendedTestRules,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
exports.buildRecommended = buildRecommended;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.eslintPluginExtendRules = exports.eslintPluginFiles = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
exports.eslintPluginFiles = [
|
|
10
|
+
"**/rules/**",
|
|
11
|
+
"**/internal-rules/**",
|
|
12
|
+
].flatMap((p) => [
|
|
13
|
+
`${p}/*.js`,
|
|
14
|
+
`${p}/*.mjs`,
|
|
15
|
+
`${p}/*.cjs`,
|
|
16
|
+
`${p}/*.ts`,
|
|
17
|
+
`${p}/*.mts`,
|
|
18
|
+
`${p}/*.cts`,
|
|
19
|
+
]);
|
|
20
|
+
exports.eslintPluginExtendRules = {
|
|
21
|
+
"eslint-plugin/consistent-output": "error",
|
|
22
|
+
"eslint-plugin/meta-property-ordering": [
|
|
23
|
+
"error",
|
|
24
|
+
[
|
|
25
|
+
"deprecated",
|
|
26
|
+
"docs",
|
|
27
|
+
"fixable",
|
|
28
|
+
"messages",
|
|
29
|
+
"replacedBy",
|
|
30
|
+
"schema",
|
|
31
|
+
"type",
|
|
32
|
+
],
|
|
33
|
+
],
|
|
34
|
+
"eslint-plugin/no-deprecated-context-methods": "error",
|
|
35
|
+
"eslint-plugin/prefer-output-null": "error",
|
|
36
|
+
"eslint-plugin/prefer-placeholders": "error",
|
|
37
|
+
"eslint-plugin/prefer-replace-text": "error",
|
|
38
|
+
"eslint-plugin/report-message-format": ["error", "[^a-z'\"{].*\\.$"],
|
|
39
|
+
"eslint-plugin/require-meta-docs-description": "error",
|
|
40
|
+
"eslint-plugin/require-meta-docs-url": [
|
|
41
|
+
"error",
|
|
42
|
+
{ pattern: rulesDocumentUrl() },
|
|
43
|
+
],
|
|
44
|
+
"eslint-plugin/require-meta-fixable": "error",
|
|
45
|
+
"eslint-plugin/require-meta-schema": "error",
|
|
46
|
+
"eslint-plugin/require-meta-type": "error",
|
|
47
|
+
"eslint-plugin/test-case-property-ordering": [
|
|
48
|
+
"error",
|
|
49
|
+
[
|
|
50
|
+
"filename",
|
|
51
|
+
"code",
|
|
52
|
+
"output",
|
|
53
|
+
"options",
|
|
54
|
+
"parser",
|
|
55
|
+
"parserOptions",
|
|
56
|
+
"globals",
|
|
57
|
+
"env",
|
|
58
|
+
"errors",
|
|
59
|
+
],
|
|
60
|
+
],
|
|
61
|
+
"eslint-plugin/test-case-shorthand-strings": "error",
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The URL of rule's documentation for the `+eslint-plugin` config.
|
|
65
|
+
* @type {string}
|
|
66
|
+
*/
|
|
67
|
+
function rulesDocumentUrl() {
|
|
68
|
+
try {
|
|
69
|
+
const { version, repository } = JSON.parse(fs_1.default.readFileSync(path_1.default.join(process.cwd(), "package.json"), "utf8"));
|
|
70
|
+
const baseUrl = getBaseUrl(repository);
|
|
71
|
+
if (baseUrl) {
|
|
72
|
+
return `${baseUrl}/blob/v${version}/docs/rules/{{name}}.md`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (_error) {
|
|
76
|
+
// ignore
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the base URL from a given repository information.
|
|
82
|
+
* @param {string|{type:string,url:string}} repository The repository information.
|
|
83
|
+
* @returns {string|null} The base URL.
|
|
84
|
+
*/
|
|
85
|
+
function getBaseUrl(repository) {
|
|
86
|
+
if (typeof repository === "string") {
|
|
87
|
+
if (/^https?:\/\//u.test(repository)) {
|
|
88
|
+
return repository.replace(/\.git$/u, "");
|
|
89
|
+
}
|
|
90
|
+
if (repository.startsWith("git+")) {
|
|
91
|
+
return repository.slice(4).replace(/\.git$/u, "");
|
|
92
|
+
}
|
|
93
|
+
if (/^[\w-]+\/[\w-]+$/iu.test(repository)) {
|
|
94
|
+
return `https://github.com/${repository}`;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (repository && typeof repository.url === "string") {
|
|
99
|
+
return getBaseUrl(repository.url);
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonExtendRules = exports.jsonFiles = void 0;
|
|
4
|
+
exports.jsonFiles = [`*.json`, `*.jsonc`, `*.json5`].flatMap((p) => [
|
|
5
|
+
p,
|
|
6
|
+
`**/${p}`,
|
|
7
|
+
]);
|
|
8
|
+
exports.jsonExtendRules = {
|
|
9
|
+
"jsonc/auto": "error",
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsInMdRules = exports.extInMdFiles = exports.jsInMdFiles = exports.mdFiles = void 0;
|
|
4
|
+
exports.mdFiles = [`*.md`].flatMap((p) => [p, `**/${p}`]);
|
|
5
|
+
exports.jsInMdFiles = exports.mdFiles.flatMap((p) => [
|
|
6
|
+
`${p}/*.js`,
|
|
7
|
+
`${p}/*.cjs`,
|
|
8
|
+
`${p}/*.mjs`,
|
|
9
|
+
`${p}/*.ts`,
|
|
10
|
+
`${p}/*.cts`,
|
|
11
|
+
`${p}/*.mts`,
|
|
12
|
+
]);
|
|
13
|
+
exports.extInMdFiles = [
|
|
14
|
+
...exports.jsInMdFiles,
|
|
15
|
+
...exports.mdFiles.flatMap((p) => [
|
|
16
|
+
`${p}/*.json`,
|
|
17
|
+
`${p}/*.json5`,
|
|
18
|
+
`${p}/*.jsonc`,
|
|
19
|
+
`${p}/*.toml`,
|
|
20
|
+
`${p}/*.yml`,
|
|
21
|
+
`${p}/*.yaml`,
|
|
22
|
+
`${p}/*.vue`,
|
|
23
|
+
`${p}/*.svelte`,
|
|
24
|
+
`${p}/*.astro`,
|
|
25
|
+
]),
|
|
26
|
+
];
|
|
27
|
+
exports.jsInMdRules = {
|
|
28
|
+
// The Markdown parser automatically trims trailing
|
|
29
|
+
// newlines from code blocks.
|
|
30
|
+
"eol-last": "off",
|
|
31
|
+
// In code snippets and examples, these rules are often
|
|
32
|
+
// counterproductive to clarity and brevity.
|
|
33
|
+
"no-undef": "off",
|
|
34
|
+
"no-unused-expressions": "off",
|
|
35
|
+
"no-unused-vars": "off",
|
|
36
|
+
"padded-blocks": "off",
|
|
37
|
+
// Adding a "use strict" directive at the top of every
|
|
38
|
+
// code block is tedious and distracting. The config
|
|
39
|
+
// opts into strict mode parsing without the directive.
|
|
40
|
+
strict: "off",
|
|
41
|
+
// The processor will not receive a Unicode Byte Order
|
|
42
|
+
// Mark from the Markdown parser.
|
|
43
|
+
"unicode-bom": "off",
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeSettings = exports.nodeExtendRules = exports.nodeEcmaFeatures = exports.nodeFiles = void 0;
|
|
4
|
+
exports.nodeFiles = [`*.js`, `*.mjs`, `*.cjs`].flatMap((p) => [
|
|
5
|
+
p,
|
|
6
|
+
`**/${p}`,
|
|
7
|
+
]);
|
|
8
|
+
exports.nodeEcmaFeatures = { globalReturn: true };
|
|
9
|
+
exports.nodeExtendRules = {
|
|
10
|
+
"n/exports-style": ["error", "module.exports"],
|
|
11
|
+
"n/file-extension-in-import": [
|
|
12
|
+
"error",
|
|
13
|
+
"always",
|
|
14
|
+
{ ".js": "always", ".ts": "never", ".tsx": "never" },
|
|
15
|
+
],
|
|
16
|
+
"n/prefer-global/buffer": "error",
|
|
17
|
+
"n/prefer-global/console": "error",
|
|
18
|
+
"n/prefer-global/process": "error",
|
|
19
|
+
"n/no-missing-require": ["error"],
|
|
20
|
+
};
|
|
21
|
+
exports.nodeSettings = {
|
|
22
|
+
node: {
|
|
23
|
+
tryExtensions: [".js", ".cjs", ".mjs", ".json", ".ts", ".cts", ".mts"],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prettierExtendRules = exports.prettierOffFiles = void 0;
|
|
4
|
+
const _md_js_1 = require("./+md.js");
|
|
5
|
+
exports.prettierOffFiles = _md_js_1.extInMdFiles;
|
|
6
|
+
exports.prettierExtendRules = {
|
|
7
|
+
"prettier/prettier": "error",
|
|
8
|
+
"jsonc/array-bracket-newline": "off",
|
|
9
|
+
"jsonc/array-bracket-spacing": "off",
|
|
10
|
+
"jsonc/array-element-newline": "off",
|
|
11
|
+
"jsonc/comma-dangle": "off",
|
|
12
|
+
"jsonc/comma-style": "off",
|
|
13
|
+
"jsonc/indent": "off",
|
|
14
|
+
"jsonc/key-spacing": "off",
|
|
15
|
+
"jsonc/no-floating-decimal": "off",
|
|
16
|
+
"jsonc/object-curly-newline": "off",
|
|
17
|
+
"jsonc/object-curly-spacing": "off",
|
|
18
|
+
"jsonc/object-property-newline": "off",
|
|
19
|
+
"jsonc/quote-props": "off",
|
|
20
|
+
"jsonc/quotes": "off",
|
|
21
|
+
"jsonc/space-unary-ops": "off",
|
|
22
|
+
"yml/block-mapping-colon-indicator-newline": "off",
|
|
23
|
+
"yml/block-mapping-question-indicator-newline": "off",
|
|
24
|
+
"yml/block-sequence-hyphen-indicator-newline": "off",
|
|
25
|
+
"yml/flow-mapping-curly-newline": "off",
|
|
26
|
+
"yml/flow-mapping-curly-spacing": "off",
|
|
27
|
+
"yml/flow-sequence-bracket-newline": "off",
|
|
28
|
+
"yml/flow-sequence-bracket-spacing": "off",
|
|
29
|
+
"yml/indent": "off",
|
|
30
|
+
"yml/key-spacing": "off",
|
|
31
|
+
"yml/no-multiple-empty-lines": "off",
|
|
32
|
+
"yml/quotes": "off",
|
|
33
|
+
"svelte/first-attribute-linebreak": "off",
|
|
34
|
+
"svelte/html-closing-bracket-spacing": "off",
|
|
35
|
+
"svelte/html-quotes": "off",
|
|
36
|
+
"svelte/html-self-closing": "off",
|
|
37
|
+
"svelte/indent": "off",
|
|
38
|
+
"svelte/max-attributes-per-line": "off",
|
|
39
|
+
"svelte/mustache-spacing": "off",
|
|
40
|
+
"svelte/no-spaces-around-equal-signs-in-attribute": "off",
|
|
41
|
+
"svelte/no-trailing-spaces": "off",
|
|
42
|
+
"svelte/shorthand-attribute": "off",
|
|
43
|
+
"svelte/shorthand-directive": "off",
|
|
44
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.svelteExtendRules = exports.svelteFiles = void 0;
|
|
4
|
+
exports.svelteFiles = [`*.svelte`].flatMap((p) => [p, `**/${p}`]);
|
|
5
|
+
exports.svelteExtendRules = {
|
|
6
|
+
"svelte/no-store-async": "error",
|
|
7
|
+
"svelte/no-reactive-functions": "error",
|
|
8
|
+
"svelte/no-reactive-literals": "error",
|
|
9
|
+
"svelte/no-useless-mustaches": "error",
|
|
10
|
+
"svelte/require-optimized-style-attribute": "error",
|
|
11
|
+
"svelte/require-stores-init": "error",
|
|
12
|
+
"svelte/derived-has-same-inputs-outputs": "error",
|
|
13
|
+
"svelte/prefer-class-directive": "warn",
|
|
14
|
+
"svelte/prefer-style-directive": "warn",
|
|
15
|
+
"svelte/spaced-html-comment": "warn",
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsTestExtendRules = exports.tsTestFiles = exports.tsFiles = void 0;
|
|
4
|
+
exports.tsFiles = [`*.ts`, `*.mts`, `*.cts`].flatMap((p) => [
|
|
5
|
+
p,
|
|
6
|
+
`**/${p}`,
|
|
7
|
+
]);
|
|
8
|
+
exports.tsTestFiles = [
|
|
9
|
+
"test/**/*.ts",
|
|
10
|
+
"tests/**/*.ts",
|
|
11
|
+
"test/**/*.mts",
|
|
12
|
+
"tests/**/*.mts",
|
|
13
|
+
"test/**/*.cts",
|
|
14
|
+
"tests/**/*.cts",
|
|
15
|
+
];
|
|
16
|
+
exports.tsTestExtendRules = {
|
|
17
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.yamlExtendRules = exports.yamlFiles = void 0;
|
|
4
|
+
exports.yamlFiles = [`*.yaml`, "*.yml"].flatMap((p) => [p, `**/${p}`]);
|
|
5
|
+
exports.yamlExtendRules = {
|
|
6
|
+
"yml/require-string-key": "error",
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eslintCommentsExtendRules = void 0;
|
|
4
|
+
exports.eslintCommentsExtendRules = {
|
|
5
|
+
"@eslint-community/eslint-comments/require-description": "error",
|
|
6
|
+
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.regexpExtendRules = void 0;
|
|
4
|
+
exports.regexpExtendRules = {
|
|
5
|
+
"regexp/letter-case": ["error"],
|
|
6
|
+
"regexp/prefer-quantifier": "error",
|
|
7
|
+
"regexp/prefer-regexp-exec": "error",
|
|
8
|
+
"regexp/prefer-regexp-test": "error",
|
|
9
|
+
"regexp/sort-character-class-elements": ["error"],
|
|
10
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonSchemaExtendRules = void 0;
|
|
4
|
+
exports.jsonSchemaExtendRules = {
|
|
5
|
+
"json-schema-validator/no-invalid": [
|
|
6
|
+
"error",
|
|
7
|
+
{
|
|
8
|
+
schemas: [
|
|
9
|
+
{
|
|
10
|
+
fileMatch: [".eslintrc.js"],
|
|
11
|
+
schema: "https://json.schemastore.org/eslintrc",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
fileMatch: [".prettierrc.toml"],
|
|
15
|
+
schema: "https://json.schemastore.org/prettierrc",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
fileMatch: [
|
|
19
|
+
"stylelint.config.js",
|
|
20
|
+
"stylelint.config.cjs",
|
|
21
|
+
".stylelintrc.js",
|
|
22
|
+
".stylelintrc.yaml",
|
|
23
|
+
".stylelintrc.yml",
|
|
24
|
+
],
|
|
25
|
+
schema: "https://json.schemastore.org/stylelintrc",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
useSchemastoreCatalog: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsExtendRules = void 0;
|
|
4
|
+
exports.tsExtendRules = {
|
|
5
|
+
"@typescript-eslint/array-type": "error",
|
|
6
|
+
"@typescript-eslint/explicit-module-boundary-types": [
|
|
7
|
+
"error",
|
|
8
|
+
{ allowArgumentsExplicitlyTypedAsAny: true },
|
|
9
|
+
],
|
|
10
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
11
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
12
|
+
"@typescript-eslint/await-thenable": "error",
|
|
13
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
14
|
+
"@typescript-eslint/naming-convention": [
|
|
15
|
+
"error",
|
|
16
|
+
{
|
|
17
|
+
selector: "default",
|
|
18
|
+
format: ["camelCase"],
|
|
19
|
+
leadingUnderscore: "allow",
|
|
20
|
+
trailingUnderscore: "allow",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
selector: "import",
|
|
24
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
selector: "variable",
|
|
28
|
+
format: ["camelCase", "UPPER_CASE"],
|
|
29
|
+
leadingUnderscore: "allow",
|
|
30
|
+
trailingUnderscore: "allow",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
selector: "typeLike",
|
|
34
|
+
format: ["PascalCase"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
selector: "memberLike",
|
|
38
|
+
format: ["camelCase", "UPPER_CASE"],
|
|
39
|
+
leadingUnderscore: "allow",
|
|
40
|
+
trailingUnderscore: "allow",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
selector: "property",
|
|
44
|
+
format: null,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
selector: "method",
|
|
48
|
+
format: null,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
52
|
+
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
53
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
54
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
55
|
+
"@typescript-eslint/no-extraneous-class": "error",
|
|
56
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
57
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
58
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
59
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
60
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
61
|
+
"@typescript-eslint/parameter-properties": "error",
|
|
62
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
63
|
+
"@typescript-eslint/no-this-alias": ["error", { allowDestructuring: true }],
|
|
64
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
65
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
66
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
67
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
68
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
69
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
70
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
71
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
72
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
73
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
74
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
75
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
76
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
77
|
+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
|
|
78
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
79
|
+
"prettier/prettier": "error",
|
|
80
|
+
// Replacements
|
|
81
|
+
camelcase: "off",
|
|
82
|
+
// "@typescript-eslint/camelcase": "error",
|
|
83
|
+
"no-empty-function": "off",
|
|
84
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
85
|
+
"no-useless-constructor": "off",
|
|
86
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
87
|
+
"require-await": "off",
|
|
88
|
+
"@typescript-eslint/require-await": "error",
|
|
89
|
+
"no-use-before-define": "off",
|
|
90
|
+
"@typescript-eslint/no-use-before-define": [
|
|
91
|
+
"error",
|
|
92
|
+
{
|
|
93
|
+
functions: false,
|
|
94
|
+
classes: true,
|
|
95
|
+
variables: true,
|
|
96
|
+
ignoreTypeReferences: true,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
"no-unused-vars": "off",
|
|
100
|
+
"@typescript-eslint/no-unused-vars": [
|
|
101
|
+
"error",
|
|
102
|
+
{
|
|
103
|
+
args: "all",
|
|
104
|
+
argsIgnorePattern: "^_(?:[^_].*)?$",
|
|
105
|
+
caughtErrors: "all",
|
|
106
|
+
vars: "all",
|
|
107
|
+
varsIgnorePattern: "^_(?:[^_].*)?$",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
// Turn off unnecessary rules
|
|
111
|
+
"n/no-unsupported-features/es-syntax": "off",
|
|
112
|
+
"n/no-missing-import": "off",
|
|
113
|
+
"n/no-extraneous-import": "off",
|
|
114
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProject = exports.tsParserOptions = exports.tsExtendRules = void 0;
|
|
4
|
+
const base_config_js_1 = require("./base-config.js");
|
|
5
|
+
Object.defineProperty(exports, "tsExtendRules", { enumerable: true, get: function () { return base_config_js_1.tsExtendRules; } });
|
|
6
|
+
const module_js_1 = require("../../../utils/module.js");
|
|
7
|
+
exports.tsParserOptions = {
|
|
8
|
+
project: getProject(),
|
|
9
|
+
extraFileExtensions: [".vue", ".svelte", ".astro"],
|
|
10
|
+
};
|
|
11
|
+
function getProject() {
|
|
12
|
+
let project = undefined;
|
|
13
|
+
try {
|
|
14
|
+
project = (0, module_js_1.resolveFromCwd)("./tsconfig.json");
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// ignore
|
|
18
|
+
}
|
|
19
|
+
return project;
|
|
20
|
+
}
|
|
21
|
+
exports.getProject = getProject;
|