@sister.software/oxlint-config 10.0.0 → 12.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.
Files changed (82) hide show
  1. package/README.md +169 -0
  2. package/out/acronym-case-plugin.d.ts +80 -0
  3. package/out/acronym-case-plugin.d.ts.map +1 -0
  4. package/out/acronym-case-plugin.js +272 -0
  5. package/out/acronym-case-plugin.js.map +1 -0
  6. package/out/browser-globals.d.ts +15 -0
  7. package/out/browser-globals.d.ts.map +1 -0
  8. package/out/browser-globals.js +76 -0
  9. package/out/browser-globals.js.map +1 -0
  10. package/out/console-padding-plugin.d.ts +16 -0
  11. package/out/console-padding-plugin.d.ts.map +1 -0
  12. package/out/console-padding-plugin.js +68 -0
  13. package/out/console-padding-plugin.js.map +1 -0
  14. package/out/constant-doc-plugin.d.ts +9 -3
  15. package/out/constant-doc-plugin.d.ts.map +1 -1
  16. package/out/constant-doc-plugin.js +6 -2
  17. package/out/constant-doc-plugin.js.map +1 -1
  18. package/out/headers-plugin.d.ts +6 -2
  19. package/out/headers-plugin.d.ts.map +1 -1
  20. package/out/headers-plugin.js +3 -1
  21. package/out/headers-plugin.js.map +1 -1
  22. package/out/index.d.ts +123 -27
  23. package/out/index.d.ts.map +1 -1
  24. package/out/index.js +63 -5
  25. package/out/index.js.map +1 -1
  26. package/out/jsdoc-plugin.d.ts +16 -0
  27. package/out/jsdoc-plugin.d.ts.map +1 -0
  28. package/out/jsdoc-plugin.js +68 -0
  29. package/out/jsdoc-plugin.js.map +1 -0
  30. package/out/length-truthiness-plugin.d.ts.map +1 -1
  31. package/out/length-truthiness-plugin.js +15 -5
  32. package/out/length-truthiness-plugin.js.map +1 -1
  33. package/out/multiline-statement-plugin.d.ts +18 -0
  34. package/out/multiline-statement-plugin.d.ts.map +1 -0
  35. package/out/multiline-statement-plugin.js +93 -0
  36. package/out/multiline-statement-plugin.js.map +1 -0
  37. package/out/padding-plugin.d.ts +4 -3
  38. package/out/padding-plugin.d.ts.map +1 -1
  39. package/out/padding-plugin.js +44 -27
  40. package/out/padding-plugin.js.map +1 -1
  41. package/out/padding-utils.d.ts +34 -0
  42. package/out/padding-utils.d.ts.map +1 -0
  43. package/out/padding-utils.js +50 -0
  44. package/out/padding-utils.js.map +1 -0
  45. package/out/plugin-types.d.ts +75 -13
  46. package/out/plugin-types.d.ts.map +1 -1
  47. package/out/plugin.d.ts.map +1 -1
  48. package/out/plugin.js +13 -0
  49. package/out/plugin.js.map +1 -1
  50. package/out/process-globals-plugin.d.ts.map +1 -1
  51. package/out/process-globals-plugin.js +6 -2
  52. package/out/process-globals-plugin.js.map +1 -1
  53. package/out/restrictions.d.ts +9 -3
  54. package/out/restrictions.d.ts.map +1 -1
  55. package/out/restrictions.js +4 -70
  56. package/out/restrictions.js.map +1 -1
  57. package/out/section-marker-plugin.d.ts +25 -0
  58. package/out/section-marker-plugin.d.ts.map +1 -0
  59. package/out/section-marker-plugin.js +234 -0
  60. package/out/section-marker-plugin.js.map +1 -0
  61. package/out/threshold-plugin.d.ts +9 -3
  62. package/out/threshold-plugin.d.ts.map +1 -1
  63. package/out/threshold-plugin.js +9 -3
  64. package/out/threshold-plugin.js.map +1 -1
  65. package/package.json +3 -3
  66. package/src/acronym-case-plugin.ts +370 -0
  67. package/src/browser-globals.ts +77 -0
  68. package/src/console-padding-plugin.ts +76 -0
  69. package/src/constant-doc-plugin.ts +15 -5
  70. package/src/headers-plugin.ts +6 -2
  71. package/src/index.ts +183 -29
  72. package/src/jsdoc-plugin.ts +75 -0
  73. package/src/length-truthiness-plugin.ts +15 -5
  74. package/src/multiline-statement-plugin.ts +104 -0
  75. package/src/padding-plugin.ts +44 -29
  76. package/src/padding-utils.ts +70 -0
  77. package/src/plugin-types.ts +75 -13
  78. package/src/plugin.ts +18 -0
  79. package/src/process-globals-plugin.ts +6 -2
  80. package/src/restrictions.ts +16 -77
  81. package/src/section-marker-plugin.ts +306 -0
  82. package/src/threshold-plugin.ts +18 -6
