@eslinted/core 18.1.1 → 18.1.3

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 (48) hide show
  1. package/.github/workflows/RELEASE.yml +36 -36
  2. package/.github/workflows/rc.yml +36 -36
  3. package/.markdownlint.jsonc +126 -126
  4. package/LICENSE +21 -21
  5. package/README.md +4 -4
  6. package/SECURITY.md +8 -8
  7. package/eslint.config.js +3 -3
  8. package/package.json +92 -95
  9. package/src/factory/index.ts +141 -141
  10. package/src/factory/manifests.ts +21 -21
  11. package/src/factory/scopes/css.ts +17 -17
  12. package/src/factory/scopes/html.ts +14 -14
  13. package/src/factory/scopes/js.ts +11 -11
  14. package/src/factory/scopes/json.ts +11 -11
  15. package/src/factory/scopes/jsonc.ts +11 -11
  16. package/src/factory/scopes/manifest/index.ts +16 -16
  17. package/src/factory/scopes/mocha.ts +24 -24
  18. package/src/factory/scopes/svelte.ts +24 -24
  19. package/src/factory/scopes/ts.ts +25 -25
  20. package/src/factory/scopes/yml.ts +15 -15
  21. package/src/index.input.spec.ts +150 -150
  22. package/src/index.spec.ts +51 -51
  23. package/src/index.ts +24 -24
  24. package/src/interface/index.ts +3 -3
  25. package/src/interface/input/imports.ts +12 -12
  26. package/src/interface/input/index.ts +12 -12
  27. package/src/interface/input/scopes/defaults.ts +8 -8
  28. package/src/interface/input/scopes/extensions.ts +18 -18
  29. package/src/interface/input/scopes/index.ts +2 -2
  30. package/src/interface/output/configs/global/ignores.ts +6 -6
  31. package/src/interface/output/configs/global/index.ts +3 -3
  32. package/src/interface/output/configs/global/plugins.ts +7 -7
  33. package/src/interface/output/configs/global/settings.ts +7 -7
  34. package/src/interface/output/configs/index.ts +2 -2
  35. package/src/interface/output/configs/scoped/index.ts +2 -2
  36. package/src/interface/output/configs/scoped/rules.ts +8 -8
  37. package/src/interface/output/configs/scoped/settings.ts +12 -12
  38. package/src/interface/output/index.ts +9 -9
  39. package/src/interface/proto/config/index.ts +43 -43
  40. package/src/interface/proto/config/rule/index.ts +14 -14
  41. package/src/interface/proto/config/utility/index.ts +25 -25
  42. package/src/interface/proto/index.ts +1 -1
  43. package/src/scope/index.spec.ts +43 -43
  44. package/src/scope/index.ts +13 -13
  45. package/src/scope/tree/index.spec.ts +48 -48
  46. package/src/scope/tree/index.ts +8 -8
  47. package/src/scope/types/index.ts +24 -24
  48. package/tsconfig.json +165 -165
