@ttsc/lint 0.11.0 → 0.12.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.
- package/README.md +66 -140
- package/lib/{structures/defaultFormat.d.ts → defaultFormat.d.ts} +3 -3
- package/lib/{structures/defaultFormat.js → defaultFormat.js} +3 -3
- package/lib/defaultFormat.js.map +1 -0
- package/lib/index.d.ts +1 -38
- package/lib/index.js +7 -5
- package/lib/index.js.map +1 -1
- package/lib/structures/ITtscLintConfig.d.ts +27 -0
- package/lib/structures/{PluginRuleNames.js → ITtscLintConfig.js} +1 -1
- package/lib/structures/ITtscLintConfig.js.map +1 -0
- package/lib/structures/{TtscLintFormatConfig.d.ts → ITtscLintFormatConfig.d.ts} +17 -16
- package/lib/structures/{TtscLintConfig.js → ITtscLintFormatConfig.js} +1 -1
- package/lib/structures/ITtscLintFormatConfig.js.map +1 -0
- package/lib/structures/ITtscLintPluginConfig.d.ts +6 -6
- package/lib/structures/TtscLintRuleMap.d.ts +11 -9
- package/lib/structures/TtscLintRuleOptions.d.ts +118 -144
- package/lib/structures/index.d.ts +2 -7
- package/lib/structures/index.js +2 -7
- package/lib/structures/index.js.map +1 -1
- package/linthost/config.go +1 -6
- package/linthost/config_format.go +253 -298
- package/linthost/format.go +91 -1
- package/package.json +2 -2
- package/rule/rule.go +124 -124
- package/src/{structures/defaultFormat.ts → defaultFormat.ts} +5 -5
- package/src/index.ts +7 -5
- package/src/structures/ITtscLintConfig.ts +33 -0
- package/src/structures/{TtscLintFormatConfig.ts → ITtscLintFormatConfig.ts} +17 -16
- package/src/structures/ITtscLintPluginConfig.ts +6 -6
- package/src/structures/TtscLintRuleMap.ts +17 -13
- package/src/structures/TtscLintRuleOptions.ts +118 -144
- package/src/structures/index.ts +2 -7
- package/lib/defineConfig.d.ts +0 -55
- package/lib/defineConfig.js +0 -39
- package/lib/defineConfig.js.map +0 -1
- package/lib/structures/PluginRuleNames.d.ts +0 -14
- package/lib/structures/PluginRuleNames.js.map +0 -1
- package/lib/structures/TtscLintConfig.d.ts +0 -27
- package/lib/structures/TtscLintConfig.js.map +0 -1
- package/lib/structures/TtscLintConfigEntry.d.ts +0 -39
- package/lib/structures/TtscLintConfigEntry.js +0 -3
- package/lib/structures/TtscLintConfigEntry.js.map +0 -1
- package/lib/structures/TtscLintFormatConfig.js +0 -3
- package/lib/structures/TtscLintFormatConfig.js.map +0 -1
- package/lib/structures/TtscLintPlugins.d.ts +0 -9
- package/lib/structures/TtscLintPlugins.js +0 -3
- package/lib/structures/TtscLintPlugins.js.map +0 -1
- package/lib/structures/TtscLintRuleEntry.d.ts +0 -22
- package/lib/structures/TtscLintRuleEntry.js +0 -3
- package/lib/structures/TtscLintRuleEntry.js.map +0 -1
- package/lib/structures/defaultFormat.js.map +0 -1
- package/src/defineConfig.ts +0 -69
- package/src/structures/PluginRuleNames.ts +0 -19
- package/src/structures/TtscLintConfig.ts +0 -31
- package/src/structures/TtscLintConfigEntry.ts +0 -50
- package/src/structures/TtscLintPlugins.ts +0 -10
- package/src/structures/TtscLintRuleEntry.ts +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ITtscLintFormatConfig } from "./ITtscLintFormatConfig";
|
|
2
2
|
import type { TtscLintRuleMap } from "./TtscLintRuleMap";
|
|
3
3
|
/** `compilerOptions.plugins[]` entry shape consumed by `@ttsc/lint`. */
|
|
4
4
|
export interface ITtscLintPluginConfig {
|
|
@@ -61,7 +61,7 @@ export interface ITtscLintPluginConfig {
|
|
|
61
61
|
plugins?: Record<string, string>;
|
|
62
62
|
/**
|
|
63
63
|
* Prettier-style flat configuration for the `format/*` rules. Sibling of
|
|
64
|
-
* `rules`. See {@link
|
|
64
|
+
* `rules`. See {@link ITtscLintFormatConfig} for the full surface.
|
|
65
65
|
*
|
|
66
66
|
* ```jsonc
|
|
67
67
|
* {
|
|
@@ -74,7 +74,7 @@ export interface ITtscLintPluginConfig {
|
|
|
74
74
|
* combined with `extends` on the same plugin entry — put format options
|
|
75
75
|
* inside the extends-target lint.config.ts instead.
|
|
76
76
|
*/
|
|
77
|
-
format?:
|
|
77
|
+
format?: ITtscLintFormatConfig;
|
|
78
78
|
/**
|
|
79
79
|
* Inline rule map or path to a standalone lint config file.
|
|
80
80
|
*
|
|
@@ -85,9 +85,9 @@ export interface ITtscLintPluginConfig {
|
|
|
85
85
|
*
|
|
86
86
|
* The legacy shape is intentionally narrower than `rules`/`extends`: a string
|
|
87
87
|
* (file path) or a flat rule-name → severity map. The Go-side parser only
|
|
88
|
-
* accepts those two shapes; widening the TS type to the
|
|
89
|
-
*
|
|
90
|
-
*
|
|
88
|
+
* accepts those two shapes; widening the TS type to the full config object
|
|
89
|
+
* would silently let unsupported nested shapes pass type-checking and fail
|
|
90
|
+
* at runtime.
|
|
91
91
|
*/
|
|
92
92
|
config?: string | TtscLintRuleMap;
|
|
93
93
|
/** Extra plugin-owned fields are passed through unchanged. */
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { PluginRuleNames } from "./PluginRuleNames";
|
|
2
|
-
import type { TtscLintPlugins } from "./TtscLintPlugins";
|
|
3
1
|
import type { TtscLintRule } from "./TtscLintRule";
|
|
4
|
-
import type {
|
|
2
|
+
import type { ITtscLintRuleOptionsMap } from "./TtscLintRuleOptions";
|
|
5
3
|
import type { TtscLintSeverity } from "./TtscLintSeverity";
|
|
6
4
|
/**
|
|
7
5
|
* Rule-name → severity or severity-tuple map.
|
|
8
6
|
*
|
|
9
7
|
* Built from two independent mapped types intersected together:
|
|
10
8
|
*
|
|
11
|
-
* - Rules listed in `
|
|
9
|
+
* - Rules listed in `ITtscLintRuleOptionsMap` accept `severity`, `[severity]`, or
|
|
12
10
|
* `[severity, options]`, with the options type picked per rule key.
|
|
13
|
-
* - Every other built-in rule
|
|
14
|
-
*
|
|
11
|
+
* - Every other built-in rule accepts `severity` or `[severity]`.
|
|
12
|
+
* - Namespaced contributor plugin rules accept `severity`, `[severity]`, or
|
|
13
|
+
* `[severity, unknownOptions]` because the host type surface no longer
|
|
14
|
+
* knows contributor rule schemas.
|
|
15
15
|
*
|
|
16
16
|
* Splitting the two halves (instead of folding them into one mapped type with a
|
|
17
17
|
* conditional value) keeps TypeScript's contextual typing intact inside the
|
|
@@ -37,8 +37,10 @@ import type { TtscLintSeverity } from "./TtscLintSeverity";
|
|
|
37
37
|
* splits each negative case into its own const to keep every branch
|
|
38
38
|
* load-bearing.
|
|
39
39
|
*/
|
|
40
|
-
export type TtscLintRuleMap
|
|
41
|
-
[K in keyof
|
|
40
|
+
export type TtscLintRuleMap = {
|
|
41
|
+
[K in keyof ITtscLintRuleOptionsMap]?: TtscLintSeverity | readonly [TtscLintSeverity] | readonly [TtscLintSeverity, ITtscLintRuleOptionsMap[K]];
|
|
42
42
|
} & {
|
|
43
|
-
[K in Exclude<TtscLintRule
|
|
43
|
+
[K in Exclude<TtscLintRule, keyof ITtscLintRuleOptionsMap>]?: TtscLintSeverity | readonly [TtscLintSeverity];
|
|
44
|
+
} & {
|
|
45
|
+
[K in `${string}/${string}`]?: TtscLintSeverity | readonly [TtscLintSeverity] | readonly [TtscLintSeverity, unknown];
|
|
44
46
|
};
|
|
@@ -1,149 +1,123 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* Line-terminator emitted on every newline the printer inserts.
|
|
112
|
-
* Mirrors prettier's `endOfLine` `"lf"` and `"crlf"` modes.
|
|
113
|
-
*
|
|
114
|
-
* @default "lf"
|
|
115
|
-
*/
|
|
116
|
-
endOfLine?: "lf" | "crlf";
|
|
117
|
-
}
|
|
118
|
-
/** `format/jsdoc` options. */
|
|
119
|
-
interface JSDoc {
|
|
120
|
-
/**
|
|
121
|
-
* Extra `from → to` tag rewrites layered on top of the built-in synonym
|
|
122
|
-
* table (`@return → @returns`, `@arg → @param`, etc.). User-supplied
|
|
123
|
-
* entries win on key collision, so a `{"return": "RETURN"}` entry overrides
|
|
124
|
-
* the built-in default for `@return`.
|
|
125
|
-
*
|
|
126
|
-
* @default {} (use built-in table unchanged)
|
|
127
|
-
*/
|
|
128
|
-
tagSynonyms?: Record<string, string>;
|
|
129
|
-
/**
|
|
130
|
-
* Sort JSDoc tag blocks into the canonical order (`@description`, `@param`,
|
|
131
|
-
* `@returns`, …).
|
|
132
|
-
*
|
|
133
|
-
* @default false (deferred; MVP only normalizes tag names)
|
|
134
|
-
*/
|
|
135
|
-
sortTags?: boolean;
|
|
136
|
-
}
|
|
1
|
+
/** `format/semi` rule options. */
|
|
2
|
+
export interface ITtscLintSemiRuleOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether trailing semicolons must be present on ASI statements.
|
|
5
|
+
*
|
|
6
|
+
* @default "always"
|
|
7
|
+
*/
|
|
8
|
+
prefer?: "always" | "never";
|
|
9
|
+
}
|
|
10
|
+
/** `format/quotes` rule options. */
|
|
11
|
+
export interface ITtscLintQuotesRuleOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Quote style for string literals. Template literals are always preserved
|
|
14
|
+
* regardless of this setting.
|
|
15
|
+
*
|
|
16
|
+
* @default "double"
|
|
17
|
+
*/
|
|
18
|
+
prefer?: "double" | "single";
|
|
19
|
+
}
|
|
20
|
+
/** `format/trailing-comma` rule options. */
|
|
21
|
+
export interface ITtscLintTrailingCommaRuleOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Which multi-line lists receive a trailing comma. `"all"` matches prettier's
|
|
24
|
+
* modern default; `"es5"` skips function calls and type parameter lists;
|
|
25
|
+
* `"none"` disables the rule entirely.
|
|
26
|
+
*
|
|
27
|
+
* @default "all"
|
|
28
|
+
*/
|
|
29
|
+
mode?: "all" | "es5" | "none";
|
|
30
|
+
}
|
|
31
|
+
/** `format/sort-imports` rule options. */
|
|
32
|
+
export interface ITtscLintSortImportsRuleOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Ordered list of regex strings (or the `<THIRD_PARTY_MODULES>` placeholder)
|
|
35
|
+
* defining the group order. Imports matching the first pattern land in group
|
|
36
|
+
* 0, the second in group 1, and so on. The placeholder absorbs any specifier
|
|
37
|
+
* that does not match another pattern. Mirrors trivago's `importOrder`
|
|
38
|
+
* semantics.
|
|
39
|
+
*/
|
|
40
|
+
importOrder?: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* Insert a blank line between groups.
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
importOrderSeparation?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Sort named import specifiers alphabetically within each declaration.
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
importOrderSortSpecifiers?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Treat `A` and `a` as equivalent when comparing module specifiers and
|
|
55
|
+
* specifier names. Mirrors trivago's `importOrderCaseInsensitive`.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
importOrderCaseInsensitive?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** `format/print-width` rule options. */
|
|
62
|
+
export interface ITtscLintPrintWidthRuleOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Maximum column width before broken-form layout is chosen. Mirrors
|
|
65
|
+
* prettier's `printWidth`.
|
|
66
|
+
*
|
|
67
|
+
* @default 80
|
|
68
|
+
*/
|
|
69
|
+
printWidth?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Indentation increment in columns. Mirrors prettier's `tabWidth`.
|
|
72
|
+
*
|
|
73
|
+
* @default 2
|
|
74
|
+
*/
|
|
75
|
+
tabWidth?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Emit indentation as tab characters rather than spaces. Mirrors prettier's
|
|
78
|
+
* `useTabs`. Continuation alignment beyond the tab boundary still falls back
|
|
79
|
+
* to spaces, matching dprint's "indent with tabs, align with spaces"
|
|
80
|
+
* convention.
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
useTabs?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Line-terminator emitted on every newline the printer inserts. Mirrors
|
|
87
|
+
* prettier's `endOfLine` `"lf"` and `"crlf"` modes.
|
|
88
|
+
*
|
|
89
|
+
* @default "lf"
|
|
90
|
+
*/
|
|
91
|
+
endOfLine?: "lf" | "crlf";
|
|
92
|
+
}
|
|
93
|
+
/** `format/jsdoc` rule options. */
|
|
94
|
+
export interface ITtscLintJsdocRuleOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Extra `from -> to` tag rewrites layered on top of the built-in synonym
|
|
97
|
+
* table (`@return -> @returns`, `@arg -> @param`, etc.). User-supplied
|
|
98
|
+
* entries win on key collision, so a `{"return": "RETURN"}` entry overrides
|
|
99
|
+
* the built-in default for `@return`.
|
|
100
|
+
*
|
|
101
|
+
* @default {} (use built-in table unchanged)
|
|
102
|
+
*/
|
|
103
|
+
tagSynonyms?: Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Sort JSDoc tag blocks into the canonical order (`@description`, `@param`,
|
|
106
|
+
* `@returns`, ...).
|
|
107
|
+
*
|
|
108
|
+
* @default false (deferred; MVP only normalizes tag names)
|
|
109
|
+
*/
|
|
110
|
+
sortTags?: boolean;
|
|
137
111
|
}
|
|
138
112
|
/**
|
|
139
|
-
* Index from rule name to its option
|
|
113
|
+
* Index from rule name to its option object. `TtscLintRuleMap` uses this to
|
|
140
114
|
* produce precise tuple types per rule.
|
|
141
115
|
*/
|
|
142
|
-
export interface
|
|
143
|
-
"format/semi":
|
|
144
|
-
"format/quotes":
|
|
145
|
-
"format/trailing-comma":
|
|
146
|
-
"format/sort-imports":
|
|
147
|
-
"format/jsdoc":
|
|
148
|
-
"format/print-width":
|
|
116
|
+
export interface ITtscLintRuleOptionsMap {
|
|
117
|
+
"format/semi": ITtscLintSemiRuleOptions;
|
|
118
|
+
"format/quotes": ITtscLintQuotesRuleOptions;
|
|
119
|
+
"format/trailing-comma": ITtscLintTrailingCommaRuleOptions;
|
|
120
|
+
"format/sort-imports": ITtscLintSortImportsRuleOptions;
|
|
121
|
+
"format/jsdoc": ITtscLintJsdocRuleOptions;
|
|
122
|
+
"format/print-width": ITtscLintPrintWidthRuleOptions;
|
|
149
123
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./ITtscLintConfig";
|
|
2
|
+
export * from "./ITtscLintFormatConfig";
|
|
2
3
|
export * from "./ITtscLintPlugin";
|
|
3
4
|
export * from "./ITtscLintPluginConfig";
|
|
4
5
|
export * from "./ITtscLintPluginMeta";
|
|
5
|
-
export * from "./PluginRuleNames";
|
|
6
|
-
export * from "./TtscLintConfig";
|
|
7
|
-
export * from "./TtscLintConfigEntry";
|
|
8
|
-
export * from "./TtscLintFormatConfig";
|
|
9
|
-
export * from "./TtscLintPlugins";
|
|
10
6
|
export * from "./TtscLintRule";
|
|
11
|
-
export * from "./TtscLintRuleEntry";
|
|
12
7
|
export * from "./TtscLintRuleMap";
|
|
13
8
|
export * from "./TtscLintRuleOptions";
|
|
14
9
|
export * from "./TtscLintSeverity";
|
package/lib/structures/index.js
CHANGED
|
@@ -14,17 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./ITtscLintConfig"), exports);
|
|
18
|
+
__exportStar(require("./ITtscLintFormatConfig"), exports);
|
|
18
19
|
__exportStar(require("./ITtscLintPlugin"), exports);
|
|
19
20
|
__exportStar(require("./ITtscLintPluginConfig"), exports);
|
|
20
21
|
__exportStar(require("./ITtscLintPluginMeta"), exports);
|
|
21
|
-
__exportStar(require("./PluginRuleNames"), exports);
|
|
22
|
-
__exportStar(require("./TtscLintConfig"), exports);
|
|
23
|
-
__exportStar(require("./TtscLintConfigEntry"), exports);
|
|
24
|
-
__exportStar(require("./TtscLintFormatConfig"), exports);
|
|
25
|
-
__exportStar(require("./TtscLintPlugins"), exports);
|
|
26
22
|
__exportStar(require("./TtscLintRule"), exports);
|
|
27
|
-
__exportStar(require("./TtscLintRuleEntry"), exports);
|
|
28
23
|
__exportStar(require("./TtscLintRuleMap"), exports);
|
|
29
24
|
__exportStar(require("./TtscLintRuleOptions"), exports);
|
|
30
25
|
__exportStar(require("./TtscLintSeverity"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0DAAwC;AACxC,oDAAkC;AAClC,0DAAwC;AACxC,wDAAsC;AACtC,iDAA+B;AAC/B,oDAAkC;AAClC,wDAAsC;AACtC,qDAAmC"}
|
package/linthost/config.go
CHANGED
|
@@ -490,7 +490,6 @@ func collectExternalConfigEntries(store *ConfigStore, raw any, baseDir, path str
|
|
|
490
490
|
}
|
|
491
491
|
merged := mergeRuleMaps(formatRulesRaw, rulesMap)
|
|
492
492
|
if len(merged) == 0 {
|
|
493
|
-
// `format: { severity: "off" }` and no rules — drop entry.
|
|
494
493
|
return nil
|
|
495
494
|
}
|
|
496
495
|
parsed, err := parseExternalRuleMapInto(merged, path+".rules", store)
|
|
@@ -798,9 +797,7 @@ func LoadConfigResolver(entry *PluginEntry, cwd, tsconfigPath string) (RuleResol
|
|
|
798
797
|
return nil, fmt.Errorf("@ttsc/lint: \"format\" and \"extends\" cannot be combined on a single plugin entry; put format options inside the extends-target lint.config.ts instead")
|
|
799
798
|
}
|
|
800
799
|
|
|
801
|
-
// Expand the format block (if any) into a rules-shaped map.
|
|
802
|
-
// returned map is empty when `format.severity === "off"` so the
|
|
803
|
-
// downstream merge with `rules` still produces the right result.
|
|
800
|
+
// Expand the format block (if any) into a rules-shaped map.
|
|
804
801
|
var formatRulesRaw map[string]any
|
|
805
802
|
if hasFormat {
|
|
806
803
|
formatMap, ok := formatValue.(map[string]any)
|
|
@@ -827,8 +824,6 @@ func LoadConfigResolver(entry *PluginEntry, cwd, tsconfigPath string) (RuleResol
|
|
|
827
824
|
}
|
|
828
825
|
merged := mergeRuleMaps(formatRulesRaw, rulesMap)
|
|
829
826
|
if len(merged) == 0 {
|
|
830
|
-
// `format: { severity: "off" }` with no `rules` field — no
|
|
831
|
-
// rules to register.
|
|
832
827
|
return InlineRuleResolver{Rules: RuleConfig{}, Options: RuleOptionsMap{}}, nil
|
|
833
828
|
}
|
|
834
829
|
cfg, opts, err := ParseRulesWithOptions(merged)
|