@eslinted/core 18.9.0-rc.1 → 18.9.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 (93) hide show
  1. package/dist/factory/index.d.ts +950 -16141
  2. package/dist/factory/index.d.ts.map +1 -1
  3. package/dist/factory/index.js +10 -8
  4. package/dist/factory/index.js.map +1 -1
  5. package/dist/factory/manifests.d.ts +9 -9
  6. package/dist/factory/manifests.d.ts.map +1 -1
  7. package/dist/factory/manifests.js.map +1 -1
  8. package/dist/factory/scopes/css.d.ts +9 -9
  9. package/dist/factory/scopes/css.d.ts.map +1 -1
  10. package/dist/factory/scopes/css.js.map +1 -1
  11. package/dist/factory/scopes/html.d.ts +10 -10
  12. package/dist/factory/scopes/html.d.ts.map +1 -1
  13. package/dist/factory/scopes/html.js.map +1 -1
  14. package/dist/factory/scopes/js.d.ts +7 -7
  15. package/dist/factory/scopes/js.d.ts.map +1 -1
  16. package/dist/factory/scopes/js.js +3 -1
  17. package/dist/factory/scopes/js.js.map +1 -1
  18. package/dist/factory/scopes/json.d.ts +8 -8
  19. package/dist/factory/scopes/json.d.ts.map +1 -1
  20. package/dist/factory/scopes/json.js +3 -1
  21. package/dist/factory/scopes/json.js.map +1 -1
  22. package/dist/factory/scopes/jsonc.d.ts +9 -8
  23. package/dist/factory/scopes/jsonc.d.ts.map +1 -1
  24. package/dist/factory/scopes/jsonc.js +4 -1
  25. package/dist/factory/scopes/jsonc.js.map +1 -1
  26. package/dist/factory/scopes/manifest/index.d.ts +11 -19
  27. package/dist/factory/scopes/manifest/index.d.ts.map +1 -1
  28. package/dist/factory/scopes/manifest/index.js.map +1 -1
  29. package/dist/factory/scopes/mocha.d.ts +15 -15
  30. package/dist/factory/scopes/mocha.d.ts.map +1 -1
  31. package/dist/factory/scopes/mocha.js.map +1 -1
  32. package/dist/factory/scopes/svelte.d.ts +18 -20
  33. package/dist/factory/scopes/svelte.d.ts.map +1 -1
  34. package/dist/factory/scopes/svelte.js +3 -1
  35. package/dist/factory/scopes/svelte.js.map +1 -1
  36. package/dist/factory/scopes/ts.d.ts +16 -16
  37. package/dist/factory/scopes/ts.d.ts.map +1 -1
  38. package/dist/factory/scopes/ts.js.map +1 -1
  39. package/dist/factory/scopes/yml.d.ts +9 -9
  40. package/dist/factory/scopes/yml.d.ts.map +1 -1
  41. package/dist/factory/scopes/yml.js.map +1 -1
  42. package/dist/index.spec.js.map +1 -1
  43. package/dist/interface/input/imported.d.ts +2 -2
  44. package/dist/interface/input/imported.d.ts.map +1 -1
  45. package/dist/interface/input/index.d.ts +3 -3
  46. package/dist/interface/input/index.d.ts.map +1 -1
  47. package/dist/interface/input/scopes/defaults.d.ts +4 -4
  48. package/dist/interface/input/scopes/defaults.d.ts.map +1 -1
  49. package/dist/interface/input/scopes/extensions.d.ts +6 -6
  50. package/dist/interface/input/scopes/extensions.d.ts.map +1 -1
  51. package/dist/interface/output/configs/scoped/rules.d.ts +1 -1
  52. package/dist/interface/output/configs/scoped/rules.d.ts.map +1 -1
  53. package/dist/interface/output/configs/scoped/settings.d.ts +2 -2
  54. package/dist/interface/output/configs/scoped/settings.d.ts.map +1 -1
  55. package/dist/interface/output/index.d.ts +3 -3
  56. package/dist/interface/output/index.d.ts.map +1 -1
  57. package/dist/interface/proto/config/index.d.ts +14 -14
  58. package/dist/interface/proto/config/index.d.ts.map +1 -1
  59. package/dist/interface/proto/config/rule/index.d.ts +2 -2
  60. package/dist/interface/proto/config/rule/index.d.ts.map +1 -1
  61. package/dist/interface/proto/config/utility/index.d.ts +2 -2
  62. package/dist/interface/proto/config/utility/index.d.ts.map +1 -1
  63. package/dist/scopes/imports/index.d.ts +2 -2
  64. package/dist/scopes/imports/index.d.ts.map +1 -1
  65. package/dist/scopes/tree/index.d.ts +1 -1
  66. package/dist/scopes/tree/index.d.ts.map +1 -1
  67. package/dist/scopes/tree/index.js.map +1 -1
  68. package/package.json +1 -1
  69. package/src/factory/index.ts +37 -35
  70. package/src/factory/manifests.ts +1 -1
  71. package/src/factory/scopes/css.ts +7 -7
  72. package/src/factory/scopes/html.ts +9 -9
  73. package/src/factory/scopes/js.ts +7 -5
  74. package/src/factory/scopes/json.ts +8 -6
  75. package/src/factory/scopes/jsonc.ts +9 -6
  76. package/src/factory/scopes/manifest/index.ts +29 -13
  77. package/src/factory/scopes/mocha.ts +7 -7
  78. package/src/factory/scopes/svelte.ts +12 -10
  79. package/src/factory/scopes/ts.ts +8 -8
  80. package/src/factory/scopes/yml.ts +8 -8
  81. package/src/index.spec.ts +1 -1
  82. package/src/interface/input/imported.ts +3 -3
  83. package/src/interface/input/index.ts +5 -5
  84. package/src/interface/input/scopes/defaults.ts +4 -4
  85. package/src/interface/input/scopes/extensions.ts +6 -6
  86. package/src/interface/output/configs/scoped/rules.ts +2 -2
  87. package/src/interface/output/configs/scoped/settings.ts +5 -3
  88. package/src/interface/output/index.ts +3 -3
  89. package/src/interface/proto/config/index.ts +14 -14
  90. package/src/interface/proto/config/rule/index.ts +4 -4
  91. package/src/interface/proto/config/utility/index.ts +3 -3
  92. package/src/scopes/imports/index.ts +2 -2
  93. package/src/scopes/tree/index.ts +6 -6