package/README.md CHANGED
@@ -40,14 +40,20 @@ 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. |
53
+ | `acronymCasing` | `false` | Flag an acronym title-cased inside an identifier. |
50
54
  | `lengthTruthiness` | `true` | Rewrite explicit length comparisons to truthiness. |
55
+ | `multilineJSDoc` | `true` | Require JSDoc blocks to span multiple lines. |
56
+ | `sectionMarkers` | `true` | Enforce the banner → MARK → region → split ladder. |
51
57
  | `ignorePatterns` | build output, `.yarn` | Replace the default ignore list. |
52
58
  | `overrides` | `{}` | Extra config merged last (escape hatch). |
53
59
 
@@ -85,6 +91,97 @@ A bundled oxlint JS plugin (`sister-software/require-file-header`) reports and a
85
91
  `@copyright`/`@license`/`@author` header, preserving any other JSDoc tags already in the leading
86
92
  comment block. Run `oxlint --fix` to stamp headers.
87
93
 
94
+ ### Statement padding
95
+
96
+ `padding-lines` (warn, autofixed) puts a blank line before the statements that end a path or a step —
97
+ `return`, `continue`, `break`, a bare `x++`/`x--` — and before block-like statements. An `interface`,
98
+ `type`, `enum` or `namespace` with a body counts as block-like: same braces, same weight on the page.
99
+
100
+ `multiline-statement-padding` (warn, autofixed) puts one on each side of a statement that spans lines,
101
+ so a reader sees where it starts and stops without matching brackets:
102
+
103
+ ```ts
104
+ const canonical = { const canonical = {
105
+ raw, raw,
106
+ source, source,
107
+ } → }
108
+ const aligned = align()
109
+ const aligned = align()
110
+ ```
111
+
112
+ An exported declaration is padded exactly like the unexported form — both rules look through the
113
+ `export` wrapper.
114
+
115
+ Neither edge is required at a block boundary, where the brace already separates. `console.*` calls are
116
+ left to the rule below, which groups consecutive ones — this one would split a run that happens to
117
+ contain a tall call, and a run of output is one thing.
118
+
119
+ ### Console padding
120
+
121
+ `console-padding` (warn, autofixed) puts a blank line on each side of a `console.*` call, so the lines
122
+ that produce output stand apart from the lines that compute it:
123
+
124
+ ```ts
125
+ const total = sum(stats)
126
+ console.log(`${total} shards`) const total = sum(stats)
127
+ const headers = ["source"]
128
+ console.log(headers) → console.log(`${total} shards`)
129
+
130
+ const headers = ["source"]
131
+
132
+ console.log(headers)
133
+ ```
134
+
135
+ A RUN of calls is one group — no blank lines inside it, one before the first and one after the last,
136
+ because consecutive calls are one block of output. Neither edge is required where a block boundary
137
+ already separates them: nothing before a call that opens a block, nothing after one that closes it.
138
+
139
+ ### Section markers
140
+
141
+ Four rules over the comments people use to carve a file into sections. They form one ladder, and each
142
+ rung is a smaller file than the last:
143
+
144
+ ```ts
145
+ // ---------------------------------------------------------------
146
+ // Second section → // MARK: Second section
147
+ // ---------------------------------------------------------------
148
+ ```
149
+
150
+ 1. **`prefer-mark-comment`** (error, autofixed) — a `----` banner is three lines of decoration
151
+ carrying one label. It becomes `// MARK: <label>`, with a blank line on each side. A banner
152
+ wrapping more than one line of prose is reported but never collapsed — that prose is content.
153
+ 2. **`concise-section-marker`** (error) — a marker's label is a label, not a paragraph. Past
154
+ `maxBodyLength` (60), the detail belongs in the JSDoc of what it describes, or the file wants
155
+ splitting and an `@file` block.
156
+ 3. **`prefer-region-over-marks`** (warn) — past one marker, a file has sections, and sections have
157
+ ENDS. `//#region` / `//#endregion` fold, so a reader can collapse what they are not reading.
158
+ 4. **`max-regions`** (warn) — past `maxRegions` (10), the sections want to be files. Deliberately
159
+ high: four well-named regions are usually fine, and splitting can separate a type from its
160
+ helpers. This is a runaway detector, not a style nudge.
161
+
162
+ Rungs 3 and 4 warn rather than error: where a section ends, and whether it should move, are judgment
163
+ calls no fixer gets to make. Both switch off in test files, where the suite's shape is dictated by the
164
+ code under test.
165
+
166
+ ```ts
167
+ createOxlintConfig({ sectionMarkers: { maxBodyLength: 80, maxRegions: 6 } })
168
+ ```
169
+
170
+ ### Multi-line JSDoc
171
+
172
+ `multiline-jsdoc` (error, autofixed) expands a one-line block:
173
+
174
+ ```ts
175
+ /** The answer. */ → /**
176
+ * The answer.
177
+ */
178
+ ```
179
+
180
+ A one-line block reads as an aside; the multi-line form reads as documentation, and it leaves
181
+ somewhere to put the second sentence. Only blocks that lead their line are rewritten — one sharing a
182
+ line with code is a type cast, and expanding it changes what the line means. Off for
183
+ `untypedFilePatterns`, where a JSDoc block often IS the type annotation.
184
+
88
185
  ### Legibility tiers
