@sister.software/oxlint-config 10.0.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 +96 -0
- 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 +9 -3
- package/out/constant-doc-plugin.d.ts.map +1 -1
- package/out/constant-doc-plugin.js +6 -2
- package/out/constant-doc-plugin.js.map +1 -1
- package/out/headers-plugin.d.ts +6 -2
- package/out/headers-plugin.d.ts.map +1 -1
- package/out/headers-plugin.js +3 -1
- package/out/headers-plugin.js.map +1 -1
- package/out/index.d.ts +111 -27
- package/out/index.d.ts.map +1 -1
- package/out/index.js +57 -5
- 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.map +1 -1
- package/out/length-truthiness-plugin.js +15 -5
- package/out/length-truthiness-plugin.js.map +1 -1
- 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 +55 -13
- package/out/plugin-types.d.ts.map +1 -1
- package/out/plugin.d.ts.map +1 -1
- package/out/plugin.js +11 -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 +9 -3
- package/out/threshold-plugin.d.ts.map +1 -1
- package/out/threshold-plugin.js +9 -3
- package/out/threshold-plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/browser-globals.ts +77 -0
- package/src/console-padding-plugin.ts +76 -0
- package/src/constant-doc-plugin.ts +15 -5
- package/src/headers-plugin.ts +6 -2
- package/src/index.ts +166 -29
- package/src/jsdoc-plugin.ts +75 -0
- package/src/length-truthiness-plugin.ts +15 -5
- 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 +55 -13
- package/src/plugin.ts +16 -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 +18 -6
package/README.md
CHANGED
|
@@ -40,14 +40,19 @@ export default createOxlintConfig({
|
|
|
40
40
|
| `react` | `false` | Enable oxlint's React plugin. |
|
|
41
41
|
| `headers` | `true` | Enforce file headers (error severity, auto-fixed). |
|
|
42
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. |
|
|
43
45
|
| `braces` | `true` | Braces around single-statement bodies. |
|
|
44
46
|
| `restrictProcessGlobals` | `false` | Forbid direct `process.env` / `process.argv` access. |
|
|
45
47
|
| `limits` | calibrated defaults | Override individual legibility ceilings. |
|
|
46
48
|
| `testFilePatterns` | `**/*.test.ts`, … | Globs where the size and constant rules switch off. |
|
|
47
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. |
|
|
48
51
|
| `unnamedThresholds` | `false` | Flag numeric literals used as comparison thresholds. |
|
|
49
52
|
| `constantDocs` | `false` | Require JSDoc on exported / `SCREAMING_CASE` constants. |
|
|
50
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. |
|
|
51
56
|
| `ignorePatterns` | build output, `.yarn` | Replace the default ignore list. |
|
|
52
57
|
| `overrides` | `{}` | Extra config merged last (escape hatch). |
|
|
53
58
|
|
|
@@ -85,6 +90,97 @@ A bundled oxlint JS plugin (`sister-software/require-file-header`) reports and a
|
|
|
85
90
|
`@copyright`/`@license`/`@author` header, preserving any other JSDoc tags already in the leading
|
|
86
91
|
comment block. Run `oxlint --fix` to stamp headers.
|
|
87
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
|
+
|
|
88
184
|
### Legibility tiers
|
|
89
185
|
|
|
90
186
|
v10 turns on four tiers of upstream rules by default:
|
|
@@ -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
|
+
{"version":3,"file":"console-padding-plugin.js","sourceRoot":"","sources":["../src/console-padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAGzD;;GAEG;AACH,MAAM,cAAc,GAAG,SAAS,CAAA;AAEhC;;GAEG;AACH,SAAS,kBAAkB,CAAC,IAAyB;IACpD,IAAI,IAAI,EAAE,IAAI,KAAK,qBAAqB;QAAE,OAAO,KAAK,CAAA;IACtD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAA;IAE5B,IAAI,IAAI,EAAE,IAAI,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAA;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,CACN,MAAM,EAAE,IAAI,KAAK,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,KAAK,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CACpH,CAAA;AACF,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACvC,IAAI,EAAE;QACL,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO,EAA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gBACnF,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;CACD,CAAA"}
|
|
@@ -9,11 +9,17 @@
|
|
|
9
9
|
* this rule without extracting a constant per row.
|
|
10
10
|
*/
|
|
11
11
|
import type { Rule } from "./plugin-types.js";
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Which module-level constants the rule applies to.
|
|
14
|
+
*/
|
|
13
15
|
export type ConstantDocScope = "exported" | "screaming" | "exported-or-screaming";
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Options accepted by {@link requireConstantDocRule}.
|
|
18
|
+
*/
|
|
15
19
|
export interface ConstantDocOptions {
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Defaults to `"exported-or-screaming"`.
|
|
22
|
+
*/
|
|
17
23
|
scope?: ConstantDocScope;
|
|
18
24
|
/**
|
|
19
25
|
* Export names a framework requires and gives meaning to, which a JSDoc block cannot improve on — Pastel's
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
* documented table also answers for every number inside it, which is why data-heavy files satisfy
|
|
9
9
|
* this rule without extracting a constant per row.
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Names in SCREAMING_SNAKE_CASE, the convention for a tuning knob.
|
|
13
|
+
*/
|
|
12
14
|
const SCREAMING_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Initializers that make the binding a function rather than a constant value.
|
|
17
|
+
*/
|
|
14
18
|
const FUNCTION_INITIALIZERS = new Set(["ArrowFunctionExpression", "FunctionExpression"]);
|
|
15
19
|
export const requireConstantDocRule = {
|
|
16
20
|
meta: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant-doc-plugin.js","sourceRoot":"","sources":["../src/constant-doc-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH
|
|
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,KA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
|
* 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
|
@@ -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,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,EAAE,EAAE,qBAAqB,EAAE,UAAU,EAAE;CAC5C,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/out/index.d.ts
CHANGED
|
@@ -5,25 +5,45 @@
|
|
|
5
5
|
* @file oxlint configuration factory for Sister Software projects.
|
|
6
6
|
*/
|
|
7
7
|
export * from "./restrictions.js";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* An oxlint configuration object, as consumed by `oxlint.config.ts` / `.oxlintrc.json`.
|
|
10
|
+
*/
|
|
9
11
|
export type OxlintConfig = Record<string, unknown>;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Numeric ceilings for the legibility-guardrail rules. Each is a hard ceiling, not a target.
|
|
14
|
+
*/
|
|
11
15
|
export interface OxlintConfigLimits {
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Maximum block nesting depth.
|
|
18
|
+
*/
|
|
13
19
|
maxDepth: number;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Maximum parameters on a single function.
|
|
22
|
+
*/
|
|
15
23
|
maxParams: number;
|
|
16
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Maximum statements in a single function body.
|
|
26
|
+
*/
|
|
17
27
|
maxStatements: number;
|
|
18
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Maximum lines in a single function body, blank lines and comments excluded.
|
|
30
|
+
*/
|
|
19
31
|
maxLinesPerFunction: number;
|
|
20
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Maximum lines in a single file, blank lines and comments excluded.
|
|
34
|
+
*/
|
|
21
35
|
maxLines: number;
|
|
22
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Maximum nested callback depth.
|
|
38
|
+
*/
|
|
23
39
|
maxNestedCallbacks: number;
|
|
24
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Maximum nested call-expression depth, e.g. `a(b(c(d())))`.
|
|
42
|
+
*/
|
|
25
43
|
maxNestedCalls: number;
|
|
26
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Maximum cyclomatic complexity of a single function.
|
|
46
|
+
*/
|
|
27
47
|
complexity: number;
|
|
28
48
|
}
|
|
29
49
|
/**
|
|
@@ -45,7 +65,9 @@ export interface OxlintConfigLimits {
|
|
|
45
65
|
* toward the knee makes them do more of that job.
|
|
46
66
|
*/
|
|
47
67
|
export declare const DefaultLimits: OxlintConfigLimits;
|
|
48
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Globs treated as test files, where the size and named-constant rules are switched off.
|
|
70
|
+
*/
|
|
49
71
|
export declare const DefaultTestFilePatterns: string[];
|
|
50
72
|
/**
|
|
51
73
|
* Globs whose contents are emitted by a generator, not written by hand. The size ceilings are meaningless there — the
|
|
@@ -53,23 +75,55 @@ export declare const DefaultTestFilePatterns: string[];
|
|
|
53
75
|
* applies, because generated code ships.
|
|
54
76
|
*/
|
|
55
77
|
export declare const DefaultGeneratedFilePatterns: string[];
|
|
56
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Globs for files JavaScript checks at runtime rather than TypeScript checking ahead of it. A JSDoc block there often
|
|
80
|
+
* IS the type annotation, and a one-line `@type` cast is the idiomatic form — so the multi-line requirement, which
|
|
81
|
+
* exists to make prose read as documentation, does not apply.
|
|
82
|
+
*/
|
|
83
|
+
export declare const DefaultUntypedFilePatterns: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Options for {@link createOxlintConfig}.
|
|
86
|
+
*/
|
|
57
87
|
export interface OxlintConfigOptions {
|
|
58
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* The package namespace whose runtime boundaries are enforced, e.g. `@sister.software`.
|
|
90
|
+
*/
|
|
59
91
|
packageNamespace?: string;
|
|
60
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The copyright holder stamped into file headers.
|
|
94
|
+
*/
|
|
61
95
|
copyrightHolder?: string;
|
|
62
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The SPDX license identifier stamped into file headers.
|
|
98
|
+
*/
|
|
63
99
|
spdxLicenseIdentifier?: string;
|
|
64
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* The author stamped into file headers.
|
|
102
|
+
*/
|
|
65
103
|
author?: string;
|
|
66
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Enable oxlint's React plugin (off by default).
|
|
106
|
+
*/
|
|
67
107
|
react?: boolean;
|
|
68
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Enforce file headers via the bundled JS plugin (on by default).
|
|
110
|
+
*/
|
|
69
111
|
headers?: boolean;
|
|
70
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Require a blank line before `return`/block-like statements (on by default).
|
|
114
|
+
*/
|
|
71
115
|
padding?: boolean;
|
|
72
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Blank line on each side of a `console.*` call, with runs of them grouped (on by default).
|
|
118
|
+
*/
|
|
119
|
+
consolePadding?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Blank line on each side of a statement that spans lines (on by default).
|
|
122
|
+
*/
|
|
123
|
+
multilineStatementPadding?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Require braces around single-statement work bodies (bare `return` exempt; on by default).
|
|
126
|
+
*/
|
|
73
127
|
braces?: boolean;
|
|
74
128
|
/**
|
|
75
129
|
* Forbid direct `process.env` / `process.argv` access (off by default). Turn on once the project funnels those reads
|
|
@@ -91,20 +145,50 @@ export interface OxlintConfigOptions {
|
|
|
91
145
|
constantDocs?: boolean | {
|
|
92
146
|
scope?: "exported" | "screaming" | "exported-or-screaming";
|
|
93
147
|
};
|
|
94
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Rewrite explicit length comparisons to truthiness in boolean positions (on by default).
|
|
150
|
+
*/
|
|
95
151
|
lengthTruthiness?: boolean;
|
|
96
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Require JSDoc blocks to span multiple lines (on by default). Off for untyped files.
|
|
154
|
+
*/
|
|
155
|
+
multilineJSDoc?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Enforce the section-marker ladder — `----` banners become `// MARK:`, long labels are flagged, and a file with many
|
|
158
|
+
* markers is nudged toward regions and then toward being several files (on by default).
|
|
159
|
+
*/
|
|
160
|
+
sectionMarkers?: boolean | {
|
|
161
|
+
maxBodyLength?: number;
|
|
162
|
+
maxRegions?: number;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Override individual legibility ceilings. Unspecified keys keep their calibrated default.
|
|
166
|
+
*/
|
|
97
167
|
limits?: Partial<OxlintConfigLimits>;
|
|
98
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* Replace the globs treated as test files.
|
|
170
|
+
*/
|
|
99
171
|
testFilePatterns?: string[];
|
|
100
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* Replace the globs treated as generated files, where only the size ceilings are switched off.
|
|
174
|
+
*/
|
|
101
175
|
generatedFilePatterns?: string[];
|
|
102
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Replace the globs treated as untyped, where the multi-line JSDoc requirement switches off.
|
|
178
|
+
*/
|
|
179
|
+
untypedFilePatterns?: string[];
|
|
180
|
+
/**
|
|
181
|
+
* Override the default ignore patterns.
|
|
182
|
+
*/
|
|
103
183
|
ignorePatterns?: string[];
|
|
104
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Extra config deep-merged last; an escape hatch for per-repo tweaks.
|
|
186
|
+
*/
|
|
105
187
|
overrides?: OxlintConfig;
|
|
106
188
|
}
|
|
107
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Default ignore patterns for generated/build output and vendored tooling.
|
|
191
|
+
*/
|
|
108
192
|
export declare const DefaultIgnorePatterns: string[];
|
|
109
193
|
/**
|
|
110
194
|
* Builds the complete oxlint configuration for a Sister Software package.
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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