@eslinted/core 8.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. package/.github/workflows/RELEASE.yml +36 -36
  2. package/.github/workflows/rc.yml +36 -36
  3. package/.markdownlint.jsonc +122 -122
  4. package/LICENSE +21 -21
  5. package/README.md +5 -5
  6. package/SECURITY.md +9 -9
  7. package/eslint.config.js +3 -3
  8. package/package.json +96 -96
  9. package/src/factory/files.ts +26 -26
  10. package/src/factory/index.ts +27 -27
  11. package/src/factory/options/html.ts +18 -18
  12. package/src/factory/options/index.ts +21 -21
  13. package/src/factory/options/js.ts +13 -13
  14. package/src/factory/options/json.ts +18 -18
  15. package/src/factory/options/jsonc.ts +18 -18
  16. package/src/factory/options/mocha.ts +28 -28
  17. package/src/factory/options/option/index.ts +91 -91
  18. package/src/factory/options/option/template/globals.ts +5 -5
  19. package/src/factory/options/option/template/index.ts +26 -26
  20. package/src/factory/options/option/template/language/ecma.ts +3 -3
  21. package/src/factory/options/option/template/language/index.ts +21 -21
  22. package/src/factory/options/option/template/language/source.ts +4 -4
  23. package/src/factory/options/option/template/linter.ts +8 -8
  24. package/src/factory/options/option/template/plugins.ts +1 -1
  25. package/src/factory/options/svelte.ts +32 -32
  26. package/src/factory/options/ts.ts +24 -24
  27. package/src/factory/options/yml.ts +18 -18
  28. package/src/factory/rulesets/index.ts +24 -24
  29. package/src/factory/rulesets/ruleset.ts +25 -25
  30. package/src/index.ts +77 -77
  31. package/src/input/files.ts +6 -6
  32. package/src/input/imports/parsers.ts +10 -10
  33. package/src/input/imports/plugins.ts +9 -9
  34. package/src/input/index.ts +23 -23
  35. package/src/input/parsers.ts +3 -3
  36. package/src/input/plugins.ts +3 -3
  37. package/src/input/rules/entry/index.ts +7 -7
  38. package/src/input/rules/entry/record/index.ts +3 -3
  39. package/src/input/rules/entry/record/state.ts +5 -5
  40. package/src/input/rules/index.ts +14 -14
  41. package/src/output.ts +24 -24
  42. package/src/scopes.spec.ts +37 -37
  43. package/src/scopes.ts +11 -11
  44. package/tsconfig.json +163 -163
  45. package/typings/common/literals/number/bases/base32.d.ts +19 -19
  46. package/typings/common/literals/number/bases/base64.d.ts +35 -35
  47. package/typings/common/literals/number/bases/binary.d.ts +4 -4
  48. package/typings/common/literals/number/bases/decimal.d.ts +5 -5
  49. package/typings/common/literals/number/bases/hex.d.ts +10 -10
  50. package/typings/common/literals/number/bases/octal.d.ts +7 -7
  51. package/typings/common/literals/number/bases/quatral.d.ts +4 -4
  52. package/typings/common/literals/number/bases/ternary.d.ts +4 -4
  53. package/typings/common/literals/string/letter/digit/extended/base64/index.d.ts +13 -13
  54. package/typings/common/literals/string/letter/digit/extended/hex/index.d.ts +9 -9
  55. package/typings/common/literals/string/letter/digit/index.d.ts +12 -12
  56. package/typings/common/literals/string/letter/index.d.ts +35 -35
  57. package/typings/common/primitive/index.d.ts +5 -5
  58. package/typings/common/safe/index.d.ts +2 -2
  59. package/typings/common/safe/numbers/finite/index.d.ts +2 -2
  60. package/typings/common/safe/numbers/fint.d.ts +1 -1
  61. package/typings/common/safe/numbers/integer/index.d.ts +2 -2
  62. package/typings/common/safe/numbers/integer/numberful/index.d.ts +1 -1
  63. package/typings/common/safe/numbers/polarity/negative.d.ts +4 -4
  64. package/typings/common/safe/numbers/polarity/pole/index.d.ts +18 -18
  65. package/typings/common/safe/numbers/polarity/positive.d.ts +4 -4
  66. package/typings/common/safe/strings/char.d.ts +1 -1
  67. package/typings/common/safe/strings/stringful/index.d.ts +1 -1
  68. package/typings/common/safe/strings/stringful/length/index.d.ts +3 -3
  69. package/typings/common/utility/interface/build/particord/index.d.ts +1 -1
  70. package/typings/common/utility/interface/build/properties/Field.d.ts +1 -1
  71. package/typings/common/utility/interface/build/properties/Flag.d.ts +1 -1
  72. package/typings/common/utility/interface/build/properties/Limit.d.ts +8 -8
  73. package/typings/common/utility/interface/build/properties/List.d.ts +1 -1
  74. package/typings/common/utility/interface/build/properties/Listish.d.ts +1 -1
  75. package/typings/common/utility/interface/build/properties/Scalar.d.ts +1 -1
  76. package/typings/common/utility/interface/build/properties/property/index.d.ts +8 -8
  77. package/typings/common/utility/interface/build/recordful/index.d.ts +5 -5
  78. package/typings/common/utility/interface/build/tables/FieldTable.d.ts +1 -1
  79. package/typings/common/utility/interface/build/tables/FlagTable.d.ts +1 -1
  80. package/typings/common/utility/interface/build/tables/ListTable.d.ts +1 -1
  81. package/typings/common/utility/interface/build/tables/ListishTable.d.ts +1 -1
  82. package/typings/common/utility/interface/build/tables/ScalarTable.d.ts +1 -1
  83. package/typings/common/utility/interface/build/tables/table/index.d.ts +3 -3
  84. package/typings/common/utility/interface/identity/interface/index.d.ts +80 -80
  85. package/typings/common/utility/interface/identity/keys/index.d.ts +71 -71
  86. package/typings/common/utility/interface/transform/partial/unrequire/index.d.ts +45 -45
  87. package/typings/common/utility/iterable/build/arrays/array/index.d.ts +11 -11
  88. package/typings/common/utility/iterable/build/arrays/index.d.ts +2 -2
  89. package/typings/common/utility/iterable/build/tuples/index.d.ts +10 -10
  90. package/typings/common/utility/iterable/build/tuples/tuple/index.d.ts +26 -26
  91. package/typings/common/utility/iterable/identity/array/index.d.ts +65 -65
  92. package/typings/common/utility/iterable/identity/array/length/index.d.ts +16 -16
  93. package/typings/common/utility/iterable/identity/dyad.d.ts +3 -3
  94. package/typings/common/utility/iterable/identity/monad.d.ts +48 -48
  95. package/typings/common/utility/iterable/identity/triad.d.ts +3 -3
  96. package/typings/common/utility/iterable/transform/flat/index.d.ts +3 -3
  97. package/typings/common/utility/iterable/transform/flat/unflat/index.d.ts +3 -3
  98. package/typings/common/utility/iterable/transform/string/index.d.ts +30 -30
  99. package/typings/common/utility/iterable/transform/string/stringify/index.d.ts +27 -27
  100. package/typings/common/utility/nullable/index.d.ts +1 -1
  101. package/typings/common/utility/nullable/index.spec.d.ts +13 -13
  102. package/typings/common/utility/nullable/null/index.d.ts +1 -1
  103. package/typings/common/utility/nullable/null/index.spec.d.ts +13 -13
  104. package/typings/common/utility/object/build/index.d.ts +3 -3
  105. package/typings/common/utility/primitive/boolean/true/index.d.ts +30 -30
  106. package/typings/common/utility/primitive/index.d.ts +42 -42
  107. package/typings/common/utility/primitive/number/length/index.d.ts +35 -35
  108. package/typings/common/utility/primitive/number/length/numbered/index.d.ts +35 -35
  109. package/typings/common/utility/primitive/string/fake/index.d.ts +1 -1
  110. package/typings/common/utility/primitive/string/literalful/index.d.ts +28 -28
  111. package/typings/common/utility/primitive/string/literalful/literal/index.d.ts +22 -22
  112. package/typings/common/utility/test.d.ts +2 -2
  113. package/typings/common/valid/index.d.ts +7 -7
  114. package/typings/common/valid/string/index.d.ts +1 -1
