glosslint 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +120 -0
- package/NOTICE +31 -0
- package/README.md +98 -2
- package/dist/cli.d.mts +111 -0
- package/dist/cli.mjs +591 -0
- package/dist/eslint.d.mts +29 -0
- package/dist/eslint.mjs +39 -0
- package/dist/format-CQ9xdJYe.mjs +66 -0
- package/dist/glossary-DmTK_e1d.d.mts +32 -0
- package/dist/glossary-lk7EwGey.mjs +1872 -0
- package/dist/inclusive-CP6oU8NW.mjs +520 -0
- package/dist/index.d.mts +75 -0
- package/dist/index.mjs +3 -0
- package/dist/oxlint.d.mts +26 -0
- package/dist/oxlint.mjs +33 -0
- package/dist/presets/inclusive.d.mts +3 -0
- package/dist/presets/inclusive.mjs +1 -0
- package/dist/presets/tech.d.mts +3 -0
- package/dist/presets/tech.mjs +1 -0
- package/dist/rules-D-PrDySk.mjs +768 -0
- package/dist/tech-D0v3ss45.mjs +2401 -0
- package/dist/types-Bbp_cYfZ.d.mts +192 -0
- package/dist/x18n.d.mts +28 -0
- package/dist/x18n.mjs +164 -0
- package/package.json +134 -2
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/** A word or phrase to avoid, with the reason a finding prints. */
|
|
2
|
+
interface Avoid {
|
|
3
|
+
/** The word or phrase to avoid, matched in any case unless it has two capitals in a row. */
|
|
4
|
+
word: string;
|
|
5
|
+
/** Why to avoid it, printed as the finding's `why`. */
|
|
6
|
+
why?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A link printed as a finding's `see`. */
|
|
9
|
+
interface Link {
|
|
10
|
+
/** The link's text, such as the title of the page. */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Where the term is explained. */
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
/** How a term's capitals are checked. */
|
|
16
|
+
type CaseMode = "exact" | "spelling" | "context";
|
|
17
|
+
/**
|
|
18
|
+
* How a `context` term is written in one kind of text: `title` (Title Case), `sentence` (lowercase, with a capital at
|
|
19
|
+
* the start of a sentence), `lower`, `upper` (ALL CAPS) or `as-written` (the term exactly as the corpus writes it).
|
|
20
|
+
*/
|
|
21
|
+
type CaseStyle = "title" | "sentence" | "lower" | "upper" | "as-written";
|
|
22
|
+
/** The kinds of text whose casing a corpus or a term can set. */
|
|
23
|
+
type CasingKind = "label" | "header" | "sentence";
|
|
24
|
+
/** The case style per kind of text. A header takes the label's style unless it sets its own. */
|
|
25
|
+
type Casing = Partial<Record<CasingKind, CaseStyle>>;
|
|
26
|
+
/** One term of the corpus: the words to use, what they mean, and the words to avoid. */
|
|
27
|
+
interface Term {
|
|
28
|
+
/** The term as it should be written, such as `Dock` or `eBike`. */
|
|
29
|
+
term: string;
|
|
30
|
+
/** What the concept is, in one sentence. Printed in every finding about the term. */
|
|
31
|
+
description?: string;
|
|
32
|
+
/** How it differs from near terms and when not to use it. Printed in findings for avoid words. */
|
|
33
|
+
nuance?: string;
|
|
34
|
+
/** Why the project uses this term. Printed in findings for avoid words that give no reason of their own. */
|
|
35
|
+
why?: string;
|
|
36
|
+
/** Abbreviations of the term, always checked as `exact`, such as `DP` for `Day Pass`. */
|
|
37
|
+
abbr?: string[];
|
|
38
|
+
/** Words to avoid in favour of this term, each a word or `{ word, why }`. */
|
|
39
|
+
avoid?: (string | Avoid)[];
|
|
40
|
+
/** Strings `glosslint test` expects to pass (`good`) or to be reported (`bad`). */
|
|
41
|
+
examples?: {
|
|
42
|
+
good?: string[];
|
|
43
|
+
bad?: string[];
|
|
44
|
+
};
|
|
45
|
+
/** Pages that explain the term; the first is printed as the finding's `see`. */
|
|
46
|
+
links?: Link[];
|
|
47
|
+
/** `exact`: one form everywhere. `spelling` (default): word splits and hyphens only, in any case. `context`: Title Case in labels, lowercase in sentences. */
|
|
48
|
+
case?: CaseMode;
|
|
49
|
+
/** This term's case style per kind of text, over the corpus's `casing`. Setting it makes the term `context` unless `case` says otherwise. */
|
|
50
|
+
casing?: Casing;
|
|
51
|
+
/** Whole-word casings that always pass, as case-police skips `github` and `GITHUB`. */
|
|
52
|
+
skip?: ("lower" | "upper")[];
|
|
53
|
+
/** Other forms per locale, such as inflections, passed to x18n's glossary as they are. */
|
|
54
|
+
forms?: Record<string, string[]>;
|
|
55
|
+
/** The term's translation per locale, passed to x18n's glossary as it is. */
|
|
56
|
+
translations?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
/** What `defineCorpus` takes: presets and other corpora to extend, your own terms, and allowed phrases. */
|
|
59
|
+
interface CorpusInput {
|
|
60
|
+
/** Corpora to merge first, such as presets. Later ones win per term, and `terms` win over all of them. */
|
|
61
|
+
extends?: Corpus[];
|
|
62
|
+
/** Your own terms, which win over every term from `extends` with the same words. */
|
|
63
|
+
terms?: Term[];
|
|
64
|
+
/** Phrases that are never reported, such as `roof rack`. A finding inside one is dropped. */
|
|
65
|
+
allow?: string[];
|
|
66
|
+
/** The case style of `context` terms per kind of text. Default: `title` in labels and headers, `sentence` in sentences. */
|
|
67
|
+
casing?: Casing;
|
|
68
|
+
/**
|
|
69
|
+
* Also write a label or header that holds a `context` term wholly in its style, when that style is
|
|
70
|
+
* `title` or `upper`, so "Day pass price" becomes "Day Pass Price". Off by default: only the term is checked.
|
|
71
|
+
*/
|
|
72
|
+
wholeLabel?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** A validated, flattened corpus, as `defineCorpus` returns it. */
|
|
75
|
+
interface Corpus {
|
|
76
|
+
/** Marks the object as the output of `defineCorpus`. */
|
|
77
|
+
readonly kind: "glosslint.corpus";
|
|
78
|
+
/** Every term after merging, one per key. */
|
|
79
|
+
readonly terms: readonly Term[];
|
|
80
|
+
/** Every allowed phrase, from `extends` first. */
|
|
81
|
+
readonly allow: readonly string[];
|
|
82
|
+
/** The case style per kind of text, from `extends` first, then the corpus's own. */
|
|
83
|
+
readonly casing?: Readonly<Casing>;
|
|
84
|
+
/** Whether labels and headers holding a `context` term follow their style as a whole. */
|
|
85
|
+
readonly wholeLabel?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** What a string is, which decides how `context` terms are cased and which checks run. */
|
|
88
|
+
type TextKind = "label" | "header" | "sentence" | "comment" | "identifier" | "unknown";
|
|
89
|
+
/** A string an adapter is about to check, as the `kindOf` option sees it. */
|
|
90
|
+
interface KindSite {
|
|
91
|
+
/** The string. */
|
|
92
|
+
text: string;
|
|
93
|
+
/** The key, attribute, variable, slot or element tag the string belongs to, such as `headerName` or `h2`. */
|
|
94
|
+
name?: string;
|
|
95
|
+
/** The file the string is in, when the adapter knows it. */
|
|
96
|
+
file?: string;
|
|
97
|
+
/** Whether a person reads the string as it stands, as template text and locale messages are, so its shape may place it. */
|
|
98
|
+
shown?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/** Decides the kind of a string an adapter checks, or returns `undefined` to leave it to glosslint's `kindOf`. */
|
|
101
|
+
type KindOf = (site: KindSite) => TextKind | undefined;
|
|
102
|
+
/** What a finding may do: `autofix` applies alone, `suggestion` needs a person to pick it, `rename` touches every caller. */
|
|
103
|
+
type FixKind = "autofix" | "suggestion" | "rename";
|
|
104
|
+
/** The code of a finding: a different spelling of a term, an avoid word, or wrong capitals. */
|
|
105
|
+
type FindingCode = "GLOSSLINT_TERM" | "GLOSSLINT_AVOID" | "GLOSSLINT_CASE";
|
|
106
|
+
/** A replacement for the reported text. */
|
|
107
|
+
interface Fix {
|
|
108
|
+
/** Whether the fix applies alone, needs a person, or renames a symbol. */
|
|
109
|
+
kind: FixKind;
|
|
110
|
+
/** The text that replaces `text`, between `start` and `end`. */
|
|
111
|
+
replace: string;
|
|
112
|
+
}
|
|
113
|
+
/** One problem the matcher found in a string. */
|
|
114
|
+
interface Finding {
|
|
115
|
+
/** Which kind of problem it is. */
|
|
116
|
+
code: FindingCode;
|
|
117
|
+
/** Offset of the reported text's first character in the checked string. */
|
|
118
|
+
start: number;
|
|
119
|
+
/** Offset just past the reported text's last character. */
|
|
120
|
+
end: number;
|
|
121
|
+
/** The reported text, as written. */
|
|
122
|
+
text: string;
|
|
123
|
+
/** The one-line headline, such as `Use "dock" instead of "rack".` */
|
|
124
|
+
message: string;
|
|
125
|
+
/** Why it is reported: the avoid word's reason, else the term's `why`, else its nuance. */
|
|
126
|
+
why?: string;
|
|
127
|
+
/** The replacement, when there is one. */
|
|
128
|
+
fix?: Fix;
|
|
129
|
+
/** The corpus term the finding is about. */
|
|
130
|
+
term: Term;
|
|
131
|
+
/** The first of the term's links. */
|
|
132
|
+
see?: string;
|
|
133
|
+
}
|
|
134
|
+
/** The parts of a term that a CLI finding carries. */
|
|
135
|
+
type TermSummary = Pick<Term, "term" | "description" | "nuance">;
|
|
136
|
+
/** A finding as the CLI prints it, in a file. */
|
|
137
|
+
interface CliFinding extends Omit<Finding, "fix" | "term"> {
|
|
138
|
+
/** The file's path, relative to the current folder. */
|
|
139
|
+
file: string;
|
|
140
|
+
/** 1-based line of `start`. */
|
|
141
|
+
line: number;
|
|
142
|
+
/** 1-based column of `start`. */
|
|
143
|
+
column: number;
|
|
144
|
+
/** The replacement, with `result`, the line as it reads once fixed. */
|
|
145
|
+
fix?: Fix & {
|
|
146
|
+
result: string;
|
|
147
|
+
};
|
|
148
|
+
/** The term's name, description and nuance. */
|
|
149
|
+
term: TermSummary;
|
|
150
|
+
}
|
|
151
|
+
/** What `glosslint check --format json` prints. */
|
|
152
|
+
interface CliReport {
|
|
153
|
+
/** Every finding, in file order. */
|
|
154
|
+
findings: CliFinding[];
|
|
155
|
+
/** How many files were read and how many findings each code has. */
|
|
156
|
+
summary: {
|
|
157
|
+
files: number;
|
|
158
|
+
findings: number;
|
|
159
|
+
} & Record<FindingCode, number>;
|
|
160
|
+
}
|
|
161
|
+
/** A corpus compiled for matching, from `createMatcher`. */
|
|
162
|
+
interface Matcher {
|
|
163
|
+
/** The corpus the matcher was built from. */
|
|
164
|
+
readonly corpus: Corpus;
|
|
165
|
+
/** Finds every problem in `text`, read as `kind` (default `unknown`). */
|
|
166
|
+
check(text: string, kind?: TextKind): Finding[];
|
|
167
|
+
}
|
|
168
|
+
/** An example of a term that did not behave as `examples` says. */
|
|
169
|
+
interface CorpusTestFailure {
|
|
170
|
+
/** The term whose example failed. */
|
|
171
|
+
term: Term;
|
|
172
|
+
/** The example string. */
|
|
173
|
+
example: string;
|
|
174
|
+
/** `finding` for a `bad` example that passed, `none` for a `good` example that was reported. */
|
|
175
|
+
expected: "finding" | "none";
|
|
176
|
+
/** What the matcher reported for the example. */
|
|
177
|
+
findings: Finding[];
|
|
178
|
+
}
|
|
179
|
+
/** One entry of x18n's `glossary`, the fields x18n accepts. */
|
|
180
|
+
interface X18nGlossaryEntry {
|
|
181
|
+
/** The term in the source locale. */
|
|
182
|
+
term: string;
|
|
183
|
+
/** The translation per locale. */
|
|
184
|
+
translations?: Record<string, string>;
|
|
185
|
+
/** Other forms per locale. */
|
|
186
|
+
forms?: Record<string, string[]>;
|
|
187
|
+
/** The description and nuance, for translators. */
|
|
188
|
+
note?: string;
|
|
189
|
+
/** Whether every locale keeps the term as it is, as for brands. */
|
|
190
|
+
doNotTranslate?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export { X18nGlossaryEntry as S, Link as _, CasingKind as a, TermSummary as b, Corpus as c, Finding as d, FindingCode as f, KindSite as g, KindOf as h, Casing as i, CorpusInput as l, FixKind as m, CaseMode as n, CliFinding as o, Fix as p, CaseStyle as r, CliReport as s, Avoid as t, CorpusTestFailure as u, Matcher as v, TextKind as x, Term as y };
|
package/dist/x18n.d.mts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { c as Corpus, h as KindOf } from "./types-Bbp_cYfZ.mjs";
|
|
2
|
+
import { Plugin } from "@x18n/core";
|
|
3
|
+
/** Options of the x18n plugin. */
|
|
4
|
+
export interface GlosslintX18nOptions {
|
|
5
|
+
/** The glossary file to read instead of `.agents/glossary.md`. A string resolves from the current folder. */
|
|
6
|
+
glossary?: string | URL;
|
|
7
|
+
/** A corpus to use instead of a glossary file, such as `defineCorpus({ extends: [fromGlossary()], … })`. */
|
|
8
|
+
corpus?: Corpus;
|
|
9
|
+
/** The locale whose messages are checked. Default: the project's source locale. */
|
|
10
|
+
sourceLocale?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Decides whether a message or hard string is a label, header or sentence before glosslint's own
|
|
13
|
+
* `kindOf`. Return `undefined` to leave it to glosslint.
|
|
14
|
+
*/
|
|
15
|
+
kindOf?: KindOf;
|
|
16
|
+
}
|
|
17
|
+
declare module "@x18n/core" {
|
|
18
|
+
interface CheckIds {
|
|
19
|
+
"glosslint-term": true;
|
|
20
|
+
"glosslint-avoid": true;
|
|
21
|
+
"glosslint-case": true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An x18n plugin that checks source-locale messages and hard strings against the corpus. The corpus comes from
|
|
26
|
+
* `corpus`, else from the `glossary` file, else from `.agents/glossary.md`, read once when the plugin is built.
|
|
27
|
+
*/
|
|
28
|
+
export default function glosslint(options?: GlosslintX18nOptions): Plugin;
|
package/dist/x18n.mjs
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { d as createMatcher, f as caseModeOf, h as CONFIG_ERRORS, p as classify, r as fromGlossary, y as GlosslintConfigError } from "./glossary-lk7EwGey.mjs";
|
|
2
|
+
// src/x18n.ts
|
|
3
|
+
const CHECKS = [
|
|
4
|
+
{
|
|
5
|
+
id: "glosslint-term",
|
|
6
|
+
code: "GLOSSLINT_TERM",
|
|
7
|
+
defaultSeverity: "error",
|
|
8
|
+
description: "A corpus term written with other words, splits or hyphens."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "glosslint-avoid",
|
|
12
|
+
code: "GLOSSLINT_AVOID",
|
|
13
|
+
defaultSeverity: "warning",
|
|
14
|
+
description: "A word the corpus says to avoid, with the term to use instead."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "glosslint-case",
|
|
18
|
+
code: "GLOSSLINT_CASE",
|
|
19
|
+
defaultSeverity: "error",
|
|
20
|
+
description: "A corpus term written with the wrong capitals."
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Where `value` starts inside `range` of the file: at the range's start when the file holds it as is, one past it when
|
|
25
|
+
* the range only adds quotes. Undefined when escapes or template arguments make offsets differ.
|
|
26
|
+
*/
|
|
27
|
+
function valueStart(text, range, value) {
|
|
28
|
+
const raw = text?.slice(range.start, range.end);
|
|
29
|
+
if (raw === value) return range.start;
|
|
30
|
+
if (raw?.length === value.length + 2 && raw.slice(1, -1) === value) return range.start + 1;
|
|
31
|
+
}
|
|
32
|
+
function locate(path, range, start, finding) {
|
|
33
|
+
if (path === void 0 || range === void 0) return void 0;
|
|
34
|
+
return {
|
|
35
|
+
path,
|
|
36
|
+
range: start === void 0 ? range : {
|
|
37
|
+
start: start + finding.start,
|
|
38
|
+
end: start + finding.end
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Applies the autofixes right to left, skipping one that overlaps a fix already applied. */
|
|
43
|
+
function applyFixes(value, findings) {
|
|
44
|
+
let out = value;
|
|
45
|
+
let limit = value.length;
|
|
46
|
+
for (const finding of [...findings].sort((a, b) => b.start - a.start)) {
|
|
47
|
+
if (!finding.fix || finding.end > limit) continue;
|
|
48
|
+
out = out.slice(0, finding.start) + finding.fix.replace + out.slice(finding.end);
|
|
49
|
+
limit = finding.start;
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The fixes of a message finding. x18n's `--fix` keeps the first `set` of a key, so when a message has several
|
|
55
|
+
* autofixes, each finding's safe fix applies all of them, and a quick fix without a level applies only its own.
|
|
56
|
+
* A fix left out of `autofixes`, because only the message's shape placed it, gets only the quick fix.
|
|
57
|
+
*/
|
|
58
|
+
function messageFixes(message, value, finding, autofixes) {
|
|
59
|
+
if (finding.fix?.kind !== "autofix") return [];
|
|
60
|
+
const set = (findings) => [{
|
|
61
|
+
type: "set",
|
|
62
|
+
key: message.key,
|
|
63
|
+
locale: message.locale,
|
|
64
|
+
value: applyFixes(value, findings)
|
|
65
|
+
}];
|
|
66
|
+
const own = `Change "${finding.text}" to "${finding.fix.replace}"`;
|
|
67
|
+
if (!autofixes.includes(finding)) return [{
|
|
68
|
+
title: own,
|
|
69
|
+
ops: set([finding])
|
|
70
|
+
}];
|
|
71
|
+
if (autofixes.length === 1) return [{
|
|
72
|
+
title: own,
|
|
73
|
+
level: "safe",
|
|
74
|
+
ops: set(autofixes)
|
|
75
|
+
}];
|
|
76
|
+
return [{
|
|
77
|
+
title: `Fix ${autofixes.length} terms in "${message.key}"`,
|
|
78
|
+
level: "safe",
|
|
79
|
+
ops: set(autofixes)
|
|
80
|
+
}, {
|
|
81
|
+
title: own,
|
|
82
|
+
ops: set([finding])
|
|
83
|
+
}];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* An x18n plugin that checks source-locale messages and hard strings against the corpus. The corpus comes from
|
|
87
|
+
* `corpus`, else from the `glossary` file, else from `.agents/glossary.md`, read once when the plugin is built.
|
|
88
|
+
*/
|
|
89
|
+
function glosslint(options = {}) {
|
|
90
|
+
if (options.corpus && options.glossary !== void 0) throw new GlosslintConfigError({
|
|
91
|
+
code: CONFIG_ERRORS.glossaryAndCorpus,
|
|
92
|
+
why: "glosslint() takes `glossary` or `corpus`, not both.",
|
|
93
|
+
fix: "Pass `glossary` to read a file, or `corpus` with `extends: [fromGlossary(…)]` to add to one."
|
|
94
|
+
});
|
|
95
|
+
const matcher = createMatcher(options.corpus ?? fromGlossary(options.glossary));
|
|
96
|
+
function* collect(ctx) {
|
|
97
|
+
const locale = options.sourceLocale ?? ctx.sourceLocale;
|
|
98
|
+
const paths = new Map(ctx.resources.map((resource) => [resource.id, resource.path]));
|
|
99
|
+
for (const message of ctx.messages(locale)) {
|
|
100
|
+
const value = message.value;
|
|
101
|
+
if (typeof value !== "string") continue;
|
|
102
|
+
const path = paths.get(message.resource);
|
|
103
|
+
const { kind, guessed } = classify({
|
|
104
|
+
name: message.key,
|
|
105
|
+
text: value,
|
|
106
|
+
shown: true,
|
|
107
|
+
...path ? { file: path } : {}
|
|
108
|
+
}, options.kindOf);
|
|
109
|
+
const findings = matcher.check(value, kind);
|
|
110
|
+
if (findings.length === 0) continue;
|
|
111
|
+
const range = message.range?.value;
|
|
112
|
+
const start = path !== void 0 && range ? valueStart(ctx.text(path), range, value) : void 0;
|
|
113
|
+
const safe = (finding) => finding.fix?.kind === "autofix" && !(guessed && caseModeOf(finding.term) === "context");
|
|
114
|
+
const autofixes = findings.filter(safe);
|
|
115
|
+
for (const finding of findings) yield {
|
|
116
|
+
code: finding.code,
|
|
117
|
+
diagnostic: {
|
|
118
|
+
key: message.key,
|
|
119
|
+
locale: message.locale,
|
|
120
|
+
message: finding.message,
|
|
121
|
+
location: locate(path, range, start, finding),
|
|
122
|
+
fixes: messageFixes(message, value, finding, autofixes)
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
for (const hard of ctx.hardStrings()) {
|
|
127
|
+
const { kind } = classify({
|
|
128
|
+
text: hard.text,
|
|
129
|
+
file: hard.path,
|
|
130
|
+
shown: hard.attribute === void 0,
|
|
131
|
+
...hard.attribute !== void 0 ? { name: hard.attribute } : {}
|
|
132
|
+
}, options.kindOf);
|
|
133
|
+
const findings = matcher.check(hard.text, kind);
|
|
134
|
+
if (findings.length === 0) continue;
|
|
135
|
+
const start = valueStart(ctx.text(hard.path), hard.range, hard.text);
|
|
136
|
+
for (const finding of findings) yield {
|
|
137
|
+
code: finding.code,
|
|
138
|
+
diagnostic: {
|
|
139
|
+
message: finding.message,
|
|
140
|
+
location: locate(hard.path, hard.range, start, finding)
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
let cache;
|
|
146
|
+
const items = (ctx) => {
|
|
147
|
+
if (cache?.source !== ctx.messages) cache = {
|
|
148
|
+
source: ctx.messages,
|
|
149
|
+
items: [...collect(ctx)]
|
|
150
|
+
};
|
|
151
|
+
return cache.items;
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
name: "glosslint",
|
|
155
|
+
checks: CHECKS.map(({ code, ...check }) => ({
|
|
156
|
+
...check,
|
|
157
|
+
docs: "https://github.com/onmax/glosslint#readme",
|
|
158
|
+
*run(ctx) {
|
|
159
|
+
for (const item of items(ctx)) if (item.code === code) yield item.diagnostic;
|
|
160
|
+
}
|
|
161
|
+
}))
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export { glosslint as default };
|
package/package.json
CHANGED
|
@@ -1,10 +1,142 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glosslint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lint product terms against a corpus of words to use and avoid, with what each one means, in ESLint, x18n and a CLI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"case-police",
|
|
7
|
+
"eslint",
|
|
8
|
+
"eslint-plugin",
|
|
9
|
+
"eslintplugin",
|
|
10
|
+
"glossary",
|
|
11
|
+
"lint",
|
|
12
|
+
"oxlint",
|
|
13
|
+
"oxlint-plugin",
|
|
14
|
+
"terminology",
|
|
15
|
+
"vocabulary",
|
|
16
|
+
"writing",
|
|
17
|
+
"x18n"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://glosslint.onmax.me",
|
|
20
|
+
"bugs": "https://github.com/onmax/glosslint/issues",
|
|
5
21
|
"license": "MIT",
|
|
22
|
+
"author": "onmax",
|
|
6
23
|
"repository": {
|
|
7
24
|
"type": "git",
|
|
8
25
|
"url": "git+https://github.com/onmax/glosslint.git"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"glosslint": "./dist/cli.mjs"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"NOTICE"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"typesVersions": {
|
|
37
|
+
"*": {
|
|
38
|
+
"package.json": [
|
|
39
|
+
"./package.json"
|
|
40
|
+
],
|
|
41
|
+
"eslint": [
|
|
42
|
+
"./dist/eslint.d.mts"
|
|
43
|
+
],
|
|
44
|
+
"oxlint": [
|
|
45
|
+
"./dist/oxlint.d.mts"
|
|
46
|
+
],
|
|
47
|
+
"x18n": [
|
|
48
|
+
"./dist/x18n.d.mts"
|
|
49
|
+
],
|
|
50
|
+
"presets/tech": [
|
|
51
|
+
"./dist/presets/tech.d.mts"
|
|
52
|
+
],
|
|
53
|
+
"presets/inclusive": [
|
|
54
|
+
"./dist/presets/inclusive.d.mts"
|
|
55
|
+
],
|
|
56
|
+
"*": [
|
|
57
|
+
"./dist/index.d.mts"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"exports": {
|
|
62
|
+
".": {
|
|
63
|
+
"types": "./dist/index.d.mts",
|
|
64
|
+
"default": "./dist/index.mjs"
|
|
65
|
+
},
|
|
66
|
+
"./eslint": {
|
|
67
|
+
"types": "./dist/eslint.d.mts",
|
|
68
|
+
"default": "./dist/eslint.mjs"
|
|
69
|
+
},
|
|
70
|
+
"./oxlint": {
|
|
71
|
+
"types": "./dist/oxlint.d.mts",
|
|
72
|
+
"default": "./dist/oxlint.mjs"
|
|
73
|
+
},
|
|
74
|
+
"./x18n": {
|
|
75
|
+
"types": "./dist/x18n.d.mts",
|
|
76
|
+
"default": "./dist/x18n.mjs"
|
|
77
|
+
},
|
|
78
|
+
"./presets/tech": {
|
|
79
|
+
"types": "./dist/presets/tech.d.mts",
|
|
80
|
+
"default": "./dist/presets/tech.mjs"
|
|
81
|
+
},
|
|
82
|
+
"./presets/inclusive": {
|
|
83
|
+
"types": "./dist/presets/inclusive.d.mts",
|
|
84
|
+
"default": "./dist/presets/inclusive.mjs"
|
|
85
|
+
},
|
|
86
|
+
"./package.json": "./package.json"
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "public",
|
|
90
|
+
"provenance": true
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"cac": "^7.1.1",
|
|
94
|
+
"scule": "^1.3.0",
|
|
95
|
+
"tinyglobby": "^0.2.17"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@types/node": "^26.6.10",
|
|
99
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
100
|
+
"@x18n/core": "^0.1.14",
|
|
101
|
+
"case-police": "2.2.1",
|
|
102
|
+
"eslint": "^10.15.0",
|
|
103
|
+
"eslint-vitest-rule-tester": "^3.2.0",
|
|
104
|
+
"oxlint": "1.94.0",
|
|
105
|
+
"publint": "^0.3.25",
|
|
106
|
+
"tsrs": "7.1.0-beta.tsrs5",
|
|
107
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
108
|
+
"typescript-eslint": "^8.74.0",
|
|
109
|
+
"vite-plus": "^1.8.0",
|
|
110
|
+
"vue-eslint-parser": "^10.4.2",
|
|
111
|
+
"yaml-eslint-parser": "^2.1.0"
|
|
112
|
+
},
|
|
113
|
+
"peerDependencies": {
|
|
114
|
+
"@x18n/core": ">=0.1.14",
|
|
115
|
+
"eslint": ">=9.15.0",
|
|
116
|
+
"oxlint": ">=1.94.0"
|
|
117
|
+
},
|
|
118
|
+
"peerDependenciesMeta": {
|
|
119
|
+
"@x18n/core": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
122
|
+
"eslint": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"oxlint": {
|
|
126
|
+
"optional": true
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"engines": {
|
|
130
|
+
"node": ">=22.18.0"
|
|
131
|
+
},
|
|
132
|
+
"scripts": {
|
|
133
|
+
"build": "vp pack",
|
|
134
|
+
"lint": "vp lint",
|
|
135
|
+
"fmt": "vp fmt",
|
|
136
|
+
"typecheck": "tsrs --noEmit",
|
|
137
|
+
"test": "vp test",
|
|
138
|
+
"test:dist": "vp test run --config test/dist.config.ts",
|
|
139
|
+
"check": "vp check && pnpm typecheck",
|
|
140
|
+
"ready": "vp fmt && pnpm build && pnpm check && pnpm test"
|
|
9
141
|
}
|
|
10
142
|
}
|