@sister.software/oxlint-config 9.3.0 → 11.0.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 +198 -10
- package/out/browser-globals.d.ts +15 -0
- package/out/browser-globals.d.ts.map +1 -0
- package/out/browser-globals.js +76 -0
- package/out/browser-globals.js.map +1 -0
- package/out/console-padding-plugin.d.ts +16 -0
- package/out/console-padding-plugin.d.ts.map +1 -0
- package/out/console-padding-plugin.js +68 -0
- package/out/console-padding-plugin.js.map +1 -0
- package/out/constant-doc-plugin.d.ts +32 -0
- package/out/constant-doc-plugin.d.ts.map +1 -0
- package/out/constant-doc-plugin.js +91 -0
- package/out/constant-doc-plugin.js.map +1 -0
- package/out/headers-plugin.d.ts +6 -2
- package/out/headers-plugin.d.ts.map +1 -1
- package/out/headers-plugin.js +4 -2
- package/out/headers-plugin.js.map +1 -1
- package/out/index.d.ts +166 -13
- package/out/index.d.ts.map +1 -1
- package/out/index.js +332 -6
- package/out/index.js.map +1 -1
- package/out/jsdoc-plugin.d.ts +16 -0
- package/out/jsdoc-plugin.d.ts.map +1 -0
- package/out/jsdoc-plugin.js +68 -0
- package/out/jsdoc-plugin.js.map +1 -0
- package/out/length-truthiness-plugin.d.ts +18 -0
- package/out/length-truthiness-plugin.d.ts.map +1 -0
- package/out/length-truthiness-plugin.js +123 -0
- package/out/length-truthiness-plugin.js.map +1 -0
- package/out/multiline-statement-plugin.d.ts +18 -0
- package/out/multiline-statement-plugin.d.ts.map +1 -0
- package/out/multiline-statement-plugin.js +93 -0
- package/out/multiline-statement-plugin.js.map +1 -0
- package/out/padding-plugin.d.ts +4 -3
- package/out/padding-plugin.d.ts.map +1 -1
- package/out/padding-plugin.js +44 -27
- package/out/padding-plugin.js.map +1 -1
- package/out/padding-utils.d.ts +34 -0
- package/out/padding-utils.d.ts.map +1 -0
- package/out/padding-utils.js +50 -0
- package/out/padding-utils.js.map +1 -0
- package/out/plugin-types.d.ts +68 -3
- package/out/plugin-types.d.ts.map +1 -1
- package/out/plugin.d.ts.map +1 -1
- package/out/plugin.js +17 -0
- package/out/plugin.js.map +1 -1
- package/out/process-globals-plugin.d.ts.map +1 -1
- package/out/process-globals-plugin.js +6 -2
- package/out/process-globals-plugin.js.map +1 -1
- package/out/restrictions.d.ts +9 -3
- package/out/restrictions.d.ts.map +1 -1
- package/out/restrictions.js +4 -70
- package/out/restrictions.js.map +1 -1
- package/out/section-marker-plugin.d.ts +25 -0
- package/out/section-marker-plugin.d.ts.map +1 -0
- package/out/section-marker-plugin.js +234 -0
- package/out/section-marker-plugin.js.map +1 -0
- package/out/threshold-plugin.d.ts +27 -0
- package/out/threshold-plugin.d.ts.map +1 -0
- package/out/threshold-plugin.js +78 -0
- package/out/threshold-plugin.js.map +1 -0
- package/package.json +2 -2
- package/src/browser-globals.ts +77 -0
- package/src/console-padding-plugin.ts +76 -0
- package/src/constant-doc-plugin.ts +124 -0
- package/src/headers-plugin.ts +7 -3
- package/src/index.ts +490 -17
- package/src/jsdoc-plugin.ts +75 -0
- package/src/length-truthiness-plugin.ts +142 -0
- package/src/multiline-statement-plugin.ts +104 -0
- package/src/padding-plugin.ts +44 -29
- package/src/padding-utils.ts +70 -0
- package/src/plugin-types.ts +68 -3
- package/src/plugin.ts +22 -0
- package/src/process-globals-plugin.ts +6 -2
- package/src/restrictions.ts +16 -77
- package/src/section-marker-plugin.ts +306 -0
- package/src/threshold-plugin.ts +105 -0
package/README.md
CHANGED
|
@@ -31,16 +31,43 @@ export default createOxlintConfig({
|
|
|
31
31
|
|
|
32
32
|
### Options
|
|
33
33
|
|
|
34
|
-
| Option
|
|
35
|
-
|
|
|
36
|
-
| `packageNamespace`
|
|
37
|
-
| `copyrightHolder`
|
|
38
|
-
| `spdxLicenseIdentifier`
|
|
39
|
-
| `author`
|
|
40
|
-
| `react`
|
|
41
|
-
| `headers`
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
34
|
+
| Option | Default | Purpose |
|
|
35
|
+
| ------------------------ | ------------------------- | ----------------------------------------------------------- |
|
|
36
|
+
| `packageNamespace` | `@sister.software` | Namespace the runtime-boundary rules apply to. |
|
|
37
|
+
| `copyrightHolder` | `Sister Software` | `@copyright` value stamped into file headers. |
|
|
38
|
+
| `spdxLicenseIdentifier` | `UNLICENSED` | `@license` value stamped into file headers. |
|
|
39
|
+
| `author` | `Teffen Ellis, et al.` | `@author` value stamped into file headers. |
|
|
40
|
+
| `react` | `false` | Enable oxlint's React plugin. |
|
|
41
|
+
| `headers` | `true` | Enforce file headers (error severity, auto-fixed). |
|
|
42
|
+
| `padding` | `true` | Blank line before `return`/block-like statements. |
|
|
43
|
+
| `consolePadding` | `true` | Blank line on each side of a `console.*` call. |
|
|
44
|
+
| `multilineStatementPadding` | `true` | Blank line on each side of a multi-line statement. |
|
|
45
|
+
| `braces` | `true` | Braces around single-statement bodies. |
|
|
46
|
+
| `restrictProcessGlobals` | `false` | Forbid direct `process.env` / `process.argv` access. |
|
|
47
|
+
| `limits` | calibrated defaults | Override individual legibility ceilings. |
|
|
48
|
+
| `testFilePatterns` | `**/*.test.ts`, … | Globs where the size and constant rules switch off. |
|
|
49
|
+
| `generatedFilePatterns` | `**/*.gen.ts`, … | Globs where only the size ceilings switch off. |
|
|
50
|
+
| `untypedFilePatterns` | `**/*.js`, `**/*.mjs`, … | Globs where the multi-line JSDoc requirement switches off. |
|
|
51
|
+
| `unnamedThresholds` | `false` | Flag numeric literals used as comparison thresholds. |
|
|
52
|
+
| `constantDocs` | `false` | Require JSDoc on exported / `SCREAMING_CASE` constants. |
|
|
53
|
+
| `lengthTruthiness` | `true` | Rewrite explicit length comparisons to truthiness. |
|
|
54
|
+
| `multilineJSDoc` | `true` | Require JSDoc blocks to span multiple lines. |
|
|
55
|
+
| `sectionMarkers` | `true` | Enforce the banner → MARK → region → split ladder. |
|
|
56
|
+
| `ignorePatterns` | build output, `.yarn` | Replace the default ignore list. |
|
|
57
|
+
| `overrides` | `{}` | Extra config merged last (escape hatch). |
|
|
58
|
+
|
|
59
|
+
`limits` takes any subset of the ceilings; unspecified keys keep their calibrated default:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
createOxlintConfig({
|
|
63
|
+
spdxLicenseIdentifier: "AGPL-3.0",
|
|
64
|
+
limits: { maxStatements: 60, complexity: 40 },
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Generated files are exempt from the size ceilings only — every correctness rule still applies, because
|
|
69
|
+
generated code ships. Point `generatedFilePatterns` at your own globs if they differ from the defaults
|
|
70
|
+
(`**/*.gen.ts(x)`, `**/*.generated.ts`, `**/generated/**`).
|
|
44
71
|
|
|
45
72
|
## Features
|
|
46
73
|
|
|
@@ -62,3 +89,164 @@ files may not import Node built-ins at all.
|
|
|
62
89
|
A bundled oxlint JS plugin (`sister-software/require-file-header`) reports and auto-fixes the
|
|
63
90
|
`@copyright`/`@license`/`@author` header, preserving any other JSDoc tags already in the leading
|
|
64
91
|
comment block. Run `oxlint --fix` to stamp headers.
|
|
92
|
+
|
|
93
|
+
### Statement padding
|
|
94
|
+
|
|
95
|
+
`padding-lines` (warn, autofixed) puts a blank line before the statements that end a path or a step —
|
|
96
|
+
`return`, `continue`, `break`, a bare `x++`/`x--` — and before block-like statements. An `interface`,
|
|
97
|
+
`type`, `enum` or `namespace` with a body counts as block-like: same braces, same weight on the page.
|
|
98
|
+
|
|
99
|
+
`multiline-statement-padding` (warn, autofixed) puts one on each side of a statement that spans lines,
|
|
100
|
+
so a reader sees where it starts and stops without matching brackets:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const canonical = { const canonical = {
|
|
104
|
+
raw, raw,
|
|
105
|
+
source, source,
|
|
106
|
+
} → }
|
|
107
|
+
const aligned = align()
|
|
108
|
+
const aligned = align()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
An exported declaration is padded exactly like the unexported form — both rules look through the
|
|
112
|
+
`export` wrapper.
|
|
113
|
+
|
|
114
|
+
Neither edge is required at a block boundary, where the brace already separates. `console.*` calls are
|
|
115
|
+
left to the rule below, which groups consecutive ones — this one would split a run that happens to
|
|
116
|
+
contain a tall call, and a run of output is one thing.
|
|
117
|
+
|
|
118
|
+
### Console padding
|
|
119
|
+
|
|
120
|
+
`console-padding` (warn, autofixed) puts a blank line on each side of a `console.*` call, so the lines
|
|
121
|
+
that produce output stand apart from the lines that compute it:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
const total = sum(stats)
|
|
125
|
+
console.log(`${total} shards`) const total = sum(stats)
|
|
126
|
+
const headers = ["source"]
|
|
127
|
+
console.log(headers) → console.log(`${total} shards`)
|
|
128
|
+
|
|
129
|
+
const headers = ["source"]
|
|
130
|
+
|
|
131
|
+
console.log(headers)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
A RUN of calls is one group — no blank lines inside it, one before the first and one after the last,
|
|
135
|
+
because consecutive calls are one block of output. Neither edge is required where a block boundary
|
|
136
|
+
already separates them: nothing before a call that opens a block, nothing after one that closes it.
|
|
137
|
+
|
|
138
|
+
### Section markers
|
|
139
|
+
|
|
140
|
+
Four rules over the comments people use to carve a file into sections. They form one ladder, and each
|
|
141
|
+
rung is a smaller file than the last:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
// ---------------------------------------------------------------
|
|
145
|
+
// Second section → // MARK: Second section
|
|
146
|
+
// ---------------------------------------------------------------
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
1. **`prefer-mark-comment`** (error, autofixed) — a `----` banner is three lines of decoration
|
|
150
|
+
carrying one label. It becomes `// MARK: <label>`, with a blank line on each side. A banner
|
|
151
|
+
wrapping more than one line of prose is reported but never collapsed — that prose is content.
|
|
152
|
+
2. **`concise-section-marker`** (error) — a marker's label is a label, not a paragraph. Past
|
|
153
|
+
`maxBodyLength` (60), the detail belongs in the JSDoc of what it describes, or the file wants
|
|
154
|
+
splitting and an `@file` block.
|
|
155
|
+
3. **`prefer-region-over-marks`** (warn) — past one marker, a file has sections, and sections have
|
|
156
|
+
ENDS. `//#region` / `//#endregion` fold, so a reader can collapse what they are not reading.
|
|
157
|
+
4. **`max-regions`** (warn) — past `maxRegions` (10), the sections want to be files. Deliberately
|
|
158
|
+
high: four well-named regions are usually fine, and splitting can separate a type from its
|
|
159
|
+
helpers. This is a runaway detector, not a style nudge.
|
|
160
|
+
|
|
161
|
+
Rungs 3 and 4 warn rather than error: where a section ends, and whether it should move, are judgment
|
|
162
|
+
calls no fixer gets to make. Both switch off in test files, where the suite's shape is dictated by the
|
|
163
|
+
code under test.
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
createOxlintConfig({ sectionMarkers: { maxBodyLength: 80, maxRegions: 6 } })
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Multi-line JSDoc
|
|
170
|
+
|
|
171
|
+
`multiline-jsdoc` (error, autofixed) expands a one-line block:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
/** The answer. */ → /**
|
|
175
|
+
* The answer.
|
|
176
|
+
*/
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
A one-line block reads as an aside; the multi-line form reads as documentation, and it leaves
|
|
180
|
+
somewhere to put the second sentence. Only blocks that lead their line are rewritten — one sharing a
|
|
181
|
+
line with code is a type cast, and expanding it changes what the line means. Off for
|
|
182
|
+
`untypedFilePatterns`, where a JSDoc block often IS the type annotation.
|
|
183
|
+
|
|
184
|
+
### Legibility tiers
|
|
185
|
+
|
|
186
|
+
v10 turns on four tiers of upstream rules by default:
|
|
187
|
+
|
|
188
|
+
1. **Structural guardrails** — nesting depth, function and file size, parameter count, cyclomatic
|
|
189
|
+
complexity. The numbers are ceilings, calibrated so considered code stays silent and runaway
|
|
190
|
+
generation does not. Tune them with `limits`.
|
|
191
|
+
2. **Defect classes `correctness` misses** — import cycles, in-place `.sort()`/`.reverse()` on
|
|
192
|
+
arrays that may be shared, hook-order violations, `.then()` without a return, dead stores.
|
|
193
|
+
3. **Test discipline** — the vitest plugin, including `expect-expect`, which catches a test that
|
|
194
|
+
runs, passes, and asserts nothing.
|
|
195
|
+
4. **Mechanical hygiene** — literal form, import discipline, modern-API preference. All autofixable
|
|
196
|
+
via `oxlint --fix`.
|
|
197
|
+
|
|
198
|
+
The design record lives in `docs/superpowers/specs/2026-07-28-oxlint-legibility-tiers-design.md`,
|
|
199
|
+
including a register of the rules that were measured and **turned down**. Check it before enabling
|
|
200
|
+
something that looks like an oversight — `no-magic-numbers` in particular is off on purpose, and
|
|
201
|
+
`verify-fixtures.mjs` fails the build if it or eleven others are switched on.
|
|
202
|
+
|
|
203
|
+
### Named thresholds and documented constants
|
|
204
|
+
|
|
205
|
+
Two opt-in rules, complements rather than duplicates:
|
|
206
|
+
|
|
207
|
+
- `unnamedThresholds` flags a number used as a comparison threshold — `if (entries.length > 12)`.
|
|
208
|
+
Numbers inside array and object literals are untouched, so a bounding box or a codepoint table
|
|
209
|
+
stays silent. Radix-prefixed literals are exempt by default: `cp >= 0x3040` already reads as a
|
|
210
|
+
codepoint boundary.
|
|
211
|
+
- `constantDocs` requires a JSDoc block on module-level constants that are exported or
|
|
212
|
+
`SCREAMING_CASE` — the two signals that a constant is public surface or a tuning knob.
|
|
213
|
+
Function-valued constants are out of scope.
|
|
214
|
+
|
|
215
|
+
The first says a threshold needs a name; the second says a name needs an explanation. A data table
|
|
216
|
+
satisfies both by documenting the table, rather than extracting a constant per row.
|
|
217
|
+
|
|
218
|
+
Write provenance in those blocks — what the value means and where it came from:
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
/** Entries above this count mean the surface is too ambiguous to disambiguate; set by the 2026-03 sweep. */
|
|
222
|
+
const AMBIGUITY_CEILING = 12
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Not `/** The ambiguity ceiling. */`, which leaves the reader exactly where they started.
|
|
226
|
+
|
|
227
|
+
### Length checks
|
|
228
|
+
|
|
229
|
+
The house convention is truthiness — `if (items.length)`, not `if (items.length > 0)`.
|
|
230
|
+
`sister-software/prefer-length-truthiness` enforces it and autofixes, which is why
|
|
231
|
+
`unicorn/explicit-length-check` (which enforces the opposite) is off.
|
|
232
|
+
|
|
233
|
+
It only rewrites where the value is already coerced to a boolean — a condition, a ternary test, the
|
|
234
|
+
operand of `!`, or a `&&`/`||` inside one of those. Elsewhere the comparison *is* the value, and
|
|
235
|
+
rewriting it would change the type:
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
if (items.length > 0) { … } // → if (items.length)
|
|
239
|
+
if (items.length === 0) { … } // → if (!items.length)
|
|
240
|
+
const hasItems = items.length > 0 // untouched — this is a boolean, not a condition
|
|
241
|
+
if (items.length === 2) { … } // untouched — not an emptiness check
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Escape hatch
|
|
245
|
+
|
|
246
|
+
Both rules, and every tier rule, take a scoped disable with a stated reason:
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
// oxlint-disable-next-line max-statements -- generated dispatch table; splitting it hides the shape.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Prefer that over a config-level exemption, which silently widens to every future file.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The browser globals whose bare use is ambiguous, and the rule entry built from them. A list
|
|
6
|
+
* this long is reference data — it belongs beside the code that consumes it, not inside the file
|
|
7
|
+
* that assembles the platform-layering overrides.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Browser globals whose bare use is ambiguous (they collide with common identifiers). Browser- and node-runtime files
|
|
11
|
+
* warn on these, nudging toward an explicit `window.` access.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BROWSER_GLOBALS: readonly ["addEventListener", "blur", "close", "closed", "confirm", "defaultStatus", "defaultstatus", "event", "external", "find", "focus", "frameElement", "frames", "history", "innerHeight", "innerWidth", "length", "location", "locationbar", "menubar", "moveBy", "moveTo", "name", "onblur", "onerror", "onfocus", "onload", "onresize", "onunload", "open", "opener", "opera", "outerHeight", "outerWidth", "pageXOffset", "pageYOffset", "parent", "print", "removeEventListener", "resizeBy", "resizeTo", "screen", "screenLeft", "screenTop", "screenX", "screenY", "scroll", "scrollbars", "scrollBy", "scrollTo", "scrollX", "scrollY", "self", "status", "statusbar", "stop", "toolbar", "top"];
|
|
14
|
+
export declare function restrictedBrowserGlobalsRule(): unknown;
|
|
15
|
+
//# sourceMappingURL=browser-globals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-globals.d.ts","sourceRoot":"","sources":["../src/browser-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,+qBA2DlB,CAAA;AAEV,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The browser globals whose bare use is ambiguous, and the rule entry built from them. A list
|
|
6
|
+
* this long is reference data — it belongs beside the code that consumes it, not inside the file
|
|
7
|
+
* that assembles the platform-layering overrides.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Browser globals whose bare use is ambiguous (they collide with common identifiers). Browser- and node-runtime files
|
|
11
|
+
* warn on these, nudging toward an explicit `window.` access.
|
|
12
|
+
*/
|
|
13
|
+
export const BROWSER_GLOBALS = [
|
|
14
|
+
"addEventListener",
|
|
15
|
+
"blur",
|
|
16
|
+
"close",
|
|
17
|
+
"closed",
|
|
18
|
+
"confirm",
|
|
19
|
+
"defaultStatus",
|
|
20
|
+
"defaultstatus",
|
|
21
|
+
"event",
|
|
22
|
+
"external",
|
|
23
|
+
"find",
|
|
24
|
+
"focus",
|
|
25
|
+
"frameElement",
|
|
26
|
+
"frames",
|
|
27
|
+
"history",
|
|
28
|
+
"innerHeight",
|
|
29
|
+
"innerWidth",
|
|
30
|
+
"length",
|
|
31
|
+
"location",
|
|
32
|
+
"locationbar",
|
|
33
|
+
"menubar",
|
|
34
|
+
"moveBy",
|
|
35
|
+
"moveTo",
|
|
36
|
+
"name",
|
|
37
|
+
"onblur",
|
|
38
|
+
"onerror",
|
|
39
|
+
"onfocus",
|
|
40
|
+
"onload",
|
|
41
|
+
"onresize",
|
|
42
|
+
"onunload",
|
|
43
|
+
"open",
|
|
44
|
+
"opener",
|
|
45
|
+
"opera",
|
|
46
|
+
"outerHeight",
|
|
47
|
+
"outerWidth",
|
|
48
|
+
"pageXOffset",
|
|
49
|
+
"pageYOffset",
|
|
50
|
+
"parent",
|
|
51
|
+
"print",
|
|
52
|
+
"removeEventListener",
|
|
53
|
+
"resizeBy",
|
|
54
|
+
"resizeTo",
|
|
55
|
+
"screen",
|
|
56
|
+
"screenLeft",
|
|
57
|
+
"screenTop",
|
|
58
|
+
"screenX",
|
|
59
|
+
"screenY",
|
|
60
|
+
"scroll",
|
|
61
|
+
"scrollbars",
|
|
62
|
+
"scrollBy",
|
|
63
|
+
"scrollTo",
|
|
64
|
+
"scrollX",
|
|
65
|
+
"scrollY",
|
|
66
|
+
"self",
|
|
67
|
+
"status",
|
|
68
|
+
"statusbar",
|
|
69
|
+
"stop",
|
|
70
|
+
"toolbar",
|
|
71
|
+
"top",
|
|
72
|
+
];
|
|
73
|
+
export function restrictedBrowserGlobalsRule() {
|
|
74
|
+
return ["warn", ...BROWSER_GLOBALS.map((name) => ({ name, message: `Ambiguous: did you mean \`window.${name}\`?` }))];
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=browser-globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-globals.js","sourceRoot":"","sources":["../src/browser-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,kBAAkB;IAClB,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,eAAe;IACf,eAAe;IACf,OAAO;IACP,UAAU;IACV,MAAM;IACN,OAAO;IACP,cAAc;IACd,QAAQ;IACR,SAAS;IACT,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,aAAa;IACb,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,UAAU;IACV,MAAM;IACN,QAAQ;IACR,OAAO;IACP,aAAa;IACb,YAAY;IACZ,aAAa;IACb,aAAa;IACb,QAAQ;IACR,OAAO;IACP,qBAAqB;IACrB,UAAU;IACV,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,SAAS;IACT,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,WAAW;IACX,MAAM;IACN,SAAS;IACT,KAAK;CACI,CAAA;AAEV,MAAM,UAAU,4BAA4B;IAC3C,OAAO,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,oCAAoC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;AACtH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The `sister-software/console-padding` rule: a `console.*` call gets a blank line on each
|
|
6
|
+
* side, so the lines that produce output stand apart from the lines that compute it. Scanning a
|
|
7
|
+
* long procedural script for "what does this print" then works visually.
|
|
8
|
+
*
|
|
9
|
+
* A RUN of console calls is one group — no blank lines inside it, one before the first and one
|
|
10
|
+
* after the last, because consecutive calls are one block of output. Neither edge is required
|
|
11
|
+
* where the block boundary already provides the separation: nothing is needed before a call that
|
|
12
|
+
* opens a block, or after one that closes it.
|
|
13
|
+
*/
|
|
14
|
+
import type { Rule } from "./plugin-types.js";
|
|
15
|
+
export declare const consolePaddingRule: Rule;
|
|
16
|
+
//# sourceMappingURL=console-padding-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-padding-plugin.d.ts","sourceRoot":"","sources":["../src/console-padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAsBtD,eAAO,MAAM,kBAAkB,EAAE,IAsChC,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The `sister-software/console-padding` rule: a `console.*` call gets a blank line on each
|
|
6
|
+
* side, so the lines that produce output stand apart from the lines that compute it. Scanning a
|
|
7
|
+
* long procedural script for "what does this print" then works visually.
|
|
8
|
+
*
|
|
9
|
+
* A RUN of console calls is one group — no blank lines inside it, one before the first and one
|
|
10
|
+
* after the last, because consecutive calls are one block of output. Neither edge is required
|
|
11
|
+
* where the block boundary already provides the separation: nothing is needed before a call that
|
|
12
|
+
* opens a block, or after one that closes it.
|
|
13
|
+
*/
|
|
14
|
+
import { createPaddingHelpers } from "./padding-utils.js";
|
|
15
|
+
/**
|
|
16
|
+
* The object whose method calls this rule treats as output.
|
|
17
|
+
*/
|
|
18
|
+
const CONSOLE_OBJECT = "console";
|
|
19
|
+
/**
|
|
20
|
+
* Is this statement a bare `console.<method>(…)` call?
|
|
21
|
+
*/
|
|
22
|
+
function isConsoleStatement(node) {
|
|
23
|
+
if (node?.type !== "ExpressionStatement")
|
|
24
|
+
return false;
|
|
25
|
+
const call = node.expression;
|
|
26
|
+
if (call?.type !== "CallExpression")
|
|
27
|
+
return false;
|
|
28
|
+
const callee = call.callee;
|
|
29
|
+
return (callee?.type === "MemberExpression" && callee.object?.type === "Identifier" && callee.object.name === CONSOLE_OBJECT);
|
|
30
|
+
}
|
|
31
|
+
export const consolePaddingRule = {
|
|
32
|
+
meta: {
|
|
33
|
+
name: "console-padding",
|
|
34
|
+
type: "layout",
|
|
35
|
+
fixable: "whitespace",
|
|
36
|
+
schema: [{ type: "object", additionalProperties: true }],
|
|
37
|
+
},
|
|
38
|
+
create(context) {
|
|
39
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
40
|
+
const text = sourceCode.getText();
|
|
41
|
+
const { requirePadding } = createPaddingHelpers(context);
|
|
42
|
+
return {
|
|
43
|
+
ExpressionStatement(node) {
|
|
44
|
+
if (!isConsoleStatement(node))
|
|
45
|
+
return;
|
|
46
|
+
const parent = node.parent;
|
|
47
|
+
// Only statements in a statement list have neighbours to pad against.
|
|
48
|
+
if (!parent || !Array.isArray(parent.body))
|
|
49
|
+
return;
|
|
50
|
+
const body = parent.body;
|
|
51
|
+
const index = body.indexOf(node);
|
|
52
|
+
if (index === -1)
|
|
53
|
+
return;
|
|
54
|
+
const previous = body[index - 1];
|
|
55
|
+
const next = body[index + 1];
|
|
56
|
+
// Nothing before a call that opens the block, and nothing between calls in one run.
|
|
57
|
+
if (previous && !isConsoleStatement(previous)) {
|
|
58
|
+
requirePadding(previous, node, node, "Expected a blank line before this console call.");
|
|
59
|
+
}
|
|
60
|
+
// Nothing after a call that closes the block — the brace already separates it.
|
|
61
|
+
if (next && !isConsoleStatement(next)) {
|
|
62
|
+
requirePadding(node, next, node, "Expected a blank line after this console call.");
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=console-padding-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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,MAAM,CAAA;gBAE1B,sEAAsE;gBACtE,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBAAE,OAAM;gBAClD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;gBACxB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAEhC,IAAI,KAAK,KAAK,CAAC,CAAC;oBAAE,OAAM;gBACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;gBAChC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;gBAE5B,oFAAoF;gBACpF,IAAI,QAAQ,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC/C,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iDAAiD,CAAC,CAAA;gBACxF,CAAC;gBAED,+EAA+E;gBAC/E,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gDAAgD,CAAC,CAAA;gBACnF,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;CACD,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file A require-constant-doc rule, authored as an oxlint JS plugin (ESLint v9-compatible API). A
|
|
6
|
+
* module-level constant that is exported or SCREAMING_CASE is either public surface or a tuning
|
|
7
|
+
* knob, and in both cases a reader needs to know what the value means and where it came from. A
|
|
8
|
+
* documented table also answers for every number inside it, which is why data-heavy files satisfy
|
|
9
|
+
* this rule without extracting a constant per row.
|
|
10
|
+
*/
|
|
11
|
+
import type { Rule } from "./plugin-types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Which module-level constants the rule applies to.
|
|
14
|
+
*/
|
|
15
|
+
export type ConstantDocScope = "exported" | "screaming" | "exported-or-screaming";
|
|
16
|
+
/**
|
|
17
|
+
* Options accepted by {@link requireConstantDocRule}.
|
|
18
|
+
*/
|
|
19
|
+
export interface ConstantDocOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Defaults to `"exported-or-screaming"`.
|
|
22
|
+
*/
|
|
23
|
+
scope?: ConstantDocScope;
|
|
24
|
+
/**
|
|
25
|
+
* Export names a framework requires and gives meaning to, which a JSDoc block cannot improve on — Pastel's
|
|
26
|
+
* `description` (whose value IS the help text), a route module's `loader`, and so on.
|
|
27
|
+
*/
|
|
28
|
+
ignoreNames?: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare const requireConstantDocRule: Rule;
|
|
31
|
+
export default requireConstantDocRule;
|
|
32
|
+
//# sourceMappingURL=constant-doc-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant-doc-plugin.d.ts","sourceRoot":"","sources":["../src/constant-doc-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAY7C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,uBAAuB,CAAA;AAEjF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,eAAO,MAAM,sBAAsB,EAAE,IA8EpC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file A require-constant-doc rule, authored as an oxlint JS plugin (ESLint v9-compatible API). A
|
|
6
|
+
* module-level constant that is exported or SCREAMING_CASE is either public surface or a tuning
|
|
7
|
+
* knob, and in both cases a reader needs to know what the value means and where it came from. A
|
|
8
|
+
* documented table also answers for every number inside it, which is why data-heavy files satisfy
|
|
9
|
+
* this rule without extracting a constant per row.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Names in SCREAMING_SNAKE_CASE, the convention for a tuning knob.
|
|
13
|
+
*/
|
|
14
|
+
const SCREAMING_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
15
|
+
/**
|
|
16
|
+
* Initializers that make the binding a function rather than a constant value.
|
|
17
|
+
*/
|
|
18
|
+
const FUNCTION_INITIALIZERS = new Set(["ArrowFunctionExpression", "FunctionExpression"]);
|
|
19
|
+
export const requireConstantDocRule = {
|
|
20
|
+
meta: {
|
|
21
|
+
name: "require-constant-doc",
|
|
22
|
+
type: "suggestion",
|
|
23
|
+
schema: [{ type: "object", additionalProperties: true }],
|
|
24
|
+
},
|
|
25
|
+
create(context) {
|
|
26
|
+
const options = (context.options[0] ?? {});
|
|
27
|
+
const scope = options.scope ?? "exported-or-screaming";
|
|
28
|
+
const ignoreNames = new Set(options.ignoreNames);
|
|
29
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
30
|
+
const text = sourceCode.getText();
|
|
31
|
+
const comments = sourceCode.getAllComments();
|
|
32
|
+
/**
|
|
33
|
+
* True when a JSDoc block documents the declaration starting at `start`.
|
|
34
|
+
*
|
|
35
|
+
* Attachment requires the comment to be directly above it — whitespace spanning a single newline. A blank line in
|
|
36
|
+
* between means the comment belongs to something else, which is what separates a declaration's own JSDoc from the
|
|
37
|
+
* file header block that precedes the first declaration in every file.
|
|
38
|
+
*/
|
|
39
|
+
function hasJSDocBefore(start) {
|
|
40
|
+
for (const comment of comments) {
|
|
41
|
+
if (comment.range[1] > start)
|
|
42
|
+
continue;
|
|
43
|
+
if (comment.type !== "Block" || !comment.value.startsWith("*"))
|
|
44
|
+
continue;
|
|
45
|
+
const gap = text.slice(comment.range[1], start);
|
|
46
|
+
if (/^\s*$/.test(gap) && (gap.match(/\n/g) ?? []).length <= 1)
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
function inScope(exported, screaming) {
|
|
52
|
+
if (scope === "exported")
|
|
53
|
+
return exported;
|
|
54
|
+
if (scope === "screaming")
|
|
55
|
+
return screaming;
|
|
56
|
+
return exported || screaming;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
VariableDeclaration(node) {
|
|
60
|
+
if (node.kind !== "const")
|
|
61
|
+
return;
|
|
62
|
+
const exported = node.parent?.type === "ExportNamedDeclaration";
|
|
63
|
+
const container = exported ? node.parent : node;
|
|
64
|
+
// Module level only: the declaration (or its export wrapper) sits directly in Program.
|
|
65
|
+
if (container.parent?.type !== "Program")
|
|
66
|
+
return;
|
|
67
|
+
if (hasJSDocBefore(container.range[0]))
|
|
68
|
+
return;
|
|
69
|
+
for (const declarator of node.declarations ?? []) {
|
|
70
|
+
const id = declarator.id;
|
|
71
|
+
if (id?.type !== "Identifier" || !id.name)
|
|
72
|
+
continue;
|
|
73
|
+
if (ignoreNames.has(id.name))
|
|
74
|
+
continue;
|
|
75
|
+
const initializer = declarator.init;
|
|
76
|
+
if (initializer && FUNCTION_INITIALIZERS.has(initializer.type))
|
|
77
|
+
continue;
|
|
78
|
+
if (!inScope(exported, SCREAMING_CASE.test(id.name)))
|
|
79
|
+
continue;
|
|
80
|
+
context.report({
|
|
81
|
+
node: declarator,
|
|
82
|
+
message: `\`${id.name}\` is ${exported ? "exported" : "a named constant"} but undocumented — add a ` +
|
|
83
|
+
`JSDoc block saying what the value means and where it came from.`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export default requireConstantDocRule;
|
|
91
|
+
//# sourceMappingURL=constant-doc-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant-doc-plugin.js","sourceRoot":"","sources":["../src/constant-doc-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;GAEG;AACH,MAAM,cAAc,GAAG,mBAAmB,CAAA;AAE1C;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,yBAAyB,EAAE,oBAAoB,CAAC,CAAC,CAAA;AAsBxF,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC3C,IAAI,EAAE;QACL,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;KACxD;IACD,MAAM,CAAC,OAAO;QACb,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAuB,CAAA;QAChE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,uBAAuB,CAAA;QACtD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAChD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,aAAc,EAAE,CAAA;QACjE,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,EAAE,CAAA;QACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,EAAE,CAAA;QAE5C;;;;;;WAMG;QACH,SAAS,cAAc,CAAC,KAAa;YACpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAChC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK;oBAAE,SAAQ;gBAEtC,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,C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IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;wBAAE,SAAQ;oBAEtC,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAA;oBAEnC,IAAI,WAAW,IAAI,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC;wBAAE,SAAQ;oBAExE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;wBAAE,SAAQ;oBAE9D,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI,EAAE,UAAU;wBAChB,OAAO,EACN,KAAK,EAAE,CAAC,IAAI,SAAS,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,4BAA4B;4BAC3F,iEAAiE;qBAClE,CAAC,CAAA;gBACH,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;CACD,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
package/out/headers-plugin.d.ts
CHANGED
|
@@ -7,14 +7,18 @@
|
|
|
7
7
|
* while preserving any other JSDoc tags already present in the leading comment block.
|
|
8
8
|
*/
|
|
9
9
|
import type { Plugin, Rule } from "./plugin-types.js";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Options accepted by the header rule.
|
|
12
|
+
*/
|
|
11
13
|
export interface HeaderRuleOptions {
|
|
12
14
|
copyrightHolder?: string;
|
|
13
15
|
spdxLicenseIdentifier?: string;
|
|
14
16
|
author?: string;
|
|
15
17
|
}
|
|
16
18
|
export declare const headerRule: Rule;
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The Sister Software oxlint header plugin. Registers the `sister-software/require-file-header` rule.
|
|
21
|
+
*/
|
|
18
22
|
declare const headerPlugin: Plugin;
|
|
19
23
|
export default headerPlugin;
|
|
20
24
|
//# sourceMappingURL=headers-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers-plugin.d.ts","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE9D
|
|
1
|
+
{"version":3,"file":"headers-plugin.d.ts","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAeD,eAAO,MAAM,UAAU,EAAE,IAiExB,CAAA;AAED;;GAEG;AACH,QAAA,MAAM,YAAY,EAAE,MAGnB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/out/headers-plugin.js
CHANGED
|
@@ -49,7 +49,7 @@ export const headerRule = {
|
|
|
49
49
|
if (leading) {
|
|
50
50
|
const existing = parseInnerLines(leading);
|
|
51
51
|
const missing = headerLines.filter((line) => !existing.includes(line));
|
|
52
|
-
if (missing.length
|
|
52
|
+
if (!missing.length)
|
|
53
53
|
return;
|
|
54
54
|
const preserved = existing.filter((line) => !HEADER_TAG_PATTERN.test(line));
|
|
55
55
|
const block = buildBlock(preserved);
|
|
@@ -76,7 +76,9 @@ export const headerRule = {
|
|
|
76
76
|
};
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* The Sister Software oxlint header plugin. Registers the `sister-software/require-file-header` rule.
|
|
81
|
+
*/
|
|
80
82
|
const headerPlugin = {
|
|
81
83
|
meta: { name: "sister-software" },
|
|
82
84
|
rules: { "require-file-header": headerRule },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers-plugin.js","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"headers-plugin.js","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,MAAM,kBAAkB,GAAG,gCAAgC,CAAA;AAE3D;;;GAGG;AACH,SAAS,eAAe,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,KAAK;SAClB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACjE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAS;IAC/B,IAAI,EAAE;QACL,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM;QACf,0FAA0F;QAC1F,wDAAwD;QACxD,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;KACxD;IACD,MAAM,CAAC,OAAO;QACb,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAsB,CAAA;QAC/D,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,iBAAiB,CAAA;QACpE,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,YAAY,CAAA;QAC3E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,sBAAsB,CAAA;QACvD,MAAM,WAAW,GAAG,CAAC,cAAc,eAAe,EAAE,EAAE,YAAY,qBAAqB,EAAE,EAAE,WAAW,MAAM,EAAE,CAAC,CAAA;QAE/G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