package/src/index.ts CHANGED
@@ -1,77 +1,77 @@
1
- export type { Scope } from "./scopes";
2
-
3
- import type { Input } from "./input";
4
- import type { Output } from "./output";
5
-
6
- export type { Input, Output };
7
-
8
- import { scopes } from "./scopes";
9
- import {
10
- Factory,
11
- Options,
12
- } from "./factory";
13
-
14
- export default function (input: Input): Output {
15
- try {
16
- const {
17
- parsers,
18
- plugins,
19
- files,
20
- rules,
21
- } = input,
22
- factory = new Factory(files, rules),
23
- options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
24
- js: new Options
25
- .js(
26
- { "@stylistic": plugins["@stylistic"] },
27
- [],
28
- ...factory.produce("js"),
29
- ).configs,
30
- ts: new Options
31
- .ts(
32
- { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
33
- [parsers.ts],
34
- ...factory.produce("ts"),
35
- ).configs,
36
- svelte: new Options
37
- .svelte(
38
- { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
39
- [parsers.svelte, parsers.ts],
40
- ...factory.produce("svelte"),
41
- ).configs,
42
- mocha: new Options
43
- .mocha(
44
- { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
45
- [parsers.ts],
46
- ...factory.produce("mocha"),
47
- ).configs,
48
- html: new Options
49
- .html(
50
- { "@html-eslint": plugins["@html-eslint"] },
51
- [parsers.html],
52
- ...factory.produce("html"),
53
- ).configs,
54
- json: new Options
55
- .json(
56
- { jsonc: plugins.jsonc },
57
- [parsers.jsonc],
58
- ...factory.produce("json"),
59
- ).configs,
60
- jsonc: new Options
61
- .jsonc(
62
- { jsonc: plugins.jsonc },
63
- [parsers.jsonc],
64
- ...factory.produce("jsonc"),
65
- ).configs,
66
- yml: new Options
67
- .yml(
68
- { yml: plugins.yml },
69
- [parsers.yml],
70
- ...factory.produce("yml"),
71
- ).configs,
72
- };
73
-
74
- return scopes.flatMap(scope => options[scope]);
75
- }
76
- catch (e) { throw new Error(`linted-core`, { cause: e }); }
77
- }
1
+ export type { Scope } from "./scopes";
2
+
3
+ import type { Input } from "./input";
4
+ import type { Output } from "./output";
5
+
6
+ export type { Input, Output };
7
+
8
+ import { scopes } from "./scopes";
9
+ import {
10
+ Factory,
11
+ Options,
12
+ } from "./factory";
13
+
14
+ export default function (input: Input): Output {
15
+ try {
16
+ const {
17
+ parsers,
18
+ plugins,
19
+ files,
20
+ rules,
21
+ } = input,
22
+ factory = new Factory(files, rules),
23
+ options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
24
+ js: new Options
25
+ .js(
26
+ { "@stylistic": plugins["@stylistic"] },
27
+ [],
28
+ ...factory.produce("js"),
29
+ ).configs,
30
+ ts: new Options
31
+ .ts(
32
+ { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
33
+ [parsers.ts],
34
+ ...factory.produce("ts"),
35
+ ).configs,
36
+ svelte: new Options
37
+ .svelte(
38
+ { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
39
+ [parsers.svelte, parsers.ts],
40
+ ...factory.produce("svelte"),
41
+ ).configs,
42
+ mocha: new Options
43
+ .mocha(
44
+ { "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
45
+ [parsers.ts],
46
+ ...factory.produce("mocha"),
47
+ ).configs,
48
+ html: new Options
49
+ .html(
50
+ { "@html-eslint": plugins["@html-eslint"] },
51
+ [parsers.html],
52
+ ...factory.produce("html"),
53
+ ).configs,
54
+ json: new Options
55
+ .json(
56
+ { jsonc: plugins.jsonc },
57
+ [parsers.jsonc],
58
+ ...factory.produce("json"),
59
+ ).configs,
60
+ jsonc: new Options
61
+ .jsonc(
62
+ { jsonc: plugins.jsonc },
63
+ [parsers.jsonc],
64
+ ...factory.produce("jsonc"),
65
+ ).configs,
66
+ yml: new Options
67
+ .yml(
68
+ { yml: plugins.yml },
69
+ [parsers.yml],
70
+ ...factory.produce("yml"),
71
+ ).configs,
72
+ };
73
+
74
+ return scopes.flatMap(scope => options[scope]);
75
+ }
76
+ catch (e) { throw new Error(`linted-core`, { cause: e }); }
77
+ }
@@ -1,6 +1,6 @@
1
- import type { Scope } from ".";
2
-
3
- export interface FilesInput {
4
- files: Record<Scope, string[]>;
5
- includes: Partial<FilesInput["files"]>;
6
- }
1
+ import type { Scope } from ".";
2
+
3
+ export interface FilesInput {
4
+ files: Record<Scope, string[]>;
5
+ includes: Partial<FilesInput["files"]>;
6
+ }
@@ -1,10 +1,10 @@
1
- import type { Scope } from "..";
2
-
3
- export type Parsers = Scope
4
- & (
5
- | "ts"
6
- | "svelte"
7
- | "html"
8
- | "jsonc"
9
- | "yml"
10
- );
1
+ import type { Scope } from "..";
2
+
3
+ export type Parsers = Scope
4
+ & (
5
+ | "ts"
6
+ | "svelte"
7
+ | "html"
8
+ | "jsonc"
9
+ | "yml"
10
+ );
@@ -1,9 +1,9 @@
1
- export type Plugins = (
2
- | "@stylistic"
3
- | "@typescript-eslint"
4
- | "svelte"
5
- | "mocha"
6
- | "@html-eslint"
7
- | "jsonc"
8
- | "yml"
9
- );
1
+ export type Plugins = (
2
+ | "@stylistic"
3
+ | "@typescript-eslint"
4
+ | "svelte"
5
+ | "mocha"
6
+ | "@html-eslint"
7
+ | "jsonc"
8
+ | "yml"
9
+ );
@@ -1,23 +1,23 @@
1
- export type { Scope } from "../scopes";
2
-
3
- import type { PluginsInput } from "./plugins";
4
- import type { ParsersInput } from "./parsers";
5
- import type { FilesInput } from "./files";
6
- import type { RulesInput } from "./rules";
7
-
8
- export interface Input {
9
- plugins: PluginsInput;
10
- parsers: ParsersInput;
11
- files: FilesInput;
12
- rules: RulesInput;
13
- }
14
- export namespace Input {
15
- export type Rule = RulesInput;
16
- export namespace Rule {
17
- export type Entry = RulesInput.Entry;
18
- export namespace Entry {
19
- export type Id = RulesInput.Entry.Id;
20
- export type Record = RulesInput.Entry.Record;
21
- }
22
- }
23
- }
1
+ export type { Scope } from "../scopes";
2
+
3
+ import type { PluginsInput } from "./plugins";
4
+ import type { ParsersInput } from "./parsers";
5
+ import type { FilesInput } from "./files";
6
+ import type { RulesInput } from "./rules";
7
+
8
+ export interface Input {
9
+ plugins: PluginsInput;
10
+ parsers: ParsersInput;
11
+ files: FilesInput;
12
+ rules: RulesInput;
13
+ }
14
+ export namespace Input {
15
+ export type Rule = RulesInput;
16
+ export namespace Rule {
17
+ export type Entry = RulesInput.Entry;
18
+ export namespace Entry {
19
+ export type Id = RulesInput.Entry.Id;
20
+ export type Record = RulesInput.Entry.Record;
21
+ }
22
+ }
23
+ }
@@ -1,3 +1,3 @@
1
- import type { Parsers } from "./imports/parsers";
2
-
3
- export type ParsersInput = Record<Parsers, unknown>;
1
+ import type { Parsers } from "./imports/parsers";
2
+
3
+ export type ParsersInput = Record<Parsers, unknown>;
@@ -1,3 +1,3 @@
1
- import type { Plugins } from "./imports/plugins";
2
-
3
- export type PluginsInput = Record<Plugins, { configs: unknown }>;
1
+ import type { Plugins } from "./imports/plugins";
2
+
3
+ export type PluginsInput = Record<Plugins, { configs: unknown }>;
@@ -1,7 +1,7 @@
1
- import type { RuleRecord } from "./record";
2
-
3
- export type RuleEntry = readonly [string, RuleRecord];
4
- export namespace RuleEntry {
5
- export type Id = string;
6
- export type Record = RuleRecord;
7
- }
1
+ import type { RuleRecord } from "./record";
2
+
3
+ export type RuleEntry = readonly [string, RuleRecord];
4
+ export namespace RuleEntry {
5
+ export type Id = string;
6
+ export type Record = RuleRecord;
7
+ }
@@ -1,3 +1,3 @@
1
- import type { RuleState } from "./state";
2
-
3
- export type RuleRecord = Table<RuleState | readonly [RuleState, ...unknown[]]>;
1
+ import type { RuleState } from "./state";
2
+
3
+ export type RuleRecord = Table<RuleState | readonly [RuleState, ...unknown[]]>;
@@ -1,5 +1,5 @@
1
- export type RuleState = (
2
- | "error"
3
- | "warn"
4
- | "off"
5
- );
1
+ export type RuleState = (
2
+ | "error"
3
+ | "warn"
4
+ | "off"
5
+ );
@@ -1,14 +1,14 @@
1
- import type { Scope } from "..";
2
- import type { RuleEntry } from "./entry";
3
-
4
- export interface RulesInput {
5
- rules: Record<Scope, RuleEntry[]>;
6
- overrides: Partial<Record<Scope, RuleEntry.Record>>;
7
- }
8
- export namespace RulesInput {
9
- export type Entry = RuleEntry;
10
- export namespace Entry {
11
- export type Id = RuleEntry.Id;
12
- export type Record = RuleEntry.Record;
13
- }
14
- }
1
+ import type { Scope } from "..";
2
+ import type { RuleEntry } from "./entry";
3
+
4
+ export interface RulesInput {
5
+ rules: Record<Scope, RuleEntry[]>;
6
+ overrides: Partial<Record<Scope, RuleEntry.Record>>;
7
+ }
8
+ export namespace RulesInput {
9
+ export type Entry = RuleEntry;
10
+ export namespace Entry {
11
+ export type Id = RuleEntry.Id;
12
+ export type Record = RuleEntry.Record;
13
+ }
14
+ }
package/src/output.ts CHANGED
@@ -1,24 +1,24 @@
1
- import type { Input } from ".";
2
-
3
- export type Output = (
4
- {
5
- name: `linted/${string}`;
6
- rules: Input["rules"]["rules"]["html"][number][1];
7
- files: string[];
8
- linterOptions: {
9
- noInlineConfig: true;
10
- reportUnusedDisableDirectives: "error";
11
- };
12
- languageOptions: {
13
- sourceType?:
14
- | "module"
15
- | "script";
16
- ecmaVersion?: "latest";
17
- globals?: Table<true>;
18
- parser?: unknown;
19
- parserOptions?: Table;
20
- };
21
- plugins: Table<Record<"configs", unknown>>;
22
- processor?: string;
23
- }
24
- )[];
1
+ import type { Input } from ".";
2
+
3
+ export type Output = (
4
+ {
5
+ name: `linted/${string}`;
6
+ rules: Input["rules"]["rules"]["html"][number][1];
7
+ files: string[];
8
+ linterOptions: {
9
+ noInlineConfig: true;
10
+ reportUnusedDisableDirectives: "error";
11
+ };
12
+ languageOptions: {
13
+ sourceType?:
14
+ | "module"
15
+ | "script";
16
+ ecmaVersion?: "latest";
17
+ globals?: Table<true>;
18
+ parser?: unknown;
19
+ parserOptions?: Table;
20
+ };
21
+ plugins: Table<Record<"configs", unknown>>;
22
+ processor?: string;
23
+ }
24
+ )[];
@@ -1,37 +1,37 @@
1
- import { expect } from "chai";
2
- import { scopes } from "./scopes";
3
-
4
- describe("Scopes", function () {
5
- describe("shape", function () {
6
- it("is a non-empty array", function () {
7
- expect(scopes)
8
- .an("array")
9
- .with.lengthOf.at.least(1);
10
- });
11
- });
12
- describe("order", function () {
13
- it("jsonc > json", function () {
14
- expect(scopes)
15
- .includes.members(["jsonc", "json"]);
16
- expect(scopes.indexOf("jsonc"))
17
- .greaterThan(scopes.indexOf("json"));
18
- });
19
- it("ts > js", function () {
20
- expect(scopes)
21
- .includes.members(["ts", "js"]);
22
- expect(scopes.indexOf("ts"))
23
- .greaterThan(scopes.indexOf("js"));
24
- });
25
- it("mocha > ts", function () {
26
- expect(scopes)
27
- .includes.members(["mocha", "ts"]);
28
- expect(scopes.indexOf("mocha"))
29
- .greaterThan(scopes.indexOf("ts"));
30
- });
31
- it("svelte > ts", function () {
32
- expect(scopes).includes.members(["svelte", "ts"]);
33
- expect(scopes.indexOf("svelte"))
34
- .greaterThan(scopes.indexOf("ts"));
35
- });
36
- });
37
- });
1
+ import { expect } from "chai";
2
+ import { scopes } from "./scopes";
3
+
4
+ describe("Scopes", function () {
5
+ describe("shape", function () {
6
+ it("is a non-empty array", function () {
7
+ expect(scopes)
8
+ .an("array")
9
+ .with.lengthOf.at.least(1);
10
+ });
11
+ });
12
+ describe("order", function () {
13
+ it("jsonc > json", function () {
14
+ expect(scopes)
15
+ .includes.members(["jsonc", "json"]);
16
+ expect(scopes.indexOf("jsonc"))
17
+ .greaterThan(scopes.indexOf("json"));
18
+ });
19
+ it("ts > js", function () {
20
+ expect(scopes)
21
+ .includes.members(["ts", "js"]);
22
+ expect(scopes.indexOf("ts"))
23
+ .greaterThan(scopes.indexOf("js"));
24
+ });
25
+ it("mocha > ts", function () {
26
+ expect(scopes)
27
+ .includes.members(["mocha", "ts"]);
28
+ expect(scopes.indexOf("mocha"))
29
+ .greaterThan(scopes.indexOf("ts"));
30
+ });
31
+ it("svelte > ts", function () {
32
+ expect(scopes).includes.members(["svelte", "ts"]);
33
+ expect(scopes.indexOf("svelte"))
34
+ .greaterThan(scopes.indexOf("ts"));
35
+ });
36
+ });
37
+ });
package/src/scopes.ts CHANGED
@@ -1,11 +1,11 @@
1
- export type Scope = typeof scopes[number];
2
- export const scopes = [
3
- "js",
4
- "ts",
5
- "svelte",
6
- "mocha",
7
- "html",
8
- "json",
9
- "jsonc",
10
- "yml",
11
- ] as const;
1
+ export type Scope = typeof scopes[number];
2
+ export const scopes = [
3
+ "js",
4
+ "ts",
5
+ "svelte",
6
+ "mocha",
7
+ "html",
8
+ "json",
9
+ "jsonc",
10
+ "yml",
11
+ ] as const;