@heyramzi/lint 2.11.7 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/data/slop/patterns/plain-structure.js +68 -0
- package/data/slop/patterns.js +2 -0
- package/data/slop/phrases-en-closers.js +12 -3
- package/data/slop/words-en.js +11 -0
- package/package.json +1 -1
- package/repo-rules/blueprints.js +75 -0
- package/repo-rules/npx.js +48 -0
- package/repo-rules.js +4 -0
- package/slop.js +29 -0
package/README.md
CHANGED
|
@@ -298,7 +298,9 @@ failure says what to do instead. It reads the staged blob, so it judges what the
|
|
|
298
298
|
- **Import maps:** a published `@heyramzi/*` package with `#src` imports maps `"#src/*.js"` to
|
|
299
299
|
`./src/*.ts` when it ships src, or `"#src/*"` to `{ types, default }` when it ships dist.
|
|
300
300
|
- **Credentials:** an `_authToken` line in a committed `.npmrc`, and the dead
|
|
301
|
-
`GITHUB_PRIVATE_PACKAGES_TOKEN` name in an install file.
|
|
301
|
+
`GITHUB_PRIVATE_PACKAGES_TOKEN` name in an install file. A Make blueprint (a JSON file with a
|
|
302
|
+
`flow`) fails on a literal in a header or field named like a secret, key, token, password or
|
|
303
|
+
client id, or inside a body or query string. A `{{mapping}}` or `<PLACEHOLDER>` passes.
|
|
302
304
|
- **Workflows:** a hosted runner, a write to `~/.npmrc`, a `pull_request` trigger, and any Node
|
|
303
305
|
that isn't 24.
|
|
304
306
|
- **Toolchain:** ESLint, knip, Prettier, Biome and Husky (dependency, script or config file),
|
|
@@ -319,8 +321,10 @@ No allowlist, no config.
|
|
|
319
321
|
`heyramzi-slop <file|dir|->` runs the exact patterns, and `--register=<name>` adds the rates of a
|
|
320
322
|
voice. By default each check reports its first hit per file, which settles pass or fail. `--all`
|
|
321
323
|
lists every hit of every check with its line (`line` in `--json`), and the exit code doesn't
|
|
322
|
-
change. A refused push prints that command with this checkout's path: inside a repo, `npx
|
|
323
|
-
heyramzi-slop` runs the repo's installed copy, which can be older than the gate's.
|
|
324
|
+
change. A refused push prints that command with this checkout's path: inside a repo, `npx -y -p
|
|
325
|
+
@heyramzi/lint heyramzi-slop` runs the repo's installed copy, which can be older than the gate's.
|
|
326
|
+
Always name the package with `-p`: the bare npm name `heyramzi-slop` belongs to nobody, and the
|
|
327
|
+
`npx-bare-bin` repo rule refuses a file that calls it.
|
|
324
328
|
|
|
325
329
|
`--jev` also asks TypeSafe Jev (`jev.js`) to score each sentence and paragraph against the
|
|
326
330
|
humanizer shapes. Those scores are a report unless `--shape-block=<0.6-1>` names a bar. Jev reads
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structure half of plain English, from Dodaios/ste80-humanizer (MIT), read 14 Nov 2026.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Its point, which the word lists can't hold: word habits change with every model release and structural ones stay. A draft
|
|
7
|
+
* scrubbed of "delve" still carries the buried verb, the stacked hedge and the semicolon. These are the parts of its Simplified
|
|
8
|
+
* Technical English pass that have a literal signature. The rest (one idea per sentence, condition before command, noun stacks)
|
|
9
|
+
* is a read, in the humanizer's `patterns.md` 73 to 77.
|
|
10
|
+
*/
|
|
11
|
+
export const patternsPlainStructure = [
|
|
12
|
+
{
|
|
13
|
+
id: "semicolon",
|
|
14
|
+
name: "Semicolon",
|
|
15
|
+
view: "prose",
|
|
16
|
+
// English sets a semicolon tight against the word before it; French sets it after a space ("mot ; mot"), so the
|
|
17
|
+
// no-space-before rule keeps French typography out. An HTML entity (` `) and a CSS or type declaration (`flex; gap:`) aren't prose.
|
|
18
|
+
test: /[^\n.!?;]{0,30}[\p{L}\p{N})"'’”](?<!&#?\w+);(?![ \t]+[\w-]+[ \t]*:)[ \t]+["'“‘(]?\p{L}[^\n.!?;]{0,30}/u,
|
|
19
|
+
rule: "A semicolon joining two clauses. Ramzi's 2026 writing has none, so one marks the piece as somebody else's (anti-voice 3), and plain English bans it outright. Write two sentences, or a list.",
|
|
20
|
+
example:
|
|
21
|
+
'"The cache is warm; the request is fast." / "We tried it twice; it broke both times."',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "split-contrast",
|
|
25
|
+
name: "This doesn't mean X. It means Y.",
|
|
26
|
+
// The negation pivot spread over two sentences, so the comma form (`comma-not-pivot`) never sees it.
|
|
27
|
+
test: /\b(?:this|that|it)\s+(?:doesn't|does\s+not|didn't|did\s+not|isn't|is\s+not|wasn't|was\s+not)\s+(?:mean|about)\b[^.!?\n]{0,140}[.!?]\s+(?:it|this|that)(?:'s|\s+is|\s+was)?\s+(?:means?|meant|about)\b/i,
|
|
28
|
+
rule: "A negation pivot split across two sentences: the first denies a reading nobody offered so the second sounds bigger. State the second sentence alone.",
|
|
29
|
+
example:
|
|
30
|
+
'"This doesn\'t mean tests are optional. It means the linter catches the easy errors first." / "It isn\'t about speed. It\'s about trust."',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "stacked-hedge",
|
|
34
|
+
name: "Stacked hedge",
|
|
35
|
+
// A modal is already a hedge, so a second one after it is padding. Replaces the 2 fixed phrases ("could potentially",
|
|
36
|
+
// "might arguably") that missed "may possibly" and "could perhaps".
|
|
37
|
+
test: /\b(?:could|may|might)\s+(?:potentially|possibly|perhaps|arguably|conceivably)\b/i,
|
|
38
|
+
rule: 'Two hedges on one verb. Keep the one the source supports, at its strength: "could potentially break" is "can break", never "breaks".',
|
|
39
|
+
example:
|
|
40
|
+
'"This change could potentially break requests." / "It may possibly help." / "That might arguably work."',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "buried-verb",
|
|
44
|
+
name: "The action in a noun",
|
|
45
|
+
// The verb that carries no meaning, then the noun that does. Bounded to nouns that have a plain verb of their own, so
|
|
46
|
+
// "make a plan" and "run an audit" pass.
|
|
47
|
+
test: /\b(?:make|makes|made|making)\s+(?:a|the)\s+(?:decision|determination|assessment|adjustment|modification|recommendation)\b|\b(?:perform|performs|performed|performing|carry\s+out|carries\s+out|carried\s+out|carrying\s+out|undertake|undertakes|undertook|conduct|conducts|conducted)\s+(?:a|an|the)\s+(?:[a-z-]+\s+)?(?:analysis|review|installation|evaluation|assessment|examination|investigation|implementation|migration|inspection|calculation|verification)\b|\bmake\s+use\s+of\b|\b(?:give|gives|gave|giving)\s+consideration\s+to\b|\btake\s+into\s+consideration\b|\b(?:reach|reached|reaches|come\s+to|came\s+to)\s+a\s+conclusion\b/i,
|
|
48
|
+
rule: 'The action buried in a noun behind an empty verb. Put it back in the verb: "make a decision" is "decide", "perform an analysis of" is "analyse", "make use of" is "use".',
|
|
49
|
+
example:
|
|
50
|
+
'"We need to make a decision by Friday." / "The team will perform an analysis of churn." / "We make use of one template." / "We carried out a review of the contracts."',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "fragment-row",
|
|
54
|
+
name: "No X. No Y. No Z.",
|
|
55
|
+
// Capital N keeps it to sentence starts. Three in a row is the shape; one "No setup." is a fragment a person writes.
|
|
56
|
+
test: /\bNo\s+[\w'-]+(?:\s+[\w'-]+)?[.!]\s+No\s+[\w'-]+(?:\s+[\w'-]+)?[.!]\s+No\s+[\w'-]+|\bPas\s+de\s+[\p{L}'-]+[.!]\s+Pas\s+de\s+[\p{L}'-]+[.!]\s+Pas\s+de\b/u,
|
|
57
|
+
rule: "A row of negated fragments standing in for a claim. Merge them into one sentence that says what the thing does instead.",
|
|
58
|
+
example: '"No setup. No config. No waiting." / "No cold starts. No regions. No excuses."',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "staged-candor",
|
|
62
|
+
name: "Honestly?",
|
|
63
|
+
// The standalone question form only. "Honestly" inside a sentence is how people talk (detection.md, "Don't flag these").
|
|
64
|
+
test: /\b(?:honestly|seriously|frankly|truthfully)\?(?=\s|$)/i,
|
|
65
|
+
rule: "Candour staged as a one-word question before a routine answer. A person being honest just says the thing.",
|
|
66
|
+
example: '"Is the paid plan worth it? Honestly? It depends on your team." / "Seriously? Yes."',
|
|
67
|
+
},
|
|
68
|
+
];
|
package/data/slop/patterns.js
CHANGED
|
@@ -12,6 +12,7 @@ import { patternsParallelShapes } from "#lint/data/slop/patterns/parallel-shapes
|
|
|
12
12
|
import { patternsDroppedElements } from "#lint/data/slop/patterns/dropped-elements.js";
|
|
13
13
|
import { patternsDurationAndOpeners } from "#lint/data/slop/patterns/duration-and-openers.js";
|
|
14
14
|
import { patternsDiagramAndScriptTells } from "#lint/data/slop/patterns/diagram-and-script-tells.js";
|
|
15
|
+
import { patternsPlainStructure } from "#lint/data/slop/patterns/plain-structure.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* The sentence shapes that CAN be matched exactly, so they are linted rather than left to a human read.
|
|
@@ -63,4 +64,5 @@ export const patterns = [
|
|
|
63
64
|
...patternsDroppedElements,
|
|
64
65
|
...patternsDurationAndOpeners,
|
|
65
66
|
...patternsDiagramAndScriptTells,
|
|
67
|
+
...patternsPlainStructure,
|
|
66
68
|
];
|
|
@@ -10,6 +10,17 @@ export const phrasesEnClosers = [
|
|
|
10
10
|
"what really matters",
|
|
11
11
|
"the deeper issue",
|
|
12
12
|
"the heart of the matter",
|
|
13
|
+
"that's the power of",
|
|
14
|
+
"that is the power of",
|
|
15
|
+
// Long phrases with a short word of their own (ste80-humanizer's plain-word swaps, 14 Nov 2026).
|
|
16
|
+
"in order to",
|
|
17
|
+
"prior to",
|
|
18
|
+
"due to the fact that",
|
|
19
|
+
"in the event that",
|
|
20
|
+
"it should be noted",
|
|
21
|
+
"at this point in time",
|
|
22
|
+
"for the purpose of",
|
|
23
|
+
"with the exception of",
|
|
13
24
|
// Staged run-ups before the point.
|
|
14
25
|
"let's explore",
|
|
15
26
|
"let's break this down",
|
|
@@ -26,9 +37,7 @@ export const phrasesEnClosers = [
|
|
|
26
37
|
"a tempting approach",
|
|
27
38
|
"one might be tempted",
|
|
28
39
|
"it would be easy to just",
|
|
29
|
-
// Stacked qualifiers.
|
|
30
|
-
"could potentially",
|
|
31
|
-
"might arguably",
|
|
40
|
+
// Stacked qualifiers. A modal plus a second hedge is the `stacked-hedge` pattern.
|
|
32
41
|
"this is an inference",
|
|
33
42
|
// Send-off inflation and sales language.
|
|
34
43
|
"the future looks bright",
|
package/data/slop/words-en.js
CHANGED
|
@@ -175,6 +175,17 @@ export const wordsEn = [
|
|
|
175
175
|
"underpins",
|
|
176
176
|
"valuable",
|
|
177
177
|
"vibrant",
|
|
178
|
+
// --- Long words doing a short word's job (ste80-humanizer, 14 Nov 2026). Not "utilise" or "commence", French verbs, or "utilization", an agency metric ---
|
|
179
|
+
"leverages",
|
|
180
|
+
"leveraged",
|
|
181
|
+
"utilised",
|
|
182
|
+
"utilising",
|
|
183
|
+
"utilized",
|
|
184
|
+
"utilizes",
|
|
185
|
+
"commenced",
|
|
186
|
+
"subsequently",
|
|
187
|
+
"world-class",
|
|
188
|
+
"stunning",
|
|
178
189
|
// --- Stock demo companies: every AI demo reaches for them (Ramzi, 12 Nov 2026) ---
|
|
179
190
|
"northwind",
|
|
180
191
|
"larkspur",
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Literal credentials in a committed Make blueprint. */
|
|
2
|
+
|
|
3
|
+
// WHY client id: a Royal Mail export held X-IBM-Client-Id beside its secret, and the pair is the login.
|
|
4
|
+
const SECRET_NAME =
|
|
5
|
+
/secret|token|passw(or)?d|api[-_]?key|apikey|authorization|client[-_]?id|private[-_]?key|access[-_]?key/i;
|
|
6
|
+
const INLINE_FIELD =
|
|
7
|
+
"(password|passwd|secret|client[_-]?secret|api[_-]?key|apikey|access[_-]?token)";
|
|
8
|
+
const INLINE = [
|
|
9
|
+
new RegExp(`<${INLINE_FIELD}>\\s*([^<\\s][^<]*)</`, "i"),
|
|
10
|
+
new RegExp(`"${INLINE_FIELD}"\\s*:\\s*"([^"]+)"`, "i"),
|
|
11
|
+
new RegExp(`[?&]${INLINE_FIELD}=([^&\\s"]+)`, "i"),
|
|
12
|
+
/\b(bearer|basic)\s+([A-Za-z0-9._~+/=-]{16,})/i,
|
|
13
|
+
];
|
|
14
|
+
const PLACEHOLDER = /^<[A-Z][A-Z0-9_]*>$/;
|
|
15
|
+
|
|
16
|
+
/** A value a person typed, as opposed to a Make mapping or a <PLACEHOLDER>. */
|
|
17
|
+
function isLiteral(value) {
|
|
18
|
+
const trimmed = value.trim();
|
|
19
|
+
return trimmed.length >= 8 && !trimmed.includes("{{") && !PLACEHOLDER.test(trimmed);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The scenario object in an export, a `blueprint` wrapper or an API response, or null. */
|
|
23
|
+
function scenarioOf(json) {
|
|
24
|
+
for (const candidate of [json, json?.blueprint, json?.response?.blueprint]) {
|
|
25
|
+
if (candidate && Array.isArray(candidate.flow)) return candidate;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Every literal credential under node, as a JSON path and the field it sits in. */
|
|
31
|
+
function literals(node, trail, found) {
|
|
32
|
+
if (Array.isArray(node)) {
|
|
33
|
+
node.forEach((child, index) => literals(child, `${trail}[${index}]`, found));
|
|
34
|
+
return found;
|
|
35
|
+
}
|
|
36
|
+
if (node === null || typeof node !== "object") return found;
|
|
37
|
+
const name = typeof node.name === "string" ? node.name : node.key;
|
|
38
|
+
const pairLeaks =
|
|
39
|
+
typeof name === "string" &&
|
|
40
|
+
typeof node.value === "string" &&
|
|
41
|
+
SECRET_NAME.test(name) &&
|
|
42
|
+
isLiteral(node.value);
|
|
43
|
+
if (pairLeaks) found.push({ trail, field: name });
|
|
44
|
+
for (const [key, child] of Object.entries(node)) {
|
|
45
|
+
// WHY: samples are a run's output (mail DKIM headers), while designer orphans are full modules.
|
|
46
|
+
if (key === "samples" || (pairLeaks && key === "value")) continue;
|
|
47
|
+
const at = `${trail}.${key}`;
|
|
48
|
+
if (typeof child === "string") {
|
|
49
|
+
if (SECRET_NAME.test(key) && isLiteral(child)) found.push({ trail: at, field: key });
|
|
50
|
+
for (const pattern of INLINE) {
|
|
51
|
+
const match = pattern.exec(child);
|
|
52
|
+
if (match && isLiteral(match[2])) found.push({ trail: at, field: match[1] });
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
literals(child, at, found);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return found;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function blueprintSecrets(tree) {
|
|
62
|
+
const found = [];
|
|
63
|
+
for (const file of tree.touchedMatching(/\.json$/)) {
|
|
64
|
+
const scenario = scenarioOf(tree.json(file));
|
|
65
|
+
if (!scenario) continue;
|
|
66
|
+
for (const { trail, field } of literals(scenario, "blueprint", [])) {
|
|
67
|
+
found.push({
|
|
68
|
+
file,
|
|
69
|
+
rule: "blueprint-secret",
|
|
70
|
+
message: `${trail} holds a literal ${field}. A committed blueprint keeps no credential: put a placeholder such as <${field.replace(/[^A-Za-z0-9]+/g, "_").toUpperCase()}> there, or map it from a Make connection or variable. The key was written down, so have its owner rotate it.`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return found;
|
|
75
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** A registry runner (npx, dlx, bunx) fetching a bare `heyramzi-*` name, which nobody owns on npm. */
|
|
2
|
+
|
|
3
|
+
const RUNNER = /(?<![\w-])(?:npx|pnpx|bunx|(?:pnpm|yarn)\s+dlx|npm\s+exec)(?![\w-])/g;
|
|
4
|
+
const BARE = /^heyramzi-[\w.-]+(@\S*)?$/;
|
|
5
|
+
const BINARY =
|
|
6
|
+
/\.(png|jpe?g|gif|webp|avif|heic|ico|icns|psd|pdf|zip|gz|tgz|mp3|mp4|m4a|mov|wav|webm|woff2?|ttf|otf|sqlite|db|wasm|bin|car)$/i;
|
|
7
|
+
const EDGE = /^[`'"([{,;]+|[`'")\]},;:.]+$/g;
|
|
8
|
+
|
|
9
|
+
/** The package a runner fetches: the `-p` value when there is one, else the command it runs. */
|
|
10
|
+
function fetched(words) {
|
|
11
|
+
const packages = [];
|
|
12
|
+
for (let index = 0; index < words.length; index += 1) {
|
|
13
|
+
const word = words[index].replace(EDGE, "");
|
|
14
|
+
if (word === "-p" || word === "--package") {
|
|
15
|
+
packages.push(words[index + 1]?.replace(EDGE, "") ?? "");
|
|
16
|
+
index += 1;
|
|
17
|
+
} else if (/^(-p|--package)=/.test(word)) {
|
|
18
|
+
packages.push(word.slice(word.indexOf("=") + 1));
|
|
19
|
+
} else if (word === "" || word === "--" || word.startsWith("-")) {
|
|
20
|
+
continue;
|
|
21
|
+
} else {
|
|
22
|
+
return packages.length ? packages : [word];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return packages;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function npxBareBins(tree) {
|
|
29
|
+
const found = [];
|
|
30
|
+
for (const file of tree.touched) {
|
|
31
|
+
if (BINARY.test(file)) continue;
|
|
32
|
+
const text = tree.text(file);
|
|
33
|
+
if (text.includes("\0")) continue;
|
|
34
|
+
for (const match of text.matchAll(RUNNER)) {
|
|
35
|
+
const after = text.slice(match.index + match[0].length, match.index + match[0].length + 240);
|
|
36
|
+
const name = fetched(after.trim().split(/\s+/).slice(0, 8)).find((word) => BARE.test(word));
|
|
37
|
+
if (!name) continue;
|
|
38
|
+
const line = text.slice(0, match.index).split("\n").length;
|
|
39
|
+
const bin = name.replace(/@.*$/, "");
|
|
40
|
+
found.push({
|
|
41
|
+
file,
|
|
42
|
+
rule: "npx-bare-bin",
|
|
43
|
+
message: `line ${line} has ${match[0]} fetch the bare npm name ${bin}. Nobody owns that name, so whoever registers it runs code on every machine that follows the line. The bin ships in @heyramzi/lint: write \`npx -y -p @heyramzi/lint ${bin}\`.`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return found;
|
|
48
|
+
}
|
package/repo-rules.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* to live in Markdown. Pure here, git and process in `bin/heyramzi-repo-rules.js`.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { blueprintSecrets } from "#lint/repo-rules/blueprints.js";
|
|
6
7
|
import { untrackedImports } from "#lint/repo-rules/imports.js";
|
|
8
|
+
import { npxBareBins } from "#lint/repo-rules/npx.js";
|
|
7
9
|
import { composeImages, fossilNames } from "#lint/repo-rules/paths.js";
|
|
8
10
|
import {
|
|
9
11
|
heyramziLinks,
|
|
@@ -38,6 +40,8 @@ export const RULES = [
|
|
|
38
40
|
composeImages,
|
|
39
41
|
fossilNames,
|
|
40
42
|
untrackedImports,
|
|
43
|
+
blueprintSecrets,
|
|
44
|
+
npxBareBins,
|
|
41
45
|
];
|
|
42
46
|
|
|
43
47
|
/** Every violation in the files the tree says were touched. */
|
package/slop.js
CHANGED
|
@@ -192,6 +192,21 @@ function auditStructure(text, language) {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
// A heading, then a short line that says it again ("## Security" then "Security is important."). Patterns.md 29.
|
|
196
|
+
for (const heading of headings) {
|
|
197
|
+
const next = body
|
|
198
|
+
.slice(heading.at)
|
|
199
|
+
.split(/\n[ \t]*\n/)
|
|
200
|
+
.slice(1)
|
|
201
|
+
.find((p) => p.trim())
|
|
202
|
+
?.trim();
|
|
203
|
+
if (!next || /\d|^#/.test(next) || next.split(/\s+/).length > 7) continue;
|
|
204
|
+
const title = escapeRe(heading.title.replace(/[.:!?]+$/, ""));
|
|
205
|
+
if (new RegExp(`^${title}\\s+(?:is|are|matters?|counts?)\\b`, "i").test(next)) {
|
|
206
|
+
hit("heading-echo", `${heading.title}: ${next}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
195
210
|
const bold = [...withoutCode(body).matchAll(/\*\*[^*\n]{2,}\*\*/g)];
|
|
196
211
|
// Japanese and Chinese put no spaces between words, so a whitespace split read a 3,500 character article as 256 words and failed all 15 Japanese pages on the site for
|
|
197
212
|
|
|
@@ -327,6 +342,20 @@ export function auditSlop(draft, { code = false, language: declared, all = false
|
|
|
327
342
|
const around = source.slice(Math.max(0, m.index - 30), m.index + 30);
|
|
328
343
|
add("dash", "em-or-en-dash", around, all && lines.lineOf(m.index), upTo(m));
|
|
329
344
|
}
|
|
345
|
+
// A spaced double hyphen is the dash typed on a keyboard without one. Letters on both sides keep `build -- --watch` out.
|
|
346
|
+
const dashProse = code ? copyStrings(text) : withoutCode(text);
|
|
347
|
+
for (const m of dashProse.matchAll(/(?<=[\p{L}\p{N},.)"'’]) -- (?=[\p{L}\p{N}("'‘])/gu)) {
|
|
348
|
+
const lineStart = dashProse.lastIndexOf("\n", m.index) + 1;
|
|
349
|
+
const around = dashProse.slice(Math.max(lineStart, m.index - 30), m.index + 30);
|
|
350
|
+
const needle = dashProse.slice(Math.max(lineStart, m.index - 20), m.index + 4);
|
|
351
|
+
add(
|
|
352
|
+
"dash",
|
|
353
|
+
"double-hyphen-dash",
|
|
354
|
+
around,
|
|
355
|
+
all && lines.find("double-hyphen-dash", needle),
|
|
356
|
+
needle,
|
|
357
|
+
);
|
|
358
|
+
}
|
|
330
359
|
for (const m of text.matchAll(EMOJI)) {
|
|
331
360
|
const around = source.slice(Math.max(0, m.index - 30), m.index + 30);
|
|
332
361
|
add("emoji", "emoji", around, all && lines.lineOf(m.index), upTo(m));
|