89
186
 
90
187
  v10 turns on four tiers of upstream rules by default:
@@ -128,6 +225,78 @@ const AMBIGUITY_CEILING = 12
128
225
 
129
226
  Not `/** The ambiguity ceiling. */`, which leaves the reader exactly where they started.
130
227
 
228
+ ### Acronym casing
229
+
230
+ `acronymCasing` turns on `sister-software/no-title-case-acronym`, which enforces that an acronym is
231
+ capitalized as a whole camelCase component — `parseJSON`, `POILookup`, `createWOFResolver` — and
232
+ reports the title-cased spelling:
233
+
234
+ ```ts
235
+ export function parseJson() {} // → parseJSON
236
+ export interface PoiBoard { // → POIBoard
237
+ sourceUrl: string // → sourceURL
238
+ }
239
+ ```
240
+
241
+ The mechanism knows no vocabulary of its own. `DefaultAcronyms` is a generic list (`JSON`, `HTTP`,
242
+ `URL`, `SQL`, …); a project layers its own on top, and the policy stays in the config:
243
+
244
+ ```ts
245
+ createOxlintConfig({
246
+ acronymCasing: {
247
+ extraAcronyms: ["POI", "WOF", "NUTS", "ONNX"],
248
+ // Names whose casing is not ours to choose: an external library's own spelling, a wire field
249
+ // someone else named, or a prop a framework derives from something else (Pastel turns
250
+ // `--run-id` into `runId`, so the schema key has to match its derivation).
251
+ ignoreNames: ["HttpStatusCode", "operationId", "runId"],
252
+ },
253
+ })
254
+ ```
255
+
256
+ `acronyms` replaces that list outright; `extraAcronyms` extends whichever list is in effect. Add an
257
+ acronym once the project has settled on its capitalized form — the rule reports drift from an
258
+ established convention, it does not invent one.
259
+
260
+ **`ID` is on the default list, and `Id` is NOT the house form** — it is `placeID`, `sourceID`,
261
+ `nodeID`. `ID` is the one default short enough to hide inside ordinary words (`Identifier`, `Idle`,
262
+ `Ideal`), which is what the component boundary is for, and it holds: none of those end a component.
263
+ The other short candidates were measured against a 1,587-file corpus and turned down — `IO` because
264
+ `IoT` is the settled spelling, so the rule would report `IoTGateway` and suggest the wrong
265
+ `IOTGateway`; `UI` because `UiButton` is a deliberate choice in plenty of React codebases and `UiPath`
266
+ is a vendor that spells itself that way; `DB` because it is a shorthand for one word rather than an
267
+ initialism, and every occurrence measured was a Pastel option key derived from `--admin-db`. Add any
268
+ of them per project if your own corpus says otherwise.
269
+
270
+ **Whole components, not substrings.** `Poi` lives inside `Point`, `Id` inside `Identifier`, `Us`
271
+ inside `User`. A run counts only where it ENDS at an uppercase letter, a digit, `_`, or the end of the
272
+ identifier, and STARTS at the identifier's start or after a lowercase letter, digit or underscore. So
273
+ `PoiBoard` is reported and `Point`, `Pointer`, `Client` and `Jsonify` are not.
274
+
275
+ **Scope.** The default, `"exported"`, reads the names a consumer can see: exported declarations, the
276
+ members of exported interfaces, classes and enums, and the exported half of a re-export. That is where
277
+ a wrong acronym costs someone a breaking rename later; a local costs nothing to rename at any time.
278
+ `scope: "all"` reads every declaration in the file, exported or not.
279
+
280
+ **Names you did not choose are never read**, at either scope. An object literal's keys are a wire
281
+ contract whose casing belongs to whoever is on the other end, and the LEFT half of a destructuring
282
+ rename is the source object's property, not a declaration:
283
+
284
+ ```ts
285
+ const { baseUrl: baseURL } = docusaurusContext.siteConfig // `baseUrl` is Docusaurus's key — silent
286
+ return { operationId: id } // OpenAPI's field name — silent
287
+ ```
288
+
289
+ The rule is deliberately **not** auto-fixable: renaming a declaration without renaming its references
290
+ produces code that does not compile, and a linter cannot see the references.
291
+
292
+ Prefer a scoped disable over an `ignoreNames` entry, which silently covers every future declaration of
293
+ the same name:
294
+
295
+ ```ts
296
+ // oxlint-disable-next-line sister-software/no-title-case-acronym -- kysely spells its own dialect classes this way.
297
+ export interface SqliteJsonDialect {}
298
+ ```
299
+
131
300
  ### Length checks
