@ota-meshi/eslint-plugin 0.15.3 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/lib/config-builder/+astro-with-ts.d.ts +2 -0
  2. package/lib/config-builder/+astro-with-ts.js +38 -0
  3. package/lib/config-builder/+astro.d.ts +2 -0
  4. package/lib/config-builder/+astro.js +30 -0
  5. package/lib/config-builder/+eslint-plugin.d.ts +2 -0
  6. package/lib/config-builder/+eslint-plugin.js +26 -0
  7. package/lib/config-builder/+json.d.ts +2 -0
  8. package/lib/config-builder/+json.js +32 -0
  9. package/lib/config-builder/+md.d.ts +2 -0
  10. package/lib/config-builder/+md.js +44 -0
  11. package/lib/config-builder/+node.d.ts +2 -0
  12. package/lib/config-builder/+node.js +29 -0
  13. package/lib/config-builder/+package-json.d.ts +2 -0
  14. package/lib/config-builder/+package-json.js +29 -0
  15. package/lib/config-builder/+prettier.d.ts +2 -0
  16. package/lib/config-builder/+prettier.js +28 -0
  17. package/lib/config-builder/+svelte-with-ts.d.ts +2 -0
  18. package/lib/config-builder/+svelte-with-ts.js +42 -0
  19. package/lib/config-builder/+svelte.d.ts +2 -0
  20. package/lib/config-builder/+svelte.js +30 -0
  21. package/lib/config-builder/+toml.d.ts +2 -0
  22. package/lib/config-builder/+toml.js +32 -0
  23. package/lib/config-builder/+typescript.d.ts +2 -0
  24. package/lib/config-builder/+typescript.js +17 -0
  25. package/lib/config-builder/+vue2-with-ts.d.ts +2 -0
  26. package/lib/config-builder/+vue2-with-ts.js +38 -0
  27. package/lib/config-builder/+vue2.d.ts +2 -0
  28. package/lib/config-builder/+vue2.js +30 -0
  29. package/lib/config-builder/+vue3-with-ts.d.ts +2 -0
  30. package/lib/config-builder/+vue3-with-ts.js +38 -0
  31. package/lib/config-builder/+vue3.d.ts +2 -0
  32. package/lib/config-builder/+vue3.js +30 -0
  33. package/lib/config-builder/+yaml.d.ts +2 -0
  34. package/lib/config-builder/+yaml.js +32 -0
  35. package/lib/config-builder/base-plugins/eslint-comments.d.ts +2 -0
  36. package/lib/config-builder/base-plugins/eslint-comments.js +20 -0
  37. package/lib/config-builder/base-plugins/jsdoc.d.ts +2 -0
  38. package/lib/config-builder/base-plugins/jsdoc.js +20 -0
  39. package/lib/config-builder/base-plugins/regexp.d.ts +2 -0
  40. package/lib/config-builder/base-plugins/regexp.js +20 -0
  41. package/lib/config-builder/fallback.d.ts +5 -0
  42. package/lib/config-builder/fallback.js +22 -0
  43. package/lib/config-builder/index.d.ts +20 -0
  44. package/lib/config-builder/index.js +50 -0
  45. package/lib/config-builder/plugins/json-schema.d.ts +2 -0
  46. package/lib/config-builder/plugins/json-schema.js +30 -0
  47. package/lib/config-builder/plugins/ts/base-config.d.ts +2 -0
  48. package/lib/config-builder/plugins/ts/base-config.js +48 -0
  49. package/lib/config-builder/plugins/ts/index.d.ts +1 -0
  50. package/lib/config-builder/plugins/ts/index.js +5 -0
  51. package/lib/config-builder/recommended.d.ts +5 -0
  52. package/lib/config-builder/recommended.js +40 -0
  53. package/lib/config-helpers/+astro.d.ts +3 -0
  54. package/lib/config-helpers/+astro.js +5 -0
  55. package/lib/config-helpers/+eslint-plugin.d.ts +3 -0
  56. package/lib/config-helpers/+eslint-plugin.js +102 -0
  57. package/lib/config-helpers/+json.d.ts +3 -0
  58. package/lib/config-helpers/+json.js +10 -0
  59. package/lib/config-helpers/+md.d.ts +5 -0
  60. package/lib/config-helpers/+md.js +44 -0
  61. package/lib/config-helpers/+node.d.ts +11 -0
  62. package/lib/config-helpers/+node.js +25 -0
  63. package/lib/config-helpers/+package-json.d.ts +1 -0
  64. package/lib/config-helpers/+package-json.js +4 -0
  65. package/lib/config-helpers/+prettier.d.ts +3 -0
  66. package/lib/config-helpers/+prettier.js +44 -0
  67. package/lib/config-helpers/+svelte.d.ts +3 -0
  68. package/lib/config-helpers/+svelte.js +16 -0
  69. package/lib/config-helpers/+toml.d.ts +3 -0
  70. package/lib/config-helpers/+toml.js +5 -0
  71. package/lib/config-helpers/+typescript.d.ts +4 -0
  72. package/lib/config-helpers/+typescript.js +18 -0
  73. package/lib/config-helpers/+vue.d.ts +3 -0
  74. package/lib/config-helpers/+vue.js +5 -0
  75. package/lib/config-helpers/+yaml.d.ts +3 -0
  76. package/lib/config-helpers/+yaml.js +7 -0
  77. package/lib/config-helpers/base-plugins/eslint-comments.d.ts +2 -0
  78. package/lib/config-helpers/base-plugins/eslint-comments.js +7 -0
  79. package/lib/config-helpers/base-plugins/jsdoc.d.ts +2 -0
  80. package/lib/config-helpers/base-plugins/jsdoc.js +6 -0
  81. package/lib/config-helpers/base-plugins/regexp.d.ts +2 -0
  82. package/lib/config-helpers/base-plugins/regexp.js +10 -0
  83. package/lib/config-helpers/plugins/json-schema.d.ts +2 -0
  84. package/lib/config-helpers/plugins/json-schema.js +31 -0
  85. package/lib/config-helpers/plugins/ts/base-config.d.ts +2 -0
  86. package/lib/config-helpers/plugins/ts/base-config.js +116 -0
  87. package/lib/config-helpers/plugins/ts/index.d.ts +7 -0
  88. package/lib/config-helpers/plugins/ts/index.js +21 -0
  89. package/lib/config-helpers/recommended.d.ts +5 -0
  90. package/lib/config-helpers/recommended.js +240 -0
  91. package/lib/configs/+eslint-plugin.d.ts +3 -0
  92. package/lib/configs/+eslint-plugin.js +22 -95
  93. package/lib/configs/+json.d.ts +3 -0
  94. package/lib/configs/+json.js +22 -22
  95. package/lib/configs/+md.d.ts +3 -0
  96. package/lib/configs/+md.js +30 -29
  97. package/lib/configs/+node.d.ts +3 -0
  98. package/lib/configs/+node.js +23 -29
  99. package/lib/configs/+package-json.d.ts +3 -0
  100. package/lib/configs/+package-json.js +20 -20
  101. package/lib/configs/+prettier.d.ts +3 -0
  102. package/lib/configs/+prettier.js +23 -70
  103. package/lib/configs/+svelte-with-ts.d.ts +3 -0
  104. package/lib/configs/+svelte-with-ts.js +47 -25
  105. package/lib/configs/+svelte.d.ts +3 -0
  106. package/lib/configs/+svelte.js +23 -32
  107. package/lib/configs/+toml.d.ts +3 -0
  108. package/lib/configs/+toml.js +20 -18
  109. package/lib/configs/+typescript.d.ts +3 -0
  110. package/lib/configs/+typescript.js +53 -32
  111. package/lib/configs/+vue2-with-ts.d.ts +3 -0
  112. package/lib/configs/+vue2-with-ts.js +48 -25
  113. package/lib/configs/+vue2.d.ts +3 -0
  114. package/lib/configs/+vue2.js +24 -25
  115. package/lib/configs/+vue3-with-ts.d.ts +3 -0
  116. package/lib/configs/+vue3-with-ts.js +48 -25
  117. package/lib/configs/+vue3.d.ts +3 -0
  118. package/lib/configs/+vue3.js +24 -25
  119. package/lib/configs/+yaml.d.ts +3 -0
  120. package/lib/configs/+yaml.js +22 -22
  121. package/lib/configs/base-plugins/eslint-comments.d.ts +3 -0
  122. package/lib/configs/base-plugins/eslint-comments.js +7 -9
  123. package/lib/configs/base-plugins/jsdoc.d.ts +3 -0
  124. package/lib/configs/base-plugins/jsdoc.js +10 -0
  125. package/lib/configs/base-plugins/regexp.d.ts +3 -0
  126. package/lib/configs/base-plugins/regexp.js +6 -11
  127. package/lib/configs/fallback.d.ts +5 -0
  128. package/lib/configs/fallback.js +15 -0
  129. package/lib/configs/json-schema/config.d.ts +3 -0
  130. package/lib/configs/json-schema/config.js +14 -31
  131. package/lib/configs/recommended.d.ts +26 -0
  132. package/lib/configs/recommended.js +26 -255
  133. package/lib/configs/ts/base-config.d.ts +10 -0
  134. package/lib/configs/ts/base-config.js +10 -118
  135. package/lib/configs/ts/index.d.ts +2 -0
  136. package/lib/configs/ts/index.js +4 -16
  137. package/lib/index.d.ts +48 -0
  138. package/lib/index.js +15 -23
  139. package/lib/parsers/any-parser.d.ts +5 -0
  140. package/lib/parsers/any-parser.js +29 -0
  141. package/lib/rules/missing-module-for-config.d.ts +16 -0
  142. package/lib/rules/missing-module-for-config.js +35 -53
  143. package/lib/utils/find-root-dir.d.ts +1 -0
  144. package/lib/utils/find-root-dir.js +21 -18
  145. package/lib/utils/get-linters.d.ts +1 -0
  146. package/lib/utils/get-linters.js +27 -27
  147. package/lib/utils/module.d.ts +19 -0
  148. package/lib/utils/module.js +81 -59
  149. package/package.json +23 -14
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildESLintComments = void 0;
4
+ const eslint_comments_js_1 = require("../../config-helpers/base-plugins/eslint-comments.js");
5
+ const module_js_1 = require("../../utils/module.js");
6
+ const fallback_js_1 = require("../fallback.js");
7
+ function buildESLintComments() {
8
+ return (0, module_js_1.requireOf)(["@eslint-community/eslint-plugin-eslint-comments@4.3.0"], () => {
9
+ const comments = require("@eslint-community/eslint-plugin-eslint-comments/configs");
10
+ return [
11
+ comments.recommended,
12
+ {
13
+ rules: {
14
+ ...eslint_comments_js_1.eslintCommentsExtendRules,
15
+ },
16
+ },
17
+ ];
18
+ }, fallback_js_1.buildFallback);
19
+ }
20
+ exports.buildESLintComments = buildESLintComments;
@@ -0,0 +1,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildJsdoc(): Linter.FlatConfig<Linter.RulesRecord>[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildJsdoc = void 0;
4
+ const module_js_1 = require("../../utils/module.js");
5
+ const fallback_js_1 = require("../fallback.js");
6
+ const jsdoc_js_1 = require("../../config-helpers/base-plugins/jsdoc.js");
7
+ function buildJsdoc() {
8
+ return (0, module_js_1.requireOf)(["eslint-plugin-jsdoc"], () => {
9
+ const jsdoc = require("eslint-plugin-jsdoc");
10
+ return [
11
+ {
12
+ plugins: { jsdoc },
13
+ rules: {
14
+ ...jsdoc_js_1.jsdocRules,
15
+ },
16
+ },
17
+ ];
18
+ }, fallback_js_1.buildFallback);
19
+ }
20
+ exports.buildJsdoc = buildJsdoc;
@@ -0,0 +1,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildRegexp(): Linter.FlatConfig<Linter.RulesRecord>[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildRegexp = void 0;
4
+ const module_js_1 = require("../../utils/module.js");
5
+ const fallback_js_1 = require("../fallback.js");
6
+ const regexp_js_1 = require("../../config-helpers/base-plugins/regexp.js");
7
+ function buildRegexp() {
8
+ return (0, module_js_1.requireOf)(["eslint-plugin-regexp@2.5.0"], () => {
9
+ const regexpPlugin = require("eslint-plugin-regexp");
10
+ return [
11
+ regexpPlugin.configs["flat/recommended"],
12
+ {
13
+ rules: {
14
+ ...regexp_js_1.regexpExtendRules,
15
+ },
16
+ },
17
+ ];
18
+ }, fallback_js_1.buildFallback);
19
+ }
20
+ exports.buildRegexp = buildRegexp;
@@ -0,0 +1,5 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * Fallback Legacy config builder
4
+ */
5
+ export declare function buildFallback(missingList: string[], files?: string[]): Linter.FlatConfig[];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildFallback = void 0;
4
+ /**
5
+ * Fallback Legacy config builder
6
+ */
7
+ function buildFallback(missingList, files) {
8
+ return [
9
+ {
10
+ plugins: {
11
+ get "@ota-meshi"() {
12
+ return require("../index.js");
13
+ },
14
+ },
15
+ rules: {
16
+ "@ota-meshi/missing-module-for-config": ["error", missingList],
17
+ },
18
+ ...(files ? { files } : {}),
19
+ },
20
+ ];
21
+ }
22
+ exports.buildFallback = buildFallback;
@@ -0,0 +1,20 @@
1
+ import type { Linter } from "eslint";
2
+ export type BuildConfigOptions = {
3
+ node?: boolean;
4
+ packageJson?: boolean;
5
+ eslintPlugin?: boolean;
6
+ vue3?: boolean;
7
+ vue2?: boolean;
8
+ svelte?: boolean;
9
+ astro?: boolean;
10
+ ts?: boolean;
11
+ json?: boolean;
12
+ yaml?: boolean;
13
+ toml?: boolean;
14
+ md?: boolean;
15
+ prettier?: boolean;
16
+ };
17
+ /**
18
+ * Build config
19
+ */
20
+ export declare function buildConfig(options: BuildConfigOptions): Linter.FlatConfig[];
@@ -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,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildJsonSchema(files: string[]): Linter.FlatConfig<Linter.RulesRecord>[];
@@ -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,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare function buildTS(files: string[]): Linter.FlatConfig<Linter.RulesRecord>[];
@@ -0,0 +1,48 @@
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
+ const _md_js_1 = require("../../../config-helpers/+md.js");
9
+ function buildTS(files) {
10
+ return (0, module_js_1.requireOf)([
11
+ "typescript",
12
+ "typescript-eslint",
13
+ "@typescript-eslint/eslint-plugin",
14
+ "@typescript-eslint/parser",
15
+ ], () => {
16
+ const tseslint = (0, module_js_1.requireFromCwd)("typescript-eslint");
17
+ return [
18
+ ...tseslint.config({
19
+ files,
20
+ extends: [
21
+ ...tseslint.configs.recommended,
22
+ {
23
+ languageOptions: {
24
+ parserOptions: {
25
+ ...index_js_1.tsParserOptions,
26
+ },
27
+ },
28
+ },
29
+ ],
30
+ rules: {
31
+ ...index_js_1.tsExtendRules,
32
+ },
33
+ }, {
34
+ files: _md_js_1.extInMdFiles,
35
+ extends: [tseslint.configs.disableTypeChecked],
36
+ }),
37
+ ];
38
+ }, (missingList) => [
39
+ {
40
+ files,
41
+ languageOptions: {
42
+ parser: any_parser_js_1.anyParser,
43
+ },
44
+ ...(0, fallback_js_1.buildFallback)(missingList),
45
+ },
46
+ ]);
47
+ }
48
+ exports.buildTS = buildTS;
@@ -0,0 +1 @@
1
+ export { buildTS } from "./base-config.js";
@@ -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,5 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * Build recommended config
4
+ */
5
+ export declare function buildRecommended(): Linter.FlatConfig[];
@@ -0,0 +1,40 @@
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
+ const jsdoc_js_1 = require("./base-plugins/jsdoc.js");
13
+ /**
14
+ * Build recommended config
15
+ */
16
+ function buildRecommended() {
17
+ return [
18
+ js_1.default.configs.recommended,
19
+ ...(0, eslint_comments_js_1.buildESLintComments)(),
20
+ ...(0, regexp_js_1.buildRegexp)(),
21
+ ...(0, jsdoc_js_1.buildJsdoc)(),
22
+ {
23
+ rules: {
24
+ ...recommended_js_1.recommendedRules,
25
+ },
26
+ },
27
+ {
28
+ files: recommended_js_1.recommendedTestFiles,
29
+ languageOptions: {
30
+ globals: {
31
+ ...recommended_js_1.recommendedTestGlobals,
32
+ },
33
+ },
34
+ rules: {
35
+ ...recommended_js_1.recommendedTestRules,
36
+ },
37
+ },
38
+ ];
39
+ }
40
+ exports.buildRecommended = buildRecommended;
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const astroFiles: string[];
3
+ export declare const astroExtendRules: Linter.RulesRecord;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.astroExtendRules = exports.astroFiles = void 0;
4
+ exports.astroFiles = [`*.astro`].flatMap((p) => [p, `**/${p}`]);
5
+ exports.astroExtendRules = {};
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const eslintPluginFiles: string[];
3
+ export declare const eslintPluginExtendRules: Linter.RulesRecord;
@@ -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,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const jsonFiles: string[];
3
+ export declare const jsonExtendRules: Linter.RulesRecord;
@@ -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,5 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const mdFiles: string[];
3
+ export declare const jsInMdFiles: string[];
4
+ export declare const extInMdFiles: string[];
5
+ export declare const jsInMdRules: Linter.RulesRecord;
@@ -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,11 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const nodeFiles: string[];
3
+ export declare const nodeEcmaFeatures: {
4
+ globalReturn: boolean;
5
+ };
6
+ export declare const nodeExtendRules: Linter.RulesRecord;
7
+ export declare const nodeSettings: {
8
+ node: {
9
+ tryExtensions: string[];
10
+ };
11
+ };
@@ -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 @@
1
+ export declare const packageJsonFiles: string[];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageJsonFiles = void 0;
4
+ exports.packageJsonFiles = [`package.json`].flatMap((p) => [p, `**/${p}`]);
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const prettierOffFiles: string[];
3
+ export declare const prettierExtendRules: Linter.RulesRecord;
@@ -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,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const svelteFiles: string[];
3
+ export declare const svelteExtendRules: Linter.RulesRecord;
@@ -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,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const tomlFiles: string[];
3
+ export declare const tomlExtendRules: Linter.RulesRecord;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tomlExtendRules = exports.tomlFiles = void 0;
4
+ exports.tomlFiles = [`*.toml`].flatMap((p) => [p, `**/${p}`]);
5
+ exports.tomlExtendRules = {};
@@ -0,0 +1,4 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const tsFiles: string[];
3
+ export declare const tsTestFiles: string[];
4
+ export declare const tsTestExtendRules: Linter.RulesRecord;