@@ -1,16 +1,32 @@
1
- import type globals from "globals";
2
1
  import type { Imports } from "../../../scopes";
3
2
 
4
- export abstract class ScopeManifest<Parser extends Imports.Parser | false = false> {
5
- public abstract readonly processor: { readonly processor: string } | Record<string, never>;
6
- public abstract readonly language: { readonly language: string } | Record<string, never>;
7
- public abstract readonly parserOptions: object & { readonly parser: null | Exclude<Parser, boolean> };
8
- public abstract readonly languageOptions: (
9
- [Parser] extends [boolean]
10
- ? { readonly parser: null }
11
- : { readonly parser: Parser }
12
-
13
- ) & (
14
- { readonly globals: null | keyof typeof globals }
15
- );
3
+ export abstract class ScopeManifest {
4
+ public abstract processor:
5
+ | {
6
+ processor: string;
7
+ }
8
+ | Record<string, never>
9
+ ;
10
+ public abstract language:
11
+ | {
12
+ language: string;
13
+ }
14
+ | Record<string, never>
15
+ ;
16
+ public abstract parserOptions: {
17
+ parser:
18
+ | null
19
+ | Imports.Parsers
20
+ ;
21
+ };
22
+ public abstract languageOptions: {
23
+ parser:
24
+ | null
25
+ | Imports.Parsers
26
+ ;
27
+ globals:
28
+ | null
29
+ | string
30
+ ;
31
+ };
16
32
  }
@@ -1,11 +1,11 @@
1
1
  import { ScopeManifest } from "./manifest";
2
2
 
3
3
  export default class MochaManifest extends ScopeManifest {
4
- public readonly languageOptions = {
4
+ public languageOptions = {
5
5
  parser: null,
6
- globals: "mocha",
7
- } as const;
8
- public readonly parserOptions = {
6
+ globals: "mocha" as const,
7
+ };
8
+ public parserOptions = {
9
9
  // MUST BE IDENTICAL TO TS PARSER OPTIONS (eventually see if can inherit)
10
10
  parser: null,
11
11
  ecmaFeatures: {
@@ -18,7 +18,7 @@ export default class MochaManifest extends ScopeManifest {
18
18
  warnOnUnsupportedTypeScriptVersion: false,
19
19
  sourceType: "module",
20
20
  ecmaVersion: 2023,
21
- } as const;
22
- public readonly processor = {} as const;
23
- public readonly language = {} as const;
21
+ };
22
+ public processor = {};
23
+ public language = {};
24
24
  }
@@ -1,13 +1,13 @@
1
1
  import { ScopeManifest } from "./manifest";
2
2
 
3
- export default class SvelteManifest extends ScopeManifest<"svelte" | "ts"> {
4
- public readonly languageOptions = {
5
- parser: "svelte",
3
+ export default class SvelteManifest extends ScopeManifest {
4
+ public languageOptions = {
5
+ parser: "svelte" as const,
6
6
  globals: null,
7
- } as const;
8
- public readonly parserOptions = {
9
- parser: "ts",
10
- extraFileExtensions: [".svelte"] as const,
7
+ };
8
+ public parserOptions = {
9
+ parser: "ts" as const,
10
+ extraFileExtensions: [".svelte"],
11
11
  ecmaFeatures: {
12
12
  jsx: false,
13
13
  globalReturn: true,
@@ -18,7 +18,9 @@ export default class SvelteManifest extends ScopeManifest<"svelte" | "ts"> {
18
18
  warnOnUnsupportedTypeScriptVersion: false,
19
19
  sourceType: "module",
20
20
  ecmaVersion: 2023,
21
- } as const;
22
- public readonly processor = { processor: "svelte/svelte" } as const;
23
- public readonly language = {} as const;
21
+ };
22
+ public processor = {
23
+ processor: "svelte/svelte",
24
+ };
25
+ public language = {};
24
26
  }
@@ -1,11 +1,11 @@
1
1
  import { ScopeManifest } from "./manifest";
2
2
 
3
- export default class TsManifest extends ScopeManifest<"ts"> {
4
- public readonly languageOptions = {
5
- parser: "ts",
3
+ export default class TsManifest extends ScopeManifest {
4
+ public languageOptions = {
5
+ parser: "ts" as const,
6
6
  globals: null,
7
- } as const;
8
- public readonly parserOptions = {
7
+ };
8
+ public parserOptions = {
9
9
  // DOC: https://typescript-eslint.io/packages/parser/#configuration
10
10
  // DOC:(USE-CASE): https://typescript-eslint.io/getting-started/typed-linting/
11
11
  parser: null,
@@ -19,7 +19,7 @@ export default class TsManifest extends ScopeManifest<"ts"> {
19
19
  warnOnUnsupportedTypeScriptVersion: false,
20
20
  sourceType: "module",
21
21
  ecmaVersion: 2023,
22
- } as const;
23
- public readonly processor = {} as const;
24
- public readonly language = {} as const;
22
+ };
23
+ public processor = {};
24
+ public language = {};
25
25
  }
@@ -1,15 +1,15 @@
1
1
  import { ScopeManifest } from "./manifest";
2
2
 
3
- export default class YmlManifest extends ScopeManifest<"yml"> {
4
- public readonly languageOptions = {
5
- parser: "yml",
3
+ export default class YmlManifest extends ScopeManifest {
4
+ public languageOptions = {
5
+ parser: "yml" as const,
6
6
  globals: null,
7
- } as const;
8
- public readonly parserOptions = {
7
+ };
8
+ public parserOptions = {
9
9
  /* DOC: https://github.com/ota-meshi/yaml-eslint-parser?tab=readme-ov-file#advanced-configuration */
10
10
  parser: null,
11
11
  defaultYAMLVersion: "1.2" /* @default: "1.2" | "1.1" */,
12
- } as const;
13
- public readonly processor = {} as const;
14
- public readonly language = {} as const;
12
+ };
13
+ public processor = {};
14
+ public language = {};
15
15
  }
package/src/index.spec.ts CHANGED
@@ -24,7 +24,7 @@ describe("Core", function () {
24
24
  });
25
25
  it("containing only config-like members", function () {
26
26
  expect(configs)
27
- .satisfies((configs: readonly unknown[]) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
27
+ .satisfies((configs: unknown[]) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
28
28
  });
29
29
  });
30
30
  describe("configs", function () {
@@ -4,9 +4,9 @@ export interface Imported<
4
4
  Plugins extends string,
5
5
  Parsers extends string,
6
6
  > {
7
- readonly plugins: Config.Config<Plugins>["plugins"];
8
- readonly parsers: Readonly<Record<
7
+ plugins: Config.Config<Plugins>["plugins"];
8
+ parsers: Record<
9
9
  Parsers,
10
10
  unknown
11
- >>;
11
+ >;
12
12
  }
@@ -3,10 +3,10 @@ import type { Imported } from "./imported";
3
3
  import type { Defaults, Extensions } from "./scopes";
4
4
 
5
5
  export interface Input {
6
- readonly imports: Imported<
7
- Imports.Plugin,
8
- Imports.Parser
6
+ imports: Imported<
7
+ Imports.Plugins,
8
+ Imports.Parsers
9
9
  >;
10
- readonly defaults: Defaults<Scope>;
11
- readonly extensions: Extensions<Scope>;
10
+ defaults: Defaults<Scope>;
11
+ extensions: Extensions<Scope>;
12
12
  }
@@ -1,8 +1,8 @@
1
1
  import type { Config } from "../../proto";
2
2
 
3
3
  export interface Defaults<Scopes extends string> {
4
- readonly settings: Config.Config["linterOptions"] & Config.Config["languageOptions"];
5
- readonly files: Readonly<Record<Scopes, string[]>>;
6
- readonly ignores: Readonly<Record<"*" | Scopes, string[]>>;
7
- readonly rules: Readonly<Record<Scopes, Config.Rule.NamedRuleBag[]>>;
4
+ settings: Config.Config["linterOptions"] & Config.Config["languageOptions"];
5
+ files: Record<Scopes, string[]>;
6
+ ignores: Record<"*" | Scopes, string[]>;
7
+ rules: Record<Scopes, Config.Rule.NamedRuleBag[]>;
8
8
  }
@@ -2,17 +2,17 @@ import type { Defaults } from "./defaults";
2
2
 
3
3
  export type Extensions<Scopes extends string> = (
4
4
  & {
5
- readonly "*"?: Partial<Defaults<Scopes>["settings"]> & {
6
- readonly override?: boolean;
7
- readonly ignores?: Defaults<Scopes>["ignores"]["*"];
5
+ "*"?: Partial<Defaults<Scopes>["settings"]> & {
6
+ override?: boolean;
7
+ ignores?: Defaults<Scopes>["ignores"]["*"];
8
8
  };
9
9
  }
10
10
  & Partial<Record<
11
11
  Scopes,
12
12
  {
13
- readonly files?: Defaults<Scopes>["files"][Scopes];
14
- readonly ignores?: Defaults<Scopes>["ignores"][Scopes];
15
- readonly rules?: Defaults<Scopes>["rules"][Scopes][number]["rules"];
13
+ files?: Defaults<Scopes>["files"][Scopes];
14
+ ignores?: Defaults<Scopes>["ignores"][Scopes];
15
+ rules?: Defaults<Scopes>["rules"][Scopes][number]["rules"];
16
16
  }
17
17
  >>
18
18
  );
@@ -1,7 +1,7 @@
1
1
  import type { Config } from "../../../proto";
2
2
 
3
- export type Rules<Scope extends string> = Config.PickConfig<
4
- `linted/${Scope}/${string}/`,
3
+ export type Rules = Config.PickConfig<
4
+ `linted/${string}`,
5
5
  | "files"
6
6
  | "ignores"
7
7
  | "rules"
@@ -1,12 +1,14 @@
1
1
  import type { Config } from "../../../proto";
2
2
 
3
- export type Settings<Scope extends string> = Config.PickConfig<
4
- `linted/${Scope}/`,
3
+ export type Settings = Config.PickConfig<
4
+ `linted/${string}`,
5
5
  | "files"
6
6
  | "ignores"
7
7
  | "processor"
8
8
  | "language"
9
9
  | "settings",
10
10
  string,
11
- { readonly languageOptions: object }
11
+ {
12
+ languageOptions: object;
13
+ }
12
14
  >;
@@ -1,9 +1,9 @@
1
1
  import type * as Configs from "./configs";
2
- import type { Imports, Scope } from "../../scopes";
2
+ import type { Imports } from "../../scopes";
3
3
 
4
4
  export type Output = readonly [
5
- Configs.Global.Plugins<Imports.Plugin>,
5
+ Configs.Global.Plugins<Imports.Plugins>,
6
6
  Configs.Global.Settings,
7
7
  Configs.Global.Ignores,
8
- ...readonly (Configs.Scoped.Settings<Scope> | Configs.Scoped.Rules<Scope>)[],
8
+ ...(Configs.Scoped.Settings | Configs.Scoped.Rules)[],
9
9
  ];
@@ -3,25 +3,25 @@ import type * as Rule from "./rule";
3
3
  export type { Rule };
4
4
  export type * from "./utility";
5
5
  export interface Config<Plugins extends string = string> {
6
- readonly name: `linted/${string}/`;
7
- readonly plugins: Readonly<Record<Plugins, unknown>>;
8
- readonly files: readonly string[];
9
- readonly ignores: readonly string[];
10
- readonly rules: Rule.RuleBag;
11
- readonly linterOptions: {
12
- readonly noInlineConfig: boolean;
13
- readonly reportUnusedDisableDirectives:
6
+ name: `linted/${string}`;
7
+ plugins: Record<Plugins, unknown>;
8
+ files: string[];
9
+ ignores: string[];
10
+ rules: Rule.RuleBag;
11
+ linterOptions: {
12
+ noInlineConfig: boolean;
13
+ reportUnusedDisableDirectives:
14
14
  | "error"
15
15
  | "warn"
16
16
  | "off"
17
17
  ;
18
18
  };
19
- readonly languageOptions: {
20
- readonly sourceType:
19
+ languageOptions: {
20
+ sourceType:
21
21
  | "module"
22
22
  | "script"
23
23
  ;
24
- readonly ecmaVersion:
24
+ ecmaVersion:
25
25
  | "latest"
26
26
  | 3
27
27
  | 5
@@ -37,7 +37,7 @@ export interface Config<Plugins extends string = string> {
37
37
  | 2024
38
38
  ;
39
39
  };
40
- readonly processor?: string;
41
- readonly language?: string;
42
- readonly settings?: Readonly<Record<string, unknown>>;
40
+ processor?: string;
41
+ language?: string;
42
+ settings?: Record<string, unknown>;
43
43
  }
@@ -1,12 +1,12 @@
1
1
  export interface NamedRuleBag {
2
2
  id: string;
3
- readonly rules: RuleBag;
3
+ rules: RuleBag;
4
4
  }
5
- export type RuleBag = Readonly<Record<
5
+ export type RuleBag = Record<
6
6
  string,
7
7
  | RuleState
8
- | readonly [RuleState, ...readonly unknown[]]
9
- >>;
8
+ | readonly [RuleState, ...unknown[]]
9
+ >;
10
10
  export type RuleState = (
11
11
  | "error"
12
12
  | "warn"
@@ -12,8 +12,8 @@ export type PickConfig<
12
12
  > = (
13
13
  & Rest
14
14
  & Pick<Config<Plugins>, Picks>
15
- & { readonly name: Name }
16
- & Readonly<Partial<Record<
15
+ & { name: Name }
16
+ & Partial<Record<
17
17
  Exclude<
18
18
  keyof Config,
19
19
  | "name"
@@ -21,5 +21,5 @@ export type PickConfig<
21
21
  | Picks
22
22
  >,
23
23
  never
24
- >>>
24
+ >>
25
25
  );
@@ -1,5 +1,5 @@
1
1
  export namespace Imports {
2
- export type Plugin = (
2
+ export type Plugins = (
3
3
  | "@stylistic"
4
4
  | "@typescript-eslint"
5
5
  | "mocha"
@@ -12,7 +12,7 @@ export namespace Imports {
12
12
  | "jsonc"
13
13
  | "yml"
14
14
  );
15
- export type Parser = (
15
+ export type Parsers = (
16
16
  | "ts"
17
17
  | "svelte"
18
18
  | "html"
@@ -1,8 +1,8 @@
1
1
  import type { Scope } from "..";
2
2
 
3
- export const tree: [Scope, readonly Scope[]][] = [
4
- ["jsonc", ["json"] as const] as const,
5
- ["mocha", ["ts"] as const] as const,
6
- ["svelte", ["ts"] as const] as const,
7
- ["ts", ["js"] as const] as const,
8
- ] as const;
3
+ export const tree: [Scope, Scope[]][] = [
4
+ ["jsonc", ["json"]] as const,
5
+ ["mocha", ["ts"]] as const,
6
+ ["svelte", ["ts"]] as const,
7
+ ["ts", ["js"]] as const,
8
+ ];