@sister.software/oxlint-config 11.0.0 → 12.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/out/acronym-case-plugin.d.ts +80 -0
- package/out/acronym-case-plugin.d.ts.map +1 -0
- package/out/acronym-case-plugin.js +272 -0
- package/out/acronym-case-plugin.js.map +1 -0
- package/out/braces-plugin.d.ts.map +1 -1
- package/out/browser-globals.d.ts.map +1 -1
- package/out/constant-doc-plugin.d.ts.map +1 -1
- package/out/headers-plugin.d.ts.map +1 -1
- package/out/index.d.ts +12 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -1
- package/out/index.js.map +1 -1
- package/out/length-truthiness-plugin.d.ts.map +1 -1
- package/out/padding-plugin.d.ts.map +1 -1
- package/out/plugin-types.d.ts +20 -0
- package/out/plugin-types.d.ts.map +1 -1
- package/out/plugin.d.ts.map +1 -1
- package/out/plugin.js +2 -0
- package/out/plugin.js.map +1 -1
- package/out/process-globals-plugin.d.ts.map +1 -1
- package/out/restrictions.d.ts.map +1 -1
- package/out/threshold-plugin.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/acronym-case-plugin.ts +370 -0
- package/src/index.ts +17 -0
- package/src/plugin-types.ts +20 -0
- package/src/plugin.ts +2 -0
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ export default createOxlintConfig({
|
|
|
50
50
|
| `untypedFilePatterns` | `**/*.js`, `**/*.mjs`, … | Globs where the multi-line JSDoc requirement switches off. |
|
|
51
51
|
| `unnamedThresholds` | `false` | Flag numeric literals used as comparison thresholds. |
|
|
52
52
|
| `constantDocs` | `false` | Require JSDoc on exported / `SCREAMING_CASE` constants. |
|
|
53
|
+
| `acronymCasing` | `false` | Flag an acronym title-cased inside an identifier. |
|
|
53
54
|
| `lengthTruthiness` | `true` | Rewrite explicit length comparisons to truthiness. |
|
|
54
55
|
| `multilineJSDoc` | `true` | Require JSDoc blocks to span multiple lines. |
|
|
55
56
|
| `sectionMarkers` | `true` | Enforce the banner → MARK → region → split ladder. |
|
|
@@ -224,6 +225,78 @@ const AMBIGUITY_CEILING = 12
|
|
|
224
225
|
|
|
225
226
|
Not `/** The ambiguity ceiling. */`, which leaves the reader exactly where they started.
|
|
226
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
|
+
|
|
227
300
|
### Length checks
|
|
228
301
|
|
|
229
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,YAC3B,KAAK,EAEL,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EAEL,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,CACG,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;eAEc,sBAAsB"}
|
|
@@ -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,CAAC,MAAM,eAAe,GAAG;IAC9B,KAAK;IACL,wHAAwH;IACxH,OAAO;IACP,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,IAAI;IACJ,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,wHAAwH;IACxH,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;CACG,CAAA;AA2CV;;;GAGG;AACH,MAAM,aAAa,GAAG,WAAW,CAAA;AAEjC;;GAEG;AACH,MAAM,eAAe,GAAG,WAAW,CAAA;AAEnC;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAChC,yBAAyB;IACzB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,SAAS;IACT,aAAa;IACb,eAAe;CACf,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,wBAAwB,EAAE,0BAA0B,CAAC,CAAC,CAAA;AAoBvF;;GAEG;AACH,SAAS,SAAS,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,CAAC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E,QAAQ;YAC7B,gBAAgB,EAAE,QAAQ;YAC1B,sBAAsB,EAAE,QAAQ;YAChC,sBAAsB,EAAE,QAAQ;YAChC,iBAAiB,EAAE,QAAQ;YAC3B,mBAAmB,EAAE,QAAQ;YAC7B,YAAY,EAAE,QAAQ;YACtB,mBAAmB,EAAE,MAAM;YAC3B,iBAAiB,EAAE,MAAM;YACzB,kBAAkB,EAAE,MAAM;YAC1B,gBAAgB,EAAE,MAAM;YACxB,mBAAmB,CAAC,IAAI;gBACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"braces-plugin.d.ts","sourceRoot":"","sources":["../src/braces-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAgBtD,eAAO,MAAM,UAAU,EAAE,IA2DxB,CAAA;
|
|
1
|
+
{"version":3,"file":"braces-plugin.d.ts","sourceRoot":"","sources":["../src/braces-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAgBtD,eAAO,MAAM,UAAU,EAAE,IA2DxB,CAAA;eAEc,UAAU"}
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"file":"browser-globals.d.ts","sourceRoot":"","sources":["../src/browser-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,YAC3B,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EACT,eAAe,EACf,eAAe,EACf,OAAO,EACP,UAAU,EACV,MAAM,EACN,OAAO,EACP,cAAc,EACd,QAAQ,EACR,SAAS,EACT,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,QAAQ,EACR,OAAO,EACP,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,CACI,CAAA;AAEV,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD"}
|
|
@@ -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;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;
|
|
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;eAEc,sBAAsB"}
|
|
@@ -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;;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;
|
|
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;eAEc,YAAY"}
|
package/out/index.d.ts
CHANGED
|
@@ -145,6 +145,18 @@ export interface OxlintConfigOptions {
|
|
|
145
145
|
constantDocs?: boolean | {
|
|
146
146
|
scope?: "exported" | "screaming" | "exported-or-screaming";
|
|
147
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Flag an acronym title-cased inside an identifier — `parseJson` where the house form is `parseJSON` (off by
|
|
150
|
+
* default). `acronyms` replaces the shipped list, `extraAcronyms` layers a project's own vocabulary on top of it,
|
|
151
|
+
* `ignoreNames` exempts identifiers whose casing is not ours to choose, and `scope` widens the rule past exported
|
|
152
|
+
* declarations.
|
|
153
|
+
*/
|
|
154
|
+
acronymCasing?: boolean | {
|
|
155
|
+
acronyms?: string[];
|
|
156
|
+
extraAcronyms?: string[];
|
|
157
|
+
ignoreNames?: string[];
|
|
158
|
+
scope?: "exported" | "all";
|
|
159
|
+
};
|
|
148
160
|
/**
|
|
149
161
|
* Rewrite explicit length comparisons to truthiness in boolean positions (on by default).
|
|
150
162
|
*/
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,cAAc,mBAAmB,CAAA;AAEjC;;GAEG;AACH,MA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
@@ -90,7 +90,7 @@ export const DefaultIgnorePatterns = [
|
|
|
90
90
|
* @returns A complete oxlint config object (no `extends` required).
|
|
91
91
|
*/
|
|
92
92
|
export function createOxlintConfig(options = {}) {
|
|
93
|
-
const { packageNamespace = "@sister.software", copyrightHolder = "Sister Software", spdxLicenseIdentifier = "UNLICENSED", author = "Teffen Ellis, et al.", react = false, headers = true, padding = true, consolePadding = true, multilineStatementPadding = true, braces = true, restrictProcessGlobals = false, unnamedThresholds = false, constantDocs = false, lengthTruthiness = true, multilineJSDoc = true, sectionMarkers = true, limits: limitOverrides = {}, testFilePatterns = DefaultTestFilePatterns, generatedFilePatterns = DefaultGeneratedFilePatterns, untypedFilePatterns = DefaultUntypedFilePatterns, ignorePatterns = DefaultIgnorePatterns, overrides = {}, } = options;
|
|
93
|
+
const { packageNamespace = "@sister.software", copyrightHolder = "Sister Software", spdxLicenseIdentifier = "UNLICENSED", author = "Teffen Ellis, et al.", react = false, headers = true, padding = true, consolePadding = true, multilineStatementPadding = true, braces = true, restrictProcessGlobals = false, unnamedThresholds = false, constantDocs = false, acronymCasing = false, lengthTruthiness = true, multilineJSDoc = true, sectionMarkers = true, limits: limitOverrides = {}, testFilePatterns = DefaultTestFilePatterns, generatedFilePatterns = DefaultGeneratedFilePatterns, untypedFilePatterns = DefaultUntypedFilePatterns, ignorePatterns = DefaultIgnorePatterns, overrides = {}, } = options;
|
|
94
94
|
const limits = { ...DefaultLimits, ...limitOverrides };
|
|
95
95
|
const plugins = ["typescript", "unicorn", "oxc", "import", "promise", "vitest", ...(react ? ["react"] : [])];
|
|
96
96
|
const rules = {
|
|
@@ -330,6 +330,11 @@ export function createOxlintConfig(options = {}) {
|
|
|
330
330
|
// Error severity: an undocumented public constant or tuning knob is a legibility defect.
|
|
331
331
|
rules["sister-software/require-constant-doc"] = ["error", typeof constantDocs === "object" ? constantDocs : {}];
|
|
332
332
|
}
|
|
333
|
+
if (acronymCasing) {
|
|
334
|
+
// Error severity: on exported surface a title-cased acronym costs a consumer a breaking rename
|
|
335
|
+
// later, and the convention it drifts from is one a reviewer cannot enforce by reading.
|
|
336
|
+
rules["sister-software/no-title-case-acronym"] = ["error", typeof acronymCasing === "object" ? acronymCasing : {}];
|
|
337
|
+
}
|
|
333
338
|
if (lengthTruthiness) {
|
|
334
339
|
rules["sister-software/prefer-length-truthiness"] = "error";
|
|
335
340
|
}
|
|
@@ -401,6 +406,7 @@ export function createOxlintConfig(options = {}) {
|
|
|
401
406
|
restrictProcessGlobals ||
|
|
402
407
|
unnamedThresholds ||
|
|
403
408
|
constantDocs ||
|
|
409
|
+
acronymCasing ||
|
|
404
410
|
lengthTruthiness ||
|
|
405
411
|
multilineJSDoc ||
|
|
406
412
|
sectionMarkers
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,cAAc,mBAAmB,CAAA;AA6CjC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAuB;IAChD,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,GAAG;IAClB,mBAAmB,EAAE,GAAG;IACxB,QAAQ,EAAE,GAAG;IACb,kBAAkB,EAAE,CAAC;IACrB,cAAc,EAAE,CAAC;IACjB,UAAU,EAAE,EAAE;CACd,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,cAAc;IACd,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf,oGAAoG;IACpG,mGAAmG;IACnG,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;CAClB,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,iB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EAAE;YACjD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,kBAAkB,EAAE;YAC3D,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,EAAE,iCAAiC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChH;QACD,GAAG,SAAS;KACZ,CAAA;AACF,CAAC;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"length-truthiness-plugin.d.ts","sourceRoot":"","sources":["../src/length-truthiness-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAkB,IAAI,EAAe,MAAM,mBAAmB,CAAA;AAmD1E,eAAO,MAAM,0BAA0B,EAAE,IAyExC,CAAA;
|
|
1
|
+
{"version":3,"file":"length-truthiness-plugin.d.ts","sourceRoot":"","sources":["../src/length-truthiness-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAkB,IAAI,EAAe,MAAM,mBAAmB,CAAA;AAmD1E,eAAO,MAAM,0BAA0B,EAAE,IAyExC,CAAA;eAEc,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"padding-plugin.d.ts","sourceRoot":"","sources":["../src/padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAkCtD,eAAO,MAAM,WAAW,EAAE,IA+CzB,CAAA;
|
|
1
|
+
{"version":3,"file":"padding-plugin.d.ts","sourceRoot":"","sources":["../src/padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAkCtD,eAAO,MAAM,WAAW,EAAE,IA+CzB,CAAA;eAEc,WAAW"}
|
package/out/plugin-types.d.ts
CHANGED
|
@@ -85,6 +85,26 @@ export interface AstNode {
|
|
|
85
85
|
* A member expression's object.
|
|
86
86
|
*/
|
|
87
87
|
object?: AstNode;
|
|
88
|
+
/**
|
|
89
|
+
* The key of a class member or a type member, for the acronym-case rule. Computed keys are an expression rather than
|
|
90
|
+
* a name, which `computed` distinguishes.
|
|
91
|
+
*/
|
|
92
|
+
key?: AstNode;
|
|
93
|
+
computed?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The two halves of `export { local as exported }`. `exported` also carries the name of an `export * as name from
|
|
96
|
+
* "…"`.
|
|
97
|
+
*/
|
|
98
|
+
exported?: AstNode | null;
|
|
99
|
+
local?: AstNode;
|
|
100
|
+
/**
|
|
101
|
+
* A function's parameter list.
|
|
102
|
+
*/
|
|
103
|
+
params?: AstNode[];
|
|
104
|
+
/**
|
|
105
|
+
* A TypeScript class member's `public` / `protected` / `private` modifier.
|
|
106
|
+
*/
|
|
107
|
+
accessibility?: string;
|
|
88
108
|
}
|
|
89
109
|
export interface SourceCode {
|
|
90
110
|
getText(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../src/plugin-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO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AAA;KAAE,CAAA;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;CAC3B"}
|
package/out/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAU/C,QAAA,MAAM,oBAAoB,EAAE,MAmB3B,CAAA;eAEc,oBAAoB"}
|
package/out/plugin.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @file The bundled Sister Software oxlint JS plugin. A single plugin (oxlint requires unique plugin
|
|
6
6
|
* names) exposing all of Sister Software's custom rules under the `sister-software/` namespace.
|
|
7
7
|
*/
|
|
8
|
+
import { noTitleCaseAcronymRule } from "./acronym-case-plugin.js";
|
|
8
9
|
import { bracesRule } from "./braces-plugin.js";
|
|
9
10
|
import { consolePaddingRule } from "./console-padding-plugin.js";
|
|
10
11
|
import { requireConstantDocRule } from "./constant-doc-plugin.js";
|
|
@@ -26,6 +27,7 @@ const sisterSoftwarePlugin = {
|
|
|
26
27
|
"require-braces": bracesRule,
|
|
27
28
|
"no-process-globals": noProcessGlobalsRule,
|
|
28
29
|
"no-unnamed-threshold": noUnnamedThresholdRule,
|
|
30
|
+
"no-title-case-acronym": noTitleCaseAcronymRule,
|
|
29
31
|
"require-constant-doc": requireConstantDocRule,
|
|
30
32
|
"prefer-length-truthiness": preferLengthTruthinessRule,
|
|
31
33
|
"multiline-jsdoc": multilineJSDocRule,
|
package/out/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA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CACD,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-globals-plugin.d.ts","sourceRoot":"","sources":["../src/process-globals-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAmCtD,eAAO,MAAM,oBAAoB,EAAE,IAwBlC,CAAA;
|
|
1
|
+
{"version":3,"file":"process-globals-plugin.d.ts","sourceRoot":"","sources":["../src/process-globals-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAmCtD,eAAO,MAAM,oBAAoB,EAAE,IAwBlC,CAAA;eAEc,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restrictions.d.ts","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"restrictions.d.ts","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;aACrC,OAAO,YAAG,QAAQ,EAAE,SAAS;aAC7B,IAAI,YAAG,QAAQ,EAAE,MAAM,EAAE,KAAK;aAC9B,QAAQ,YAAG,QAAQ,EAAE,QAAQ;aAC7B,MAAM,YAAG,QAAQ;CACR,CAAA;AAEV,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,yBAAyB,CAAA;AAEzD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE;AAmBD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,cAAc,EAAE,CAK5D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAErE;AAMD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AA+BD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG,cAAc,EAAE,CAqDjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threshold-plugin.d.ts","sourceRoot":"","sources":["../src/threshold-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAiBtD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,sBAAsB,EAAE,IA4DpC,CAAA;
|
|
1
|
+
{"version":3,"file":"threshold-plugin.d.ts","sourceRoot":"","sources":["../src/threshold-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAiBtD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,sBAAsB,EAAE,IA4DpC,CAAA;eAEc,sBAAsB"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
"name": "@sister.software/oxlint-config",
|
|
3
|
+
"version": "12.1.3",
|
|
4
|
+
"description": "Sister Software's oxlint config",
|
|
5
|
+
"license": "AGPL-3.0",
|
|
6
|
+
"author": "teffen@sister.software",
|
|
7
|
+
"files": [
|
|
8
|
+
"out/**/*.js",
|
|
9
|
+
"out/**/*.d.ts",
|
|
10
|
+
"out/**/*.map",
|
|
11
|
+
"src"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"types": "./out/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./out/index.js",
|
|
19
|
+
"types": "./out/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./headers-plugin": {
|
|
22
|
+
"import": "./out/headers-plugin.js",
|
|
23
|
+
"types": "./out/headers-plugin.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./plugin": {
|
|
26
|
+
"import": "./out/plugin.js",
|
|
27
|
+
"types": "./out/plugin.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p .",
|
|
35
|
+
"verify": "node scripts/verify-fixtures.mjs"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@sister.software/tsconfig": "workspace:*",
|
|
39
|
+
"@types/node": "^26.1.2",
|
|
40
|
+
"typescript": "^7.0.2"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"oxlint": ">=1.75.0 <2"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=24.0"
|
|
47
|
+
}
|
|
48
48
|
}
|
|
@@ -0,0 +1,370 @@
|
|
|
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
|
+
import type { AstNode, Rule } from "./plugin-types.js"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Acronyms enforced when the caller names none. Deliberately generic — every entry is an acronym in general programming
|
|
22
|
+
* rather than in some particular domain, because this list ships to consumers who share none of each other's
|
|
23
|
+
* vocabulary. Domain acronyms belong in `extraAcronyms`.
|
|
24
|
+
*
|
|
25
|
+
* `ID` is on the list and `Id` is NOT the house form: `placeID`, `sourceID`, `nodeID`. It is the one entry short enough
|
|
26
|
+
* to hide inside ordinary words — `Id` leads `Identifier`, `Idle`, `Ideal` — which is what the component boundary is
|
|
27
|
+
* for, and it holds: none of those end a component.
|
|
28
|
+
*
|
|
29
|
+
* The other short candidates were measured against a 1,587-file corpus and turned down. Read this before adding one
|
|
30
|
+
* back:
|
|
31
|
+
*
|
|
32
|
+
* - `IO` — `IoT` is the settled spelling of the commonest identifier component starting with `Io`, so the rule would
|
|
33
|
+
* report `IoTGateway` and suggest the wrong `IOTGateway`. Zero drift in the corpus, so nothing offsets that.
|
|
34
|
+
* - `UI` — zero drift in the corpus, and the uppercase form is not settled the way `ID`'s is. `UiButton` is a deliberate
|
|
35
|
+
* choice in plenty of React codebases, and `UiPath` is a vendor that spells itself that way.
|
|
36
|
+
* - `DB` — a shorthand for one word rather than an initialism, so there is no English uppercase form to settle on. It is
|
|
37
|
+
* also the exact collision the exemptions exist for: every hit in the corpus was a Pastel option key, where the
|
|
38
|
+
* framework derives `adminDb` from `--admin-db` and the schema has to match its derivation.
|
|
39
|
+
*/
|
|
40
|
+
export const DefaultAcronyms = [
|
|
41
|
+
"API",
|
|
42
|
+
// oxlint-disable-next-line unicorn/text-encoding-identifier-case -- an entry in an acronym list, not an encoding label.
|
|
43
|
+
"ASCII",
|
|
44
|
+
"CLI",
|
|
45
|
+
"CPU",
|
|
46
|
+
"CSS",
|
|
47
|
+
"CSV",
|
|
48
|
+
"DNS",
|
|
49
|
+
"DOM",
|
|
50
|
+
"GPU",
|
|
51
|
+
"HTML",
|
|
52
|
+
"HTTP",
|
|
53
|
+
"HTTPS",
|
|
54
|
+
"ID",
|
|
55
|
+
"JSON",
|
|
56
|
+
"JSONL",
|
|
57
|
+
"JWT",
|
|
58
|
+
"MIME",
|
|
59
|
+
"PDF",
|
|
60
|
+
"RGB",
|
|
61
|
+
"RGBA",
|
|
62
|
+
"SDK",
|
|
63
|
+
"SQL",
|
|
64
|
+
"SSL",
|
|
65
|
+
"SVG",
|
|
66
|
+
"TLS",
|
|
67
|
+
"TSV",
|
|
68
|
+
"TTL",
|
|
69
|
+
"URI",
|
|
70
|
+
"URL",
|
|
71
|
+
"UTC",
|
|
72
|
+
// oxlint-disable-next-line unicorn/text-encoding-identifier-case -- an entry in an acronym list, not an encoding label.
|
|
73
|
+
"UTF8",
|
|
74
|
+
"UUID",
|
|
75
|
+
"XML",
|
|
76
|
+
"YAML",
|
|
77
|
+
] as const
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Which declarations the rule reads.
|
|
81
|
+
*/
|
|
82
|
+
export type AcronymCaseScope = "exported" | "all"
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Options accepted by {@link noTitleCaseAcronymRule}.
|
|
86
|
+
*/
|
|
87
|
+
export interface AcronymCaseOptions {
|
|
88
|
+
/**
|
|
89
|
+
* Acronyms in the ALL-CAPS spelling identifiers should use; the rule derives the title-case form (`POI` → `Poi`) and
|
|
90
|
+
* reports that. Replaces {@link DefaultAcronyms} rather than extending it.
|
|
91
|
+
*
|
|
92
|
+
* Add an acronym once the project has settled on its capitalized form. This reports drift from an established
|
|
93
|
+
* convention; it does not invent one.
|
|
94
|
+
*/
|
|
95
|
+
acronyms?: string[]
|
|
96
|
+
/**
|
|
97
|
+
* Acronyms added to whichever list is in effect — the usual way to layer a project's own vocabulary on the default.
|
|
98
|
+
*/
|
|
99
|
+
extraAcronyms?: string[]
|
|
100
|
+
/**
|
|
101
|
+
* Identifiers exempt everywhere, for names whose casing is not ours to choose: an external library's own spelling
|
|
102
|
+
* (`HttpStatusCode` from axios), a wire field someone else named (`operationId` in OpenAPI), or a prop a framework
|
|
103
|
+
* derives from something else (Pastel turns `--run-id` into `runId`, so the schema key has to match its derivation).
|
|
104
|
+
*
|
|
105
|
+
* Prefer a scoped `// oxlint-disable-next-line sister-software/no-title-case-acronym` at the one site that needs it.
|
|
106
|
+
* A config entry silently covers every future declaration of the same name.
|
|
107
|
+
*/
|
|
108
|
+
ignoreNames?: string[]
|
|
109
|
+
/**
|
|
110
|
+
* `"exported"` (the default) reads the names a consumer can see: exported declarations, the members of exported
|
|
111
|
+
* interfaces, classes and enums, and the exported half of a re-export. That is where a wrong acronym costs someone a
|
|
112
|
+
* breaking rename later; a local costs nothing to rename at any time.
|
|
113
|
+
*
|
|
114
|
+
* `"all"` reads every declaration in the file, exported or not. Object-literal keys are never read under either
|
|
115
|
+
* setting — a wire contract is a string, and its casing belongs to whoever is on the other end.
|
|
116
|
+
*/
|
|
117
|
+
scope?: AcronymCaseScope
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Characters that may follow a title-cased run for it to be a whole component: the start of the next component, a
|
|
122
|
+
* digit, or an underscore.
|
|
123
|
+
*/
|
|
124
|
+
const COMPONENT_END = /[A-Z0-9_]/
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Characters that may precede a title-cased run for it to START a component.
|
|
128
|
+
*/
|
|
129
|
+
const COMPONENT_START = /[a-z0-9_]/
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Node types opening a scope whose names are private to it. Meeting one on the walk up means the declaration is a
|
|
133
|
+
* local, however deep inside an exported declaration it sits — the body of an exported function is not public surface.
|
|
134
|
+
*/
|
|
135
|
+
const SCOPE_BOUNDARIES = new Set([
|
|
136
|
+
"ArrowFunctionExpression",
|
|
137
|
+
"BlockStatement",
|
|
138
|
+
"FunctionDeclaration",
|
|
139
|
+
"FunctionExpression",
|
|
140
|
+
"Program",
|
|
141
|
+
"StaticBlock",
|
|
142
|
+
"TSModuleBlock",
|
|
143
|
+
])
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Node types that make what they wrap part of the module's public surface.
|
|
147
|
+
*/
|
|
148
|
+
const EXPORT_WRAPPERS = new Set(["ExportNamedDeclaration", "ExportDefaultDeclaration"])
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* One title-cased run found inside an identifier.
|
|
152
|
+
*/
|
|
153
|
+
interface AcronymHit {
|
|
154
|
+
/**
|
|
155
|
+
* Where the run starts in the identifier.
|
|
156
|
+
*/
|
|
157
|
+
index: number
|
|
158
|
+
/**
|
|
159
|
+
* The house spelling, e.g. `POI`.
|
|
160
|
+
*/
|
|
161
|
+
acronym: string
|
|
162
|
+
/**
|
|
163
|
+
* The drifted spelling actually written, e.g. `Poi`.
|
|
164
|
+
*/
|
|
165
|
+
found: string
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Title case of an acronym — the drifted spelling (`POI` → `Poi`, `NZ` → `Nz`).
|
|
170
|
+
*/
|
|
171
|
+
function titleCase(acronym: string): string {
|
|
172
|
+
return acronym[0]! + acronym.slice(1).toLowerCase()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Is the run of `found` at `index` a whole camelCase component of `identifier`?
|
|
177
|
+
*
|
|
178
|
+
* This is the entire subtlety of the rule. A component ENDS where the next character starts another one — uppercase, a
|
|
179
|
+
* digit, `_`, or the end of the identifier — and STARTS at the identifier's start or after a lowercase letter, digit or
|
|
180
|
+
* underscore. `PoiBoard` qualifies (`B` follows); `Point` does not (`n` follows).
|
|
181
|
+
*/
|
|
182
|
+
function isWholeComponent(identifier: string, index: number, found: string): boolean {
|
|
183
|
+
const after = identifier[index + found.length]
|
|
184
|
+
|
|
185
|
+
if (after !== undefined && !COMPONENT_END.test(after)) return false
|
|
186
|
+
|
|
187
|
+
const before = identifier[index - 1]
|
|
188
|
+
|
|
189
|
+
return before === undefined || COMPONENT_START.test(before)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Every title-cased acronym in `identifier`, plus the identifier as it should have been written.
|
|
194
|
+
*/
|
|
195
|
+
function findTitleCasedAcronyms(
|
|
196
|
+
identifier: string,
|
|
197
|
+
acronyms: readonly string[]
|
|
198
|
+
): { hits: AcronymHit[]; expected: string } {
|
|
199
|
+
const candidates: AcronymHit[] = []
|
|
200
|
+
|
|
201
|
+
for (const acronym of acronyms) {
|
|
202
|
+
const found = titleCase(acronym)
|
|
203
|
+
|
|
204
|
+
// A one-letter acronym, or one whose tail is already caseless (`H3`), has no drifted spelling to
|
|
205
|
+
// look for: title case and house case are the same string, so every match would be a correct one.
|
|
206
|
+
if (found === acronym) continue
|
|
207
|
+
|
|
208
|
+
for (let index = identifier.indexOf(found); index !== -1; index = identifier.indexOf(found, index + 1)) {
|
|
209
|
+
if (isWholeComponent(identifier, index, found)) {
|
|
210
|
+
candidates.push({ index, acronym, found })
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Longest run first where two start together, so `Jsonl` wins over `Json`.
|
|
216
|
+
const ordered = candidates.toSorted(
|
|
217
|
+
(left, right) => left.index - right.index || right.found.length - left.found.length
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
const hits: AcronymHit[] = []
|
|
221
|
+
let expected = ""
|
|
222
|
+
let cursor = 0
|
|
223
|
+
|
|
224
|
+
for (const hit of ordered) {
|
|
225
|
+
if (hit.index < cursor) continue
|
|
226
|
+
|
|
227
|
+
hits.push(hit)
|
|
228
|
+
expected += identifier.slice(cursor, hit.index) + hit.acronym
|
|
229
|
+
cursor = hit.index + hit.found.length
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return { hits, expected: expected + identifier.slice(cursor) }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Is `node` part of what the module exports?
|
|
237
|
+
*
|
|
238
|
+
* The walk stops at the first scope boundary rather than running to the root, which is what separates an exported
|
|
239
|
+
* declaration from a local one that merely lives inside an exported function.
|
|
240
|
+
*/
|
|
241
|
+
function isPublicSurface(node: AstNode): boolean {
|
|
242
|
+
let current = node.parent
|
|
243
|
+
|
|
244
|
+
while (current) {
|
|
245
|
+
if (EXPORT_WRAPPERS.has(current.type)) return true
|
|
246
|
+
|
|
247
|
+
if (SCOPE_BOUNDARIES.has(current.type)) return false
|
|
248
|
+
|
|
249
|
+
current = current.parent
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return false
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export const noTitleCaseAcronymRule: Rule = {
|
|
256
|
+
meta: {
|
|
257
|
+
name: "no-title-case-acronym",
|
|
258
|
+
type: "suggestion",
|
|
259
|
+
schema: [{ type: "object", additionalProperties: true }],
|
|
260
|
+
},
|
|
261
|
+
create(context) {
|
|
262
|
+
const options = (context.options[0] ?? {}) as AcronymCaseOptions
|
|
263
|
+
const configured = options.acronyms ?? DefaultAcronyms
|
|
264
|
+
const acronyms = [...configured, ...(options.extraAcronyms ?? [])].map((acronym) => acronym.toUpperCase())
|
|
265
|
+
const ignoreNames = new Set(options.ignoreNames)
|
|
266
|
+
const scope = options.scope ?? "exported"
|
|
267
|
+
const reported = new Set<string>()
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Reports the identifier bound by `node`, if it title-cases an acronym.
|
|
271
|
+
*/
|
|
272
|
+
function check(node: AstNode | undefined | null): void {
|
|
273
|
+
if (node?.type !== "Identifier" || !node.name) return
|
|
274
|
+
|
|
275
|
+
if (ignoreNames.has(node.name)) return
|
|
276
|
+
|
|
277
|
+
// A declaration can be reached by two visitors at once (an export specifier and the binding it
|
|
278
|
+
// names, say); the range keys the site so it is reported once.
|
|
279
|
+
const site = `${node.range[0]}:${node.range[1]}`
|
|
280
|
+
|
|
281
|
+
if (reported.has(site)) return
|
|
282
|
+
|
|
283
|
+
const { hits, expected } = findTitleCasedAcronyms(node.name, acronyms)
|
|
284
|
+
|
|
285
|
+
if (!hits.length) return
|
|
286
|
+
|
|
287
|
+
reported.add(site)
|
|
288
|
+
|
|
289
|
+
const spelled = hits.map((hit) => `\`${hit.acronym}\``).join(", ")
|
|
290
|
+
|
|
291
|
+
context.report({
|
|
292
|
+
node,
|
|
293
|
+
message:
|
|
294
|
+
`\`${node.name}\` title-cases ${hits.length > 1 ? "the acronyms" : "the acronym"} ${spelled} — an ` +
|
|
295
|
+
`acronym is capitalized as a whole camelCase component, so this reads \`${expected}\`.`,
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function inScope(node: AstNode): boolean {
|
|
300
|
+
return scope === "all" || isPublicSurface(node)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Parameters are declarations too, but renaming one breaks nobody, so they are read only when the caller has asked
|
|
305
|
+
* for every declaration in the file.
|
|
306
|
+
*/
|
|
307
|
+
function parameters(node: AstNode): void {
|
|
308
|
+
if (scope !== "all") return
|
|
309
|
+
|
|
310
|
+
for (const parameter of node.params ?? []) {
|
|
311
|
+
check(parameter)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* A named declaration: `function`, `class`, `interface`, `type`, `enum`, `module`, and enum members.
|
|
317
|
+
*/
|
|
318
|
+
function declared(node: AstNode): void {
|
|
319
|
+
parameters(node)
|
|
320
|
+
|
|
321
|
+
if (inScope(node)) {
|
|
322
|
+
check(node.id)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* A member of an interface, type literal, or class — public surface of the type that holds it.
|
|
328
|
+
*/
|
|
329
|
+
function member(node: AstNode): void {
|
|
330
|
+
if (node.computed || node.accessibility === "private") return
|
|
331
|
+
|
|
332
|
+
if (inScope(node)) {
|
|
333
|
+
check(node.key)
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
FunctionDeclaration: declared,
|
|
339
|
+
ClassDeclaration: declared,
|
|
340
|
+
TSInterfaceDeclaration: declared,
|
|
341
|
+
TSTypeAliasDeclaration: declared,
|
|
342
|
+
TSEnumDeclaration: declared,
|
|
343
|
+
TSModuleDeclaration: declared,
|
|
344
|
+
TSEnumMember: declared,
|
|
345
|
+
TSPropertySignature: member,
|
|
346
|
+
TSMethodSignature: member,
|
|
347
|
+
PropertyDefinition: member,
|
|
348
|
+
MethodDefinition: member,
|
|
349
|
+
VariableDeclaration(node) {
|
|
350
|
+
if (!inScope(node)) return
|
|
351
|
+
|
|
352
|
+
for (const declarator of node.declarations ?? []) {
|
|
353
|
+
check(declarator.id)
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
// The exported half of `export { poiBoard as PoiBoard }` and `export * as PoiBoard from "…"` is
|
|
357
|
+
// the name a consumer imports, whatever the local one is called.
|
|
358
|
+
ExportSpecifier(node) {
|
|
359
|
+
check(node.exported)
|
|
360
|
+
},
|
|
361
|
+
ExportAllDeclaration(node) {
|
|
362
|
+
check(node.exported)
|
|
363
|
+
},
|
|
364
|
+
FunctionExpression: parameters,
|
|
365
|
+
ArrowFunctionExpression: parameters,
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export default noTitleCaseAcronymRule
|
package/src/index.ts
CHANGED
|
@@ -170,6 +170,15 @@ export interface OxlintConfigOptions {
|
|
|
170
170
|
* `"screaming"`, or the default `"exported-or-screaming"`.
|
|
171
171
|
*/
|
|
172
172
|
constantDocs?: boolean | { scope?: "exported" | "screaming" | "exported-or-screaming" }
|
|
173
|
+
/**
|
|
174
|
+
* Flag an acronym title-cased inside an identifier — `parseJson` where the house form is `parseJSON` (off by
|
|
175
|
+
* default). `acronyms` replaces the shipped list, `extraAcronyms` layers a project's own vocabulary on top of it,
|
|
176
|
+
* `ignoreNames` exempts identifiers whose casing is not ours to choose, and `scope` widens the rule past exported
|
|
177
|
+
* declarations.
|
|
178
|
+
*/
|
|
179
|
+
acronymCasing?:
|
|
180
|
+
| boolean
|
|
181
|
+
| { acronyms?: string[]; extraAcronyms?: string[]; ignoreNames?: string[]; scope?: "exported" | "all" }
|
|
173
182
|
/**
|
|
174
183
|
* Rewrite explicit length comparisons to truthiness in boolean positions (on by default).
|
|
175
184
|
*/
|
|
@@ -253,6 +262,7 @@ export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintCon
|
|
|
253
262
|
restrictProcessGlobals = false,
|
|
254
263
|
unnamedThresholds = false,
|
|
255
264
|
constantDocs = false,
|
|
265
|
+
acronymCasing = false,
|
|
256
266
|
lengthTruthiness = true,
|
|
257
267
|
multilineJSDoc = true,
|
|
258
268
|
sectionMarkers = true,
|
|
@@ -519,6 +529,12 @@ export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintCon
|
|
|
519
529
|
rules["sister-software/require-constant-doc"] = ["error", typeof constantDocs === "object" ? constantDocs : {}]
|
|
520
530
|
}
|
|
521
531
|
|
|
532
|
+
if (acronymCasing) {
|
|
533
|
+
// Error severity: on exported surface a title-cased acronym costs a consumer a breaking rename
|
|
534
|
+
// later, and the convention it drifts from is one a reviewer cannot enforce by reading.
|
|
535
|
+
rules["sister-software/no-title-case-acronym"] = ["error", typeof acronymCasing === "object" ? acronymCasing : {}]
|
|
536
|
+
}
|
|
537
|
+
|
|
522
538
|
if (lengthTruthiness) {
|
|
523
539
|
rules["sister-software/prefer-length-truthiness"] = "error"
|
|
524
540
|
}
|
|
@@ -604,6 +620,7 @@ export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintCon
|
|
|
604
620
|
restrictProcessGlobals ||
|
|
605
621
|
unnamedThresholds ||
|
|
606
622
|
constantDocs ||
|
|
623
|
+
acronymCasing ||
|
|
607
624
|
lengthTruthiness ||
|
|
608
625
|
multilineJSDoc ||
|
|
609
626
|
sectionMarkers
|
package/src/plugin-types.ts
CHANGED
|
@@ -87,6 +87,26 @@ export interface AstNode {
|
|
|
87
87
|
* A member expression's object.
|
|
88
88
|
*/
|
|
89
89
|
object?: AstNode
|
|
90
|
+
/**
|
|
91
|
+
* The key of a class member or a type member, for the acronym-case rule. Computed keys are an expression rather than
|
|
92
|
+
* a name, which `computed` distinguishes.
|
|
93
|
+
*/
|
|
94
|
+
key?: AstNode
|
|
95
|
+
computed?: boolean
|
|
96
|
+
/**
|
|
97
|
+
* The two halves of `export { local as exported }`. `exported` also carries the name of an `export * as name from
|
|
98
|
+
* "…"`.
|
|
99
|
+
*/
|
|
100
|
+
exported?: AstNode | null
|
|
101
|
+
local?: AstNode
|
|
102
|
+
/**
|
|
103
|
+
* A function's parameter list.
|
|
104
|
+
*/
|
|
105
|
+
params?: AstNode[]
|
|
106
|
+
/**
|
|
107
|
+
* A TypeScript class member's `public` / `protected` / `private` modifier.
|
|
108
|
+
*/
|
|
109
|
+
accessibility?: string
|
|
90
110
|
}
|
|
91
111
|
|
|
92
112
|
export interface SourceCode {
|
package/src/plugin.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* names) exposing all of Sister Software's custom rules under the `sister-software/` namespace.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { noTitleCaseAcronymRule } from "./acronym-case-plugin.js"
|
|
9
10
|
import { bracesRule } from "./braces-plugin.js"
|
|
10
11
|
import { consolePaddingRule } from "./console-padding-plugin.js"
|
|
11
12
|
import { requireConstantDocRule } from "./constant-doc-plugin.js"
|
|
@@ -34,6 +35,7 @@ const sisterSoftwarePlugin: Plugin = {
|
|
|
34
35
|
"require-braces": bracesRule,
|
|
35
36
|
"no-process-globals": noProcessGlobalsRule,
|
|
36
37
|
"no-unnamed-threshold": noUnnamedThresholdRule,
|
|
38
|
+
"no-title-case-acronym": noTitleCaseAcronymRule,
|
|
37
39
|
"require-constant-doc": requireConstantDocRule,
|
|
38
40
|
"prefer-length-truthiness": preferLengthTruthinessRule,
|
|
39
41
|
"multiline-jsdoc": multilineJSDocRule,
|