@@ -1,16 +1,16 @@
1
- import type globals from "globals";
2
- import type { Import } from "../../../scope";
3
-
4
- export abstract class ScopeManifest<Parser extends Import.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
- );
16
- }
1
+ import type globals from "globals";
2
+ import type { Import } from "../../../scope";
3
+
4
+ export abstract class ScopeManifest<Parser extends Import.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
+ );
16
+ }
@@ -1,24 +1,24 @@
1
- import { ScopeManifest } from "./manifest";
2
-
3
- export default class MochaManifest extends ScopeManifest {
4
- public readonly languageOptions = {
5
- parser: null,
6
- globals: "mocha",
7
- } as const;
8
- public readonly parserOptions = {
9
- // MUST BE IDENTICAL TO TS PARSER OPTIONS (eventually see if can inherit)
10
- parser: null,
11
- ecmaFeatures: {
12
- jsx: false,
13
- globalReturn: true,
14
- },
15
- jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
16
- projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
17
- // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
18
- warnOnUnsupportedTypeScriptVersion: false,
19
- sourceType: "module",
20
- ecmaVersion: 2023,
21
- } as const;
22
- public readonly processor = {} as const;
23
- public readonly language = {} as const;
24
- }
1
+ import { ScopeManifest } from "./manifest";
2
+
3
+ export default class MochaManifest extends ScopeManifest {
4
+ public readonly languageOptions = {
5
+ parser: null,
6
+ globals: "mocha",
7
+ } as const;
8
+ public readonly parserOptions = {
9
+ // MUST BE IDENTICAL TO TS PARSER OPTIONS (eventually see if can inherit)
10
+ parser: null,
11
+ ecmaFeatures: {
12
+ jsx: false,
13
+ globalReturn: true,
14
+ },
15
+ jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
16
+ projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
17
+ // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
18
+ warnOnUnsupportedTypeScriptVersion: false,
19
+ sourceType: "module",
20
+ ecmaVersion: 2023,
21
+ } as const;
22
+ public readonly processor = {} as const;
23
+ public readonly language = {} as const;
24
+ }
@@ -1,24 +1,24 @@
1
- import { ScopeManifest } from "./manifest";
2
-
3
- export default class SvelteManifest extends ScopeManifest<"svelte" | "ts"> {
4
- public readonly languageOptions = {
5
- parser: "svelte",
6
- globals: null,
7
- } as const;
8
- public readonly parserOptions = {
9
- parser: "ts",
10
- extraFileExtensions: [".svelte"] as const,
11
- ecmaFeatures: {
12
- jsx: false,
13
- globalReturn: true,
14
- },
15
- jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
16
- projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
17
- // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
18
- warnOnUnsupportedTypeScriptVersion: false,
19
- sourceType: "module",
20
- ecmaVersion: 2023,
21
- } as const;
22
- public readonly processor = { processor: "svelte/svelte" } as const;
23
- public readonly language = {} as const;
24
- }
1
+ import { ScopeManifest } from "./manifest";
2
+
3
+ export default class SvelteManifest extends ScopeManifest<"svelte" | "ts"> {
4
+ public readonly languageOptions = {
5
+ parser: "svelte",
6
+ globals: null,
7
+ } as const;
8
+ public readonly parserOptions = {
9
+ parser: "ts",
10
+ extraFileExtensions: [".svelte"] as const,
11
+ ecmaFeatures: {
12
+ jsx: false,
13
+ globalReturn: true,
14
+ },
15
+ jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
16
+ projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
17
+ // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
18
+ warnOnUnsupportedTypeScriptVersion: false,
19
+ sourceType: "module",
20
+ ecmaVersion: 2023,
21
+ } as const;
22
+ public readonly processor = { processor: "svelte/svelte" } as const;
23
+ public readonly language = {} as const;
24
+ }
@@ -1,25 +1,25 @@
1
- import { ScopeManifest } from "./manifest";
2
-
3
- export default class TsManifest extends ScopeManifest<"ts"> {
4
- public readonly languageOptions = {
5
- parser: "ts",
6
- globals: null,
7
- } as const;
8
- public readonly parserOptions = {
9
- // DOC: https://typescript-eslint.io/packages/parser/#configuration
10
- // DOC:(USE-CASE): https://typescript-eslint.io/getting-started/typed-linting/
11
- parser: null,
12
- ecmaFeatures: {
13
- jsx: false,
14
- globalReturn: true,
15
- },
16
- jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
17
- projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
18
- // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
19
- warnOnUnsupportedTypeScriptVersion: false,
20
- sourceType: "module",
21
- ecmaVersion: 2023,
22
- } as const;
23
- public readonly processor = {} as const;
24
- public readonly language = {} as const;
25
- }
1
+ import { ScopeManifest } from "./manifest";
2
+
3
+ export default class TsManifest extends ScopeManifest<"ts"> {
4
+ public readonly languageOptions = {
5
+ parser: "ts",
6
+ globals: null,
7
+ } as const;
8
+ public readonly parserOptions = {
9
+ // DOC: https://typescript-eslint.io/packages/parser/#configuration
10
+ // DOC:(USE-CASE): https://typescript-eslint.io/getting-started/typed-linting/
11
+ parser: null,
12
+ ecmaFeatures: {
13
+ jsx: false,
14
+ globalReturn: true,
15
+ },
16
+ jsDocParsingMode: "none" /* @default(project): "all" | @default: "none" | "type-info" */,
17
+ projectService: true /* DOC: https://typescript-eslint.io/packages/parser/#projectservice , DOC: https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues */,
18
+ // tsconfigRootDir: import.meta.dirname /* DOC: https://typescript-eslint.io/packages/parser/#tsconfigrootdir ; see `DOC:(USE-CASE), I am inferring that an aboslute path is needed ; DOC:(Node.js: import.meta): https://nodejs.org/api/esm.html#importmetadirname */,
19
+ warnOnUnsupportedTypeScriptVersion: false,
20
+ sourceType: "module",
21
+ ecmaVersion: 2023,
22
+ } as const;
23
+ public readonly processor = {} as const;
24
+ public readonly language = {} as const;
25
+ }
@@ -1,15 +1,15 @@
1
- import { ScopeManifest } from "./manifest";
2
-
3
- export default class YmlManifest extends ScopeManifest<"yml"> {
4
- public readonly languageOptions = {
5
- parser: "yml",
6
- globals: null,
7
- } as const;
8
- public readonly parserOptions = {
9
- /* DOC: https://github.com/ota-meshi/yaml-eslint-parser?tab=readme-ov-file#advanced-configuration */
10
- parser: null,
11
- defaultYAMLVersion: "1.2" /* @default: "1.2" | "1.1" */,
12
- } as const;
13
- public readonly processor = {} as const;
14
- public readonly language = {} as const;
15
- }
1
+ import { ScopeManifest } from "./manifest";
2
+
3
+ export default class YmlManifest extends ScopeManifest<"yml"> {
4
+ public readonly languageOptions = {
5
+ parser: "yml",
6
+ globals: null,
7
+ } as const;
8
+ public readonly parserOptions = {
9
+ /* DOC: https://github.com/ota-meshi/yaml-eslint-parser?tab=readme-ov-file#advanced-configuration */
10
+ parser: null,
11
+ defaultYAMLVersion: "1.2" /* @default: "1.2" | "1.1" */,
12
+ } as const;
13
+ public readonly processor = {} as const;
14
+ public readonly language = {} as const;
15
+ }
@@ -1,150 +1,150 @@
1
- import type Core from ".";
2
-
3
- const
4
- ERROR = "error",
5
- OFF = "off",
6
- Plugin = "TEST_PLUGIN";
7
-
8
- export const TestInput: Parameters<typeof Core>[0] = {
9
- imports: {
10
- plugins: {
11
- "@stylistic": Plugin,
12
- "@typescript-eslint": Plugin,
13
- mocha: Plugin,
14
- "chai-friendly": Plugin,
15
- "chai-expect": Plugin,
16
- svelte: Plugin,
17
- "@html-eslint": Plugin,
18
- css: Plugin,
19
- jsonc: Plugin,
20
- yml: Plugin,
21
- } as const,
22
- parsers: {
23
- ts: "parsers.ts",
24
- svelte: "parsers.svelte",
25
- html: "parsers.html",
26
- jsonc: "parsers.jsonc",
27
- yml: "parsers.yml",
28
- } as const,
29
- } as const,
30
- extensions: {},
31
- defaults: {
32
- settings: {
33
- ecmaVersion: 2024,
34
- sourceType: "module",
35
- noInlineConfig: true,
36
- reportUnusedDisableDirectives: "error",
37
- },
38
- files: {
39
- js: ["default.js"],
40
- ts: ["default.ts"],
41
- mocha: ["default.mocha"],
42
- svelte: ["default.svelte"],
43
- html: ["default.html"],
44
- css: ["default.css"],
45
- json: ["default.json"],
46
- jsonc: ["default.jsonc"],
47
- yml: ["default.yml"],
48
- } as const,
49
- ignores: {
50
- "*": ["ignore/default.*"],
51
- js: ["ignore/default.js"],
52
- ts: ["ignore/default.ts"],
53
- mocha: ["ignore/default.mocha"],
54
- svelte: ["ignore/default.svelte"],
55
- html: ["ignore/default.html"],
56
- css: ["ignore/default.css"],
57
- json: ["ignore/default.json"],
58
- jsonc: ["ignore/default.jsonc"],
59
- yml: ["ignore/default.yml"],
60
- } as const,
61
- rules: {
62
- js: [
63
- {
64
- id: "enable",
65
- rules: {
66
- vanilla: ERROR,
67
- vanilla0: ERROR,
68
- vanilla1: ERROR,
69
- vanilla2: ERROR,
70
- },
71
- } as const,
72
- {
73
- id: "enable/stylistic",
74
- rules: { "@stylistic/style-rule": ERROR },
75
- } as const,
76
- ],
77
- ts: [
78
- {
79
- id: "disable",
80
- rules: { vanilla0: OFF },
81
- } as const,
82
- {
83
- id: "enable/extension",
84
- rules: {
85
- "@typescript-eslint/enums": ERROR,
86
- "@typescript-eslint/destructure-expression": ERROR,
87
- "@typescript-eslint/global": ERROR,
88
- },
89
- } as const,
90
- ],
91
- mocha: [
92
- {
93
- id: "disable",
94
- rules: { vanilla2: OFF },
95
- } as const,
96
- {
97
- id: "disable/ts",
98
- rules: { "@typescript-eslint/global": ERROR },
99
- } as const,
100
- {
101
- id: "enable",
102
- rules: { "mocha/test-expression": ERROR },
103
- } as const,
104
- ],
105
- svelte: [
106
- {
107
- id: "disable",
108
- rules: { vanilla1: OFF },
109
- } as const,
110
- {
111
- id: "enable-extension",
112
- rules: { "svelte/tags": ERROR },
113
- } as const,
114
- ],
115
- html: [
116
- {
117
- id: "enable",
118
- rules: { "html/attribute": ERROR },
119
- } as const,
120
- ],
121
- css: [
122
- {
123
- id: "enable",
124
- rules: { "css/property": ERROR },
125
- } as const,
126
- ],
127
- json: [
128
- {
129
- id: "enable",
130
- rules: {
131
- "jsonc/property-check": ERROR,
132
- "jsonc/trailing-comma": [ERROR, "always"],
133
- },
134
- } as const,
135
- ],
136
- jsonc: [
137
- {
138
- id: "override",
139
- rules: { "jsonc/trailing-comma": [ERROR, "never"] },
140
- } as const,
141
- ],
142
- yml: [
143
- {
144
- id: "enable",
145
- rules: { "yml/property-check": ERROR },
146
- } as const,
147
- ],
148
- } as const,
149
- } as const,
150
- } as const;
1
+ import type Core from ".";
2
+
3
+ const
4
+ ERROR = "error",
5
+ OFF = "off",
6
+ Plugin = "TEST_PLUGIN";
7
+
8
+ export const TestInput: Parameters<typeof Core>[0] = {
9
+ imports: {
10
+ plugins: {
11
+ "@stylistic": Plugin,
12
+ "@typescript-eslint": Plugin,
13
+ mocha: Plugin,
14
+ "chai-friendly": Plugin,
15
+ "chai-expect": Plugin,
16
+ svelte: Plugin,
17
+ "@html-eslint": Plugin,
18
+ css: Plugin,
19
+ jsonc: Plugin,
20
+ yml: Plugin,
21
+ } as const,
22
+ parsers: {
23
+ ts: "parsers.ts",
24
+ svelte: "parsers.svelte",
25
+ html: "parsers.html",
26
+ jsonc: "parsers.jsonc",
27
+ yml: "parsers.yml",
28
+ } as const,
29
+ } as const,
30
+ extensions: {},
31
+ defaults: {
32
+ settings: {
33
+ ecmaVersion: 2024,
34
+ sourceType: "module",
35
+ noInlineConfig: true,
36
+ reportUnusedDisableDirectives: "error",
37
+ },
38
+ files: {
39
+ js: ["default.js"],
40
+ ts: ["default.ts"],
41
+ mocha: ["default.mocha"],
42
+ svelte: ["default.svelte"],
43
+ html: ["default.html"],
44
+ css: ["default.css"],
45
+ json: ["default.json"],
46
+ jsonc: ["default.jsonc"],
47
+ yml: ["default.yml"],
48
+ } as const,
49
+ ignores: {
50
+ "*": ["ignore/default.*"],
51
+ js: ["ignore/default.js"],
52
+ ts: ["ignore/default.ts"],
53
+ mocha: ["ignore/default.mocha"],
54
+ svelte: ["ignore/default.svelte"],
55
+ html: ["ignore/default.html"],
56
+ css: ["ignore/default.css"],
57
+ json: ["ignore/default.json"],
58
+ jsonc: ["ignore/default.jsonc"],
59
+ yml: ["ignore/default.yml"],
60
+ } as const,
61
+ rules: {
62
+ js: [
63
+ {
64
+ id: "enable",
65
+ rules: {
66
+ vanilla: ERROR,
67
+ vanilla0: ERROR,
68
+ vanilla1: ERROR,
69
+ vanilla2: ERROR,
70
+ },
71
+ } as const,
72
+ {
73
+ id: "enable/stylistic",
74
+ rules: { "@stylistic/style-rule": ERROR },
75
+ } as const,
76
+ ],
77
+ ts: [
78
+ {
79
+ id: "disable",
80
+ rules: { vanilla0: OFF },
81
+ } as const,
82
+ {
83
+ id: "enable/extension",
84
+ rules: {
85
+ "@typescript-eslint/enums": ERROR,
86
+ "@typescript-eslint/destructure-expression": ERROR,
87
+ "@typescript-eslint/global": ERROR,
88
+ },
89
+ } as const,
90
+ ],
91
+ mocha: [
92
+ {
93
+ id: "disable",
94
+ rules: { vanilla2: OFF },
95
+ } as const,
96
+ {
97
+ id: "disable/ts",
98
+ rules: { "@typescript-eslint/global": ERROR },
99
+ } as const,
100
+ {
101
+ id: "enable",
102
+ rules: { "mocha/test-expression": ERROR },
103
+ } as const,
104
+ ],
105
+ svelte: [
106
+ {
107
+ id: "disable",
108
+ rules: { vanilla1: OFF },
109
+ } as const,
110
+ {
111
+ id: "enable-extension",
112
+ rules: { "svelte/tags": ERROR },
113
+ } as const,
114
+ ],
115
+ html: [
116
+ {
117
+ id: "enable",
118
+ rules: { "html/attribute": ERROR },
119
+ } as const,
120
+ ],
121
+ css: [
122
+ {
123
+ id: "enable",
124
+ rules: { "css/property": ERROR },
125
+ } as const,
126
+ ],
127
+ json: [
128
+ {
129
+ id: "enable",
130
+ rules: {
131
+ "jsonc/property-check": ERROR,
132
+ "jsonc/trailing-comma": [ERROR, "always"],
133
+ },
134
+ } as const,
135
+ ],
136
+ jsonc: [
137
+ {
138
+ id: "override",
139
+ rules: { "jsonc/trailing-comma": [ERROR, "never"] },
140
+ } as const,
141
+ ],
142
+ yml: [
143
+ {
144
+ id: "enable",
145
+ rules: { "yml/property-check": ERROR },
146
+ } as const,
147
+ ],
148
+ } as const,
149
+ } as const,
150
+ } as const;
package/src/index.spec.ts CHANGED
@@ -1,51 +1,51 @@
1
- import { expect } from "chai";
2
- import core from ".";
3
- import { scopes } from "./scope";
4
- import { TestInput } from "./index.input.spec";
5
-
6
- const configs = core(TestInput);
7
-
8
- describe("Core", function () {
9
- describe("shape", function () {
10
- it("is a function", function () {
11
- expect(core)
12
- .a("function");
13
- });
14
- });
15
- describe("output", function () {
16
- it("is a non-empty array", function () {
17
- expect(configs)
18
- .an("array")
19
- .not.empty;
20
- });
21
- it(`with length >= plugins + */ignores + */settings + ${scopes.length} scopes = ${scopes.length + 3} [Actual: ${configs.length}`, function () {
22
- expect(configs)
23
- .lengthOf.above(scopes.length + 2);
24
- });
25
- it("containing only config-like members", function () {
26
- expect(configs)
27
- .satisfies((configs: readonly unknown[]) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
28
- });
29
- });
30
- describe("configs", function () {
31
- it("begin with plugins", function () {
32
- expect(configs[0])
33
- .has.property("name", "linted/*/plugins/");
34
- expect(configs[0])
35
- .has.property("plugins")
36
- .an("object");
37
- });
38
- it("followed by global settings", function () {
39
- expect(configs[1])
40
- .has.property("name", "linted/*/settings/");
41
- expect(configs[1])
42
- .has.property("linterOptions")
43
- .an("object");
44
- expect(configs[1])
45
- .has.nested.property("languageOptions.sourceType")
46
- .a("string");
47
- expect(configs[1])
48
- .has.nested.property("languageOptions.ecmaVersion");
49
- });
50
- });
51
- });
1
+ import { expect } from "chai";
2
+ import core from ".";
3
+ import { scopes } from "./scope";
4
+ import { TestInput } from "./index.input.spec";
5
+
6
+ const configs = core(TestInput);
7
+
8
+ describe("Core", function () {
9
+ describe("shape", function () {
10
+ it("is a function", function () {
11
+ expect(core)
12
+ .a("function");
13
+ });
14
+ });
15
+ describe("output", function () {
16
+ it("is a non-empty array", function () {
17
+ expect(configs)
18
+ .an("array")
19
+ .not.empty;
20
+ });
21
+ it(`with length >= plugins + */ignores + */settings + ${scopes.length} scopes = ${scopes.length + 3} [Actual: ${configs.length}`, function () {
22
+ expect(configs)
23
+ .lengthOf.above(scopes.length + 2);
24
+ });
25
+ it("containing only config-like members", function () {
26
+ expect(configs)
27
+ .satisfies((configs: readonly unknown[]) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
28
+ });
29
+ });
30
+ describe("configs", function () {
31
+ it("begin with plugins", function () {
32
+ expect(configs[0])
33
+ .has.property("name", "linted/*/plugins/");
34
+ expect(configs[0])
35
+ .has.property("plugins")
36
+ .an("object");
37
+ });
38
+ it("followed by global settings", function () {
39
+ expect(configs[1])
40
+ .has.property("name", "linted/*/settings/");
41
+ expect(configs[1])
42
+ .has.property("linterOptions")
43
+ .an("object");
44
+ expect(configs[1])
45
+ .has.nested.property("languageOptions.sourceType")
46
+ .a("string");
47
+ expect(configs[1])
48
+ .has.nested.property("languageOptions.ecmaVersion");
49
+ });
50
+ });
51
+ });