132
301
 
133
302
  The house convention is truthiness — `if (items.length)`, not `if (items.length > 0)`.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file A no-title-case-acronym rule, authored as an oxlint JS plugin (ESLint v9-compatible API). An
6
+ * acronym is capitalized as a whole camelCase component — `parseJSON`, `POILookup`,
7
+ * `createWOFResolver` — never title-cased. The mechanism knows nothing about any particular
8
+ * project: the acronyms are options, so adding one is a config edit rather than a code change.
9
+ *
10
+ * The subtlety the rule exists for is the COMPONENT BOUNDARY. `Poi` appears inside `Point`, `Id`
11
+ * inside `Identifier`, `Us` inside `User` — none of those are acronyms, they are prefixes of
12
+ * ordinary words. A substring match reports every one of them; a component match reports none.
13
+ *
14
+ * Deliberately not fixable: renaming a declaration without renaming its references produces code
15
+ * that does not compile, and a linter cannot see the references.
16
+ */
17
+ import type { Rule } from "./plugin-types.js";
18
+ /**
19
+ * Acronyms enforced when the caller names none. Deliberately generic — every entry is an acronym in general programming
20
+ * rather than in some particular domain, because this list ships to consumers who share none of each other's
21
+ * vocabulary. Domain acronyms belong in `extraAcronyms`.
22
+ *
23
+ * `ID` is on the list and `Id` is NOT the house form: `placeID`, `sourceID`, `nodeID`. It is the one entry short enough
24
+ * to hide inside ordinary words — `Id` leads `Identifier`, `Idle`, `Ideal` — which is what the component boundary is
25
+ * for, and it holds: none of those end a component.
26
+ *
27
+ * The other short candidates were measured against a 1,587-file corpus and turned down. Read this before adding one
28
+ * back:
29
+ *
30
+ * - `IO` — `IoT` is the settled spelling of the commonest identifier component starting with `Io`, so the rule would
31
+ * report `IoTGateway` and suggest the wrong `IOTGateway`. Zero drift in the corpus, so nothing offsets that.
32
+ * - `UI` — zero drift in the corpus, and the uppercase form is not settled the way `ID`'s is. `UiButton` is a deliberate
33
+ * choice in plenty of React codebases, and `UiPath` is a vendor that spells itself that way.
34
+ * - `DB` — a shorthand for one word rather than an initialism, so there is no English uppercase form to settle on. It is
35
+ * also the exact collision the exemptions exist for: every hit in the corpus was a Pastel option key, where the
36
+ * framework derives `adminDb` from `--admin-db` and the schema has to match its derivation.
37
+ */
38
+ export declare const DefaultAcronyms: readonly ["API", "ASCII", "CLI", "CPU", "CSS", "CSV", "DNS", "DOM", "GPU", "HTML", "HTTP", "HTTPS", "ID", "JSON", "JSONL", "JWT", "MIME", "PDF", "RGB", "RGBA", "SDK", "SQL", "SSL", "SVG", "TLS", "TSV", "TTL", "URI", "URL", "UTC", "UTF8", "UUID", "XML", "YAML"];
39
+ /**
40
+ * Which declarations the rule reads.
41
+ */
42
+ export type AcronymCaseScope = "exported" | "all";
43
+ /**
44
+ * Options accepted by {@link noTitleCaseAcronymRule}.
45
+ */
46
+ export interface AcronymCaseOptions {
47
+ /**
48
+ * Acronyms in the ALL-CAPS spelling identifiers should use; the rule derives the title-case form (`POI` → `Poi`) and
49
+ * reports that. Replaces {@link DefaultAcronyms} rather than extending it.
50
+ *
51
+ * Add an acronym once the project has settled on its capitalized form. This reports drift from an established
52
+ * convention; it does not invent one.
53
+ */
54
+ acronyms?: string[];
55
+ /**
56
+ * Acronyms added to whichever list is in effect — the usual way to layer a project's own vocabulary on the default.
57
+ */
58
+ extraAcronyms?: string[];
59
+ /**
60
+ * Identifiers exempt everywhere, for names whose casing is not ours to choose: an external library's own spelling
61
+ * (`HttpStatusCode` from axios), a wire field someone else named (`operationId` in OpenAPI), or a prop a framework
62
+ * derives from something else (Pastel turns `--run-id` into `runId`, so the schema key has to match its derivation).
63
+ *
64
+ * Prefer a scoped `// oxlint-disable-next-line sister-software/no-title-case-acronym` at the one site that needs it.
65
+ * A config entry silently covers every future declaration of the same name.
66
+ */
67
+ ignoreNames?: string[];
68
+ /**
69
+ * `"exported"` (the default) reads the names a consumer can see: exported declarations, the members of exported
70
+ * interfaces, classes and enums, and the exported half of a re-export. That is where a wrong acronym costs someone a
71
+ * breaking rename later; a local costs nothing to rename at any time.
72
+ *
73
+ * `"all"` reads every declaration in the file, exported or not. Object-literal keys are never read under either
74
+ * setting — a wire contract is a string, and its casing belongs to whoever is on the other end.
75
+ */
76
+ scope?: AcronymCaseScope;
77
+ }
78
+ export declare const noTitleCaseAcronymRule: Rule;
79
+ export default noTitleCaseAcronymRule;
80
+ //# sourceMappingURL=acronym-case-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acronym-case-plugin.d.ts","sourceRoot":"","sources":["../src/acronym-case-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,sQAqClB,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,KAAK,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACxB;AAyID,eAAO,MAAM,sBAAsB,EAAE,IAiHpC,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file A no-title-case-acronym rule, authored as an oxlint JS plugin (ESLint v9-compatible API). An
6
+ * acronym is capitalized as a whole camelCase component — `parseJSON`, `POILookup`,
7
+ * `createWOFResolver` — never title-cased. The mechanism knows nothing about any particular
8
+ * project: the acronyms are options, so adding one is a config edit rather than a code change.
9
+ *
10
+ * The subtlety the rule exists for is the COMPONENT BOUNDARY. `Poi` appears inside `Point`, `Id`
11
+ * inside `Identifier`, `Us` inside `User` — none of those are acronyms, they are prefixes of
12
+ * ordinary words. A substring match reports every one of them; a component match reports none.
13
+ *
14
+ * Deliberately not fixable: renaming a declaration without renaming its references produces code
15
+ * that does not compile, and a linter cannot see the references.
16
+ */
17
+ /**
18
+ * Acronyms enforced when the caller names none. Deliberately generic — every entry is an acronym in general programming
19
+ * rather than in some particular domain, because this list ships to consumers who share none of each other's
20
+ * vocabulary. Domain acronyms belong in `extraAcronyms`.
21
+ *
22
+ * `ID` is on the list and `Id` is NOT the house form: `placeID`, `sourceID`, `nodeID`. It is the one entry short enough
23
+ * to hide inside ordinary words — `Id` leads `Identifier`, `Idle`, `Ideal` — which is what the component boundary is
24
+ * for, and it holds: none of those end a component.
25
+ *
26
+ * The other short candidates were measured against a 1,587-file corpus and turned down. Read this before adding one
27
+ * back:
28
+ *
29
+ * - `IO` — `IoT` is the settled spelling of the commonest identifier component starting with `Io`, so the rule would
30
+ * report `IoTGateway` and suggest the wrong `IOTGateway`. Zero drift in the corpus, so nothing offsets that.
31
+ * - `UI` — zero drift in the corpus, and the uppercase form is not settled the way `ID`'s is. `UiButton` is a deliberate
32
+ * choice in plenty of React codebases, and `UiPath` is a vendor that spells itself that way.
33
+ * - `DB` — a shorthand for one word rather than an initialism, so there is no English uppercase form to settle on. It is
34
+ * also the exact collision the exemptions exist for: every hit in the corpus was a Pastel option key, where the
35
+ * framework derives `adminDb` from `--admin-db` and the schema has to match its derivation.
36
+ */
37
+ export const DefaultAcronyms = [
38
+ "API",
39
+ // oxlint-disable-next-line unicorn/text-encoding-identifier-case -- an entry in an acronym list, not an encoding label.
40
+ "ASCII",
41
+ "CLI",
42
+ "CPU",
43
+ "CSS",
44
+ "CSV",
45
+ "DNS",
46
+ "DOM",
47
+ "GPU",
48
+ "HTML",
49
+ "HTTP",
50
+ "HTTPS",
51
+ "ID",
52
+ "JSON",
53
+ "JSONL",
54
+ "JWT",
55
+ "MIME",
56
+ "PDF",
57
+ "RGB",
58
+ "RGBA",
59
+ "SDK",
60
+ "SQL",
61
+ "SSL",
62
+ "SVG",
63
+ "TLS",
64
+ "TSV",
65
+ "TTL",
66
+ "URI",
67
+ "URL",
68
+ "UTC",
69
+ // oxlint-disable-next-line unicorn/text-encoding-identifier-case -- an entry in an acronym list, not an encoding label.
70
+ "UTF8",
71
+ "UUID",
72
+ "XML",
73
+ "YAML",
74
+ ];
75
+ /**
76
+ * Characters that may follow a title-cased run for it to be a whole component: the start of the next component, a
77
+ * digit, or an underscore.
78
+ */
79
+ const COMPONENT_END = /[A-Z0-9_]/;
80
+ /**
81
+ * Characters that may precede a title-cased run for it to START a component.
82
+ */
83
+ const COMPONENT_START = /[a-z0-9_]/;
84
+ /**
85
+ * Node types opening a scope whose names are private to it. Meeting one on the walk up means the declaration is a
86
+ * local, however deep inside an exported declaration it sits — the body of an exported function is not public surface.
87
+ */
88
+ const SCOPE_BOUNDARIES = new Set([
89
+ "ArrowFunctionExpression",
90
+ "BlockStatement",
91
+ "FunctionDeclaration",
92
+ "FunctionExpression",
93
+ "Program",
94
+ "StaticBlock",
95
+ "TSModuleBlock",
96
+ ]);
97
+ /**
98
+ * Node types that make what they wrap part of the module's public surface.
99
+ */
100
+ const EXPORT_WRAPPERS = new Set(["ExportNamedDeclaration", "ExportDefaultDeclaration"]);
101
+ /**
102
+ * Title case of an acronym — the drifted spelling (`POI` → `Poi`, `NZ` → `Nz`).
103
+ */
104
+ function titleCase(acronym) {
105
+ return acronym[0] + acronym.slice(1).toLowerCase();
106
+ }
107
+ /**
108
+ * Is the run of `found` at `index` a whole camelCase component of `identifier`?
109
+ *
110
+ * This is the entire subtlety of the rule. A component ENDS where the next character starts another one — uppercase, a
111
+ * digit, `_`, or the end of the identifier — and STARTS at the identifier's start or after a lowercase letter, digit or
112
+ * underscore. `PoiBoard` qualifies (`B` follows); `Point` does not (`n` follows).
113
+ */
114
+ function isWholeComponent(identifier, index, found) {
115
+ const after = identifier[index + found.length];
116
+ if (after !== undefined && !COMPONENT_END.test(after))
117
+ return false;
118
+ const before = identifier[index - 1];
119
+ return before === undefined || COMPONENT_START.test(before);
120
+ }
121
+ /**
122
+ * Every title-cased acronym in `identifier`, plus the identifier as it should have been written.
123
+ */
124
+ function findTitleCasedAcronyms(identifier, acronyms) {
125
+ const candidates = [];
126
+ for (const acronym of acronyms) {
127
+ const found = titleCase(acronym);
128
+ // A one-letter acronym, or one whose tail is already caseless (`H3`), has no drifted spelling to
129
+ // look for: title case and house case are the same string, so every match would be a correct one.
130
+ if (found === acronym)
131
+ continue;
132
+ for (let index = identifier.indexOf(found); index !== -1; index = identifier.indexOf(found, index + 1)) {
133
+ if (isWholeComponent(identifier, index, found)) {
134
+ candidates.push({ index, acronym, found });
135
+ }
136
+ }
137
+ }
138
+ // Longest run first where two start together, so `Jsonl` wins over `Json`.
139
+ const ordered = candidates.toSorted((left, right) => left.index - right.index || right.found.length - left.found.length);
140
+ const hits = [];
141
+ let expected = "";
142
+ let cursor = 0;
143
+ for (const hit of ordered) {
144
+ if (hit.index < cursor)
145
+ continue;
146
+ hits.push(hit);
147
+ expected += identifier.slice(cursor, hit.index) + hit.acronym;
148
+ cursor = hit.index + hit.found.length;
149
+ }
150
+ return { hits, expected: expected + identifier.slice(cursor) };
151
+ }
152
+ /**
153
+ * Is `node` part of what the module exports?
154
+ *
155
+ * The walk stops at the first scope boundary rather than running to the root, which is what separates an exported
156
+ * declaration from a local one that merely lives inside an exported function.
157
+ */
158
+ function isPublicSurface(node) {
159
+ let current = node.parent;
160
+ while (current) {
161
+ if (EXPORT_WRAPPERS.has(current.type))
162
+ return true;
163
+ if (SCOPE_BOUNDARIES.has(current.type))
164
+ return false;
165
+ current = current.parent;
166
+ }
167
+ return false;
168
+ }
169
+ export const noTitleCaseAcronymRule = {
170
+ meta: {
171
+ name: "no-title-case-acronym",
172
+ type: "suggestion",
173
+ schema: [{ type: "object", additionalProperties: true }],
174
+ },
175
+ create(context) {
176
+ const options = (context.options[0] ?? {});
177
+ const configured = options.acronyms ?? DefaultAcronyms;
178
+ const acronyms = [...configured, ...(options.extraAcronyms ?? [])].map((acronym) => acronym.toUpperCase());
179
+ const ignoreNames = new Set(options.ignoreNames);
180
+ const scope = options.scope ?? "exported";
181
+ const reported = new Set();
182
+ /**
183
+ * Reports the identifier bound by `node`, if it title-cases an acronym.
184
+ */
185
+ function check(node) {
186
+ if (node?.type !== "Identifier" || !node.name)
187
+ return;
188
+ if (ignoreNames.has(node.name))
189
+ return;
190
+ // A declaration can be reached by two visitors at once (an export specifier and the binding it
191
+ // names, say); the range keys the site so it is reported once.
192
+ const site = `${node.range[0]}:${node.range[1]}`;
193
+ if (reported.has(site))
194
+ return;
195
+ const { hits, expected } = findTitleCasedAcronyms(node.name, acronyms);
196
+ if (!hits.length)
197
+ return;
198
+ reported.add(site);
199
+ const spelled = hits.map((hit) => `\`${hit.acronym}\``).join(", ");
200
+ context.report({
201
+ node,
202
+ message: `\`${node.name}\` title-cases ${hits.length > 1 ? "the acronyms" : "the acronym"} ${spelled} — an ` +
203
+ `acronym is capitalized as a whole camelCase component, so this reads \`${expected}\`.`,
204
+ });
205
+ }
206
+ function inScope(node) {
207
+ return scope === "all" || isPublicSurface(node);
208
+ }
209
+ /**
210
+ * Parameters are declarations too, but renaming one breaks nobody, so they are read only when the caller has asked
211
+ * for every declaration in the file.
212
+ */
213
+ function parameters(node) {
214
+ if (scope !== "all")
215
+ return;
216
+ for (const parameter of node.params ?? []) {
217
+ check(parameter);
218
+ }
219
+ }
220
+ /**
221
+ * A named declaration: `function`, `class`, `interface`, `type`, `enum`, `module`, and enum members.
222
+ */
223
+ function declared(node) {
224
+ parameters(node);
225
+ if (inScope(node)) {
226
+ check(node.id);
227
+ }
228
+ }
229
+ /**
230
+ * A member of an interface, type literal, or class — public surface of the type that holds it.
231
+ */
232
+ function member(node) {
233
+ if (node.computed || node.accessibility === "private")
234
+ return;
235
+ if (inScope(node)) {
236
+ check(node.key);
237
+ }
238
+ }
239
+ return {
240
+ FunctionDeclaration: declared,
241
+ ClassDeclaration: declared,
242
+ TSInterfaceDeclaration: declared,
243
+ TSTypeAliasDeclaration: declared,
244
+ TSEnumDeclaration: declared,
245
+ TSModuleDeclaration: declared,
246
+ TSEnumMember: declared,
247
+ TSPropertySignature: member,
248
+ TSMethodSignature: member,
249
+ PropertyDefinition: member,
250
+ MethodDefinition: member,
251
+ VariableDeclaration(node) {
252
+ if (!inScope(node))
253
+ return;
254
+ for (const declarator of node.declarations ?? []) {
255
+ check(declarator.id);
256
+ }
257
+ },
258
+ // The exported half of `export { poiBoard as PoiBoard }` and `export * as PoiBoard from "…"` is
259
+ // the name a consumer imports, whatever the local one is called.
260
+ ExportSpecifier(node) {
261
+ check(node.exported);
262
+ },
263
+ ExportAllDeclaration(node) {
264
+ check(node.exported);
265
+ },
266
+ FunctionExpression: parameters,
267
+ ArrowFunctionExpression: parameters,
268
+ };
269
+ },
270
+ };
271
+ export default noTitleCaseAcronymRule;
272
+ //# sourceMappingURL=acronym-case-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acronym-case-plugin.js","sourceRoot":"","sources":["../src/acronym-case-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CA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BAAE,OAAM;gBAE1B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;oBAClD,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;gBACrB,CAAC;YACF,CAAC;YACD,gGAAgG;YAChG,iEAAiE;YACjE,eAAe,CAAC,IAAI;gBACnB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACrB,CAAC;YACD,oBAAoB,CAAC,IAAI;gBACxB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACrB,CAAC;YACD,kBAAkB,EAAE,UAAU;YAC9B,uBAAuB,EAAE,UAAU;SACnC,CAAA;IACF,CAAC;CACD,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -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"}