@kongyo2/ts-comment-scanner 1.2.1 → 1.4.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.en.md +31 -10
- package/README.md +29 -8
- package/dist/directives.d.ts +24 -3
- package/dist/directives.d.ts.map +1 -1
- package/dist/directives.js +313 -29
- package/dist/directives.js.map +1 -1
- package/dist/files.d.ts +34 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +148 -20
- package/dist/files.js.map +1 -1
- package/dist/git.js +6 -6
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/remove.js +154 -29
- package/dist/remove.js.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +24 -2
- package/dist/report.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +47 -13
- package/dist/run.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +43 -25
- package/dist/scanner.js.map +1 -1
- package/package.json +11 -5
- package/src/args.ts +198 -0
- package/src/cli.ts +12 -0
- package/src/directives.ts +492 -0
- package/src/files.ts +304 -0
- package/src/git.ts +72 -0
- package/src/index.ts +19 -0
- package/src/remove.ts +410 -0
- package/src/report.ts +106 -0
- package/src/run.ts +283 -0
- package/src/scanner.ts +104 -0
- package/src/types.ts +19 -0
- package/src/version.ts +7 -0
package/dist/directives.js
CHANGED
|
@@ -5,7 +5,7 @@ const RULES = [
|
|
|
5
5
|
{ pattern: /^eslint\s+\S/, name: "eslint", blockOnly: true, joinLines: true },
|
|
6
6
|
{
|
|
7
7
|
pattern: /^(globals?|exported)\s+\S/,
|
|
8
|
-
name: (match) => match[1]
|
|
8
|
+
name: (match) => match[1],
|
|
9
9
|
blockOnly: true,
|
|
10
10
|
joinLines: true,
|
|
11
11
|
},
|
|
@@ -18,18 +18,68 @@ const RULES = [
|
|
|
18
18
|
// JSCS (legacy). Spacing after the colon is lenient (`jscs: enable` works),
|
|
19
19
|
// so the name is normalised to the compact form.
|
|
20
20
|
{ pattern: /^jscs:\s*(disable|enable|ignore)\b/, name: (match) => `jscs:${match[1]}`, joinLines: true },
|
|
21
|
+
// JSLint (legacy): the directive word must sit immediately after the
|
|
22
|
+
// comment marker with no space (`/*jslint devel*/` works, `/* jslint */`
|
|
23
|
+
// does not) and needs a body, so these match the raw text. The whole-line
|
|
24
|
+
// pragmas (`/*jslint-disable*/`, `//jslint-ignore-line`) are exact strings.
|
|
25
|
+
{ pattern: /^\/[/*](jslint|property)\s+\S/, rawText: true, name: (match) => match[1] },
|
|
26
|
+
{ pattern: /^\/\*jslint-(disable|enable)\*\/$/, rawText: true, name: (match) => `jslint-${match[1]}` },
|
|
27
|
+
{ pattern: /^\/\/jslint-(ignore-line|quiet)$/, rawText: true, name: (match) => `jslint-${match[1]}` },
|
|
21
28
|
// oxlint
|
|
22
29
|
{ pattern: /^oxlint-(?:disable|enable)(?:-next-line|-line)?\b/ },
|
|
23
30
|
// Biome
|
|
24
31
|
{ pattern: /^biome-ignore(?:-all|-start|-end)?\b/ },
|
|
32
|
+
// Rome (Biome's predecessor). Case-insensitive keyword with `-` or `_`,
|
|
33
|
+
// then known categories and a mandatory colon — without the colon Rome
|
|
34
|
+
// reported a parse diagnostic and the suppression stayed inert.
|
|
35
|
+
{
|
|
36
|
+
pattern: /^rome[-_]ignore\s*(?:(?:parse|format|lint)(?:\([^)]*\))?\s*)+:/i,
|
|
37
|
+
name: "rome-ignore",
|
|
38
|
+
anyLine: true,
|
|
39
|
+
},
|
|
25
40
|
// Deno
|
|
26
41
|
{ pattern: /^deno-(?:lint-ignore(?:-file)?|fmt-ignore(?:-file)?|coverage-ignore(?:-file|-start|-stop)?)\b/ },
|
|
42
|
+
// Deno type directives. deno_graph matches them case-insensitively at the
|
|
43
|
+
// comment start; `@deno-types` accepts a bare specifier, the newer names
|
|
44
|
+
// require quotes.
|
|
45
|
+
{ pattern: /^@deno-types\s*=\s*(?:"[^"\n]+"|'[^'\n]+'|\S+)/i, name: "@deno-types" },
|
|
46
|
+
{ pattern: /^@ts-types\s*=\s*(?:"[^"\n]+"|'[^'\n]+')/i, name: "@ts-types" },
|
|
47
|
+
{ pattern: /^@ts-self-types\s*=\s*(?:"[^"\n]+"|'[^'\n]+')/i, name: "@ts-self-types" },
|
|
27
48
|
// Formatter suppressions (prettier, and oxfmt which mirrors it). Both
|
|
28
49
|
// parsers compare the exact trimmed comment body, so the marker must be the
|
|
29
50
|
// whole comment (joinLines makes `$` span every line): hyphenated
|
|
30
|
-
// lookalikes (`oxfmt-ignore-more`) and prose stay ordinary.
|
|
31
|
-
|
|
32
|
-
|
|
51
|
+
// lookalikes (`oxfmt-ignore-more`) and prose stay ordinary. keepStars,
|
|
52
|
+
// because the literal comparison also means a JSDoc `*` before the marker
|
|
53
|
+
// (`/** prettier-ignore */`) leaves the comment ordinary — verified against
|
|
54
|
+
// prettier 3.8.
|
|
55
|
+
{ pattern: /^prettier-ignore(?:-start|-end)?$/, joinLines: true, keepStars: true },
|
|
56
|
+
{ pattern: /^oxfmt-ignore$/, joinLines: true, keepStars: true },
|
|
57
|
+
// dprint. The file pragma is a starts-with check (trailing text allowed) on
|
|
58
|
+
// the file's leading comments, skipping only whitespace — a `/**` docblock
|
|
59
|
+
// star defeats it. The node pragma is a substring bounded by
|
|
60
|
+
// non-alphanumerics anywhere in the comment, so a reason may follow.
|
|
61
|
+
{ pattern: /^dprint-ignore-file/, notDocblock: true, name: "dprint-ignore-file" },
|
|
62
|
+
{
|
|
63
|
+
pattern: /(?:^|[^\p{L}\p{N}])dprint-ignore(?![\p{L}\p{N}])/u,
|
|
64
|
+
name: "dprint-ignore",
|
|
65
|
+
anyLine: true,
|
|
66
|
+
},
|
|
67
|
+
// Prettier pragma mode (--require-pragma / --check-ignore-pragma). Prettier
|
|
68
|
+
// reads them via jest-docblock: only the file's first block comment counts
|
|
69
|
+
// and the pragma has to open a line. The lookahead keeps distinct keys like
|
|
70
|
+
// `@prettier-plugin` ordinary, matching jest-docblock's `@(\S+)` parsing.
|
|
71
|
+
{ pattern: /^@(?:no)?(?:format|prettier)(?=\s|$)/, blockOnly: true, anyLine: true },
|
|
72
|
+
// prettier-plugin-organize-imports: a literal whole-file substring check,
|
|
73
|
+
// `//` and single space included, so it matches the raw comment text.
|
|
74
|
+
{ pattern: /\/\/ organize-imports-ignore/, rawText: true, name: "organize-imports-ignore" },
|
|
75
|
+
// js-beautify (legacy): exact-shape block comments with single spaces; only
|
|
76
|
+
// the ignore/preserve pairs have an effect.
|
|
77
|
+
{
|
|
78
|
+
pattern: /^\/\* beautify(?: (?:ignore|preserve):(?:start|end))+ \*\/$/,
|
|
79
|
+
rawText: true,
|
|
80
|
+
blockOnly: true,
|
|
81
|
+
name: "beautify",
|
|
82
|
+
},
|
|
33
83
|
// Coverage tools. The mode is part of the name so that consumers can tell
|
|
34
84
|
// next-statement pragmas (`next`, `if`, ...) from file/range ones (`file`,
|
|
35
85
|
// `start`, `stop`). The c8 CLI (v8-to-istanbul) and Node core only parse
|
|
@@ -45,22 +95,222 @@ const RULES = [
|
|
|
45
95
|
pattern: /^node:coverage\s+(disable|enable|ignore)\b/,
|
|
46
96
|
name: (match) => `node:coverage-${match[1]}`,
|
|
47
97
|
},
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
98
|
+
// type-coverage: substring match in any comment. There is no ignore-file
|
|
99
|
+
// comment — file-level ignores are a CLI option only.
|
|
100
|
+
{
|
|
101
|
+
pattern: /type-coverage:ignore-(next-line|line)/,
|
|
102
|
+
name: (match) => `type-coverage:ignore-${match[1]}`,
|
|
103
|
+
anyLine: true,
|
|
104
|
+
},
|
|
105
|
+
// StrykerJS mutation testing. The instrumenter runs
|
|
106
|
+
// /^\s?Stryker (disable|restore)( next-line)? <mutators>/ against the raw
|
|
107
|
+
// comment value: at most one space before `Stryker`, single literal spaces,
|
|
108
|
+
// and a mandatory mutator list (`all` or names) — hence the rawText match.
|
|
109
|
+
{
|
|
110
|
+
pattern: /^\/[/*]\s?Stryker (disable|restore)( next-line)? [a-zA-Z]/,
|
|
111
|
+
rawText: true,
|
|
112
|
+
name: (match) => `stryker-${match[1]}${match[2] === undefined ? "" : "-next-line"}`,
|
|
113
|
+
},
|
|
114
|
+
// ts-prune: substring of the closest leading comment above an export.
|
|
115
|
+
{ pattern: /ts-prune-ignore-next/, name: "ts-prune-ignore-next", anyLine: true },
|
|
116
|
+
// typescript-strict-plugin: token-equality scan over the whole file (the
|
|
117
|
+
// CLI splits comment lines on spaces, the IDE plugin uses a TODO scan).
|
|
118
|
+
{
|
|
119
|
+
pattern: /(?:^|\s)@ts-strict(-ignore)?(?=\s|$)/,
|
|
120
|
+
name: (match) => (match[1] === undefined ? "@ts-strict" : "@ts-strict-ignore"),
|
|
121
|
+
anyLine: true,
|
|
122
|
+
},
|
|
123
|
+
// Flow. The pragmas live in the file's leading docblock and are matched as
|
|
124
|
+
// whole words (text may surround them). Suppressions must open the comment
|
|
125
|
+
// and take an optional [error-code]; all four historical suppressors are
|
|
126
|
+
// recognised ($FlowIssue/$FlowIgnore stopped working in Flow 0.281 but
|
|
127
|
+
// still gate older setups). flowlint takes rule:severity pairs.
|
|
128
|
+
{
|
|
129
|
+
pattern: /(?:^|[\s*/])@(no)?flow(?=$|[\s*/])/,
|
|
130
|
+
name: (match) => (match[1] === undefined ? "@flow" : "@noflow"),
|
|
131
|
+
anyLine: true,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
pattern: /^\$Flow(FixMe|ExpectedError|Issue|Ignore)(?:\[[a-z-]+\])?(?![\w-])/,
|
|
135
|
+
name: (match) => `$Flow${match[1]}`,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
pattern: /^flowlint(-line|-next-line)?\s+[a-z][a-z-]*\s*:\s*(?:off|warn|error)/,
|
|
139
|
+
name: (match) => `flowlint${match[1] ?? ""}`,
|
|
140
|
+
joinLines: true,
|
|
141
|
+
},
|
|
142
|
+
// Bundlers. webpack's gate regex requires the colon to follow the key
|
|
143
|
+
// immediately and evaluates the body as an object literal, which JSDoc
|
|
144
|
+
// stars break — turbopack magic comments mirror the same `key: value` form.
|
|
145
|
+
{ pattern: /^webpack[A-Z][A-Za-z]+:/, name: "webpack-magic-comment", notDocblock: true },
|
|
146
|
+
{ pattern: /^turbopack[A-Z][A-Za-z]+:/, name: "turbopack-magic-comment", notDocblock: true },
|
|
147
|
+
// Vite matches the literal block comment (`/\/\*\s*@vite-ignore\s*\*\//` in
|
|
148
|
+
// importAnalysis), so line comments, suffixes and trailing words stay
|
|
149
|
+
// ordinary.
|
|
150
|
+
{ pattern: /^\/\*\s*@vite-ignore\s*\*\/$/, rawText: true, blockOnly: true, name: "@vite-ignore" },
|
|
151
|
+
// Terser/Rollup annotations: a bare substring search over any comment kind,
|
|
152
|
+
// so leading or trailing words keep the annotation active.
|
|
153
|
+
{ pattern: /[#@]__(?:PURE|NO_SIDE_EFFECTS|INLINE|NOINLINE|KEY|MANGLE_PROP)__/, anyLine: true },
|
|
154
|
+
// Million.js: substring of the leading comments of a component.
|
|
155
|
+
{ pattern: /million-ignore/, name: "million-ignore", anyLine: true },
|
|
156
|
+
{
|
|
157
|
+
pattern: /^@million (jsx-)?skip$/,
|
|
158
|
+
joinLines: true,
|
|
159
|
+
name: (match) => (match[1] === undefined ? "@million-skip" : "@million-jsx-skip"),
|
|
160
|
+
},
|
|
161
|
+
// Nx project graph: substring; the comment has to end on the line right
|
|
162
|
+
// above the import it hides.
|
|
163
|
+
{ pattern: /nx-ignore-next-line/, name: "nx-ignore-next-line", anyLine: true },
|
|
164
|
+
// UnoCSS: include/ignore are raw whole-file substring checks; the skip
|
|
165
|
+
// markers must be their own comment.
|
|
166
|
+
{ pattern: /@unocss-(include|ignore)/, name: (match) => `@unocss-${match[1]}`, anyLine: true },
|
|
167
|
+
{ pattern: /^@unocss-skip-(start|end)\b/, name: (match) => `@unocss-skip-${match[1]}` },
|
|
168
|
+
// Next.js codemod markers: `next build` fails while an unresolved
|
|
169
|
+
// @next-codemod-error comment is attached to the call.
|
|
170
|
+
{ pattern: /@next-codemod-(error|ignore)/, name: (match) => `@next-codemod-${match[1]}`, anyLine: true },
|
|
171
|
+
// Bun: the runtime treats a file starting with the literal bytes `// @bun`
|
|
172
|
+
// (optionally followed by flags like `@bytecode`) as already transpiled.
|
|
173
|
+
{ pattern: /^\/\/ @bun/, rawText: true, lineOnly: true, name: "@bun" },
|
|
174
|
+
// React Fast Refresh / solid-refresh. react-refresh looks for the
|
|
175
|
+
// substring `@refresh reset` in any comment; solid-refresh requires its
|
|
176
|
+
// pragma to be the entire comment body.
|
|
177
|
+
{ pattern: /^@refresh (skip|reload)$/, joinLines: true, name: (match) => `@refresh-${match[1]}` },
|
|
178
|
+
{ pattern: /@refresh reset/, name: "@refresh-reset", anyLine: true },
|
|
179
|
+
// Embedded-language tag comments: prettier formats the following template
|
|
180
|
+
// literal when the whole comment is `GraphQL` (graphql-tag-pluck matches it
|
|
181
|
+
// case-insensitively) or `HTML` (prettier's exact ` HTML ` value).
|
|
182
|
+
{ pattern: /^graphql$/i, joinLines: true, name: "GraphQL" },
|
|
183
|
+
{ pattern: /^\/\* HTML \*\/$/, rawText: true, blockOnly: true, name: "HTML" },
|
|
54
184
|
// Source maps (`//# sourceMappingURL=`, legacy `//@`, and the block form)
|
|
55
|
-
{ pattern: /^[#@]\s*(source(?:Mapping)?URL)=/, name: (match) => match[1]
|
|
185
|
+
{ pattern: /^[#@]\s*(source(?:Mapping)?URL)=/, name: (match) => match[1] },
|
|
56
186
|
// JSX pragmas (docblock pragmas: block comments only, honoured on any line)
|
|
57
187
|
{ pattern: /^@jsx(?:Runtime|ImportSource|Frag)?\b/, blockOnly: true, anyLine: true },
|
|
58
|
-
// Test runners
|
|
59
|
-
|
|
188
|
+
// Test runners. Jest reads these from the file's leading docblock, but
|
|
189
|
+
// Vitest (which also honours the @jest- spellings) matches the pragma with
|
|
190
|
+
// a bare regex over the whole file, so any comment kind and position can be
|
|
191
|
+
// active; both regexes require a value after the tag.
|
|
192
|
+
{
|
|
193
|
+
pattern: /@((?:jest|vitest)-environment)\s+[\w-]/,
|
|
194
|
+
name: (match) => `@${match[1]}`,
|
|
195
|
+
anyLine: true,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
pattern: /@((?:jest|vitest)-environment-options)\s+\S/,
|
|
199
|
+
name: (match) => `@${match[1]}`,
|
|
200
|
+
anyLine: true,
|
|
201
|
+
},
|
|
202
|
+
// Vitest module tags. Vitest requires the tag to sit right after a `//` or
|
|
203
|
+
// `*` marker, which is what a content-line start means here.
|
|
204
|
+
{ pattern: /^@module-tag\s+[\w/-]/, name: "@module-tag", anyLine: true },
|
|
205
|
+
// SonarQube/SonarCloud: the trimmed comment (JSDoc star stripped) has to
|
|
206
|
+
// START with NOSONAR, case-insensitively; any suffix keeps it active.
|
|
207
|
+
{ pattern: /^NOSONAR/i, name: "NOSONAR" },
|
|
208
|
+
// Semgrep: ` nosemgrep`/` nosem` (case-insensitive) on the finding line or
|
|
209
|
+
// standalone above it, with optional `:`/`=` rule ids. Semgrep itself needs
|
|
210
|
+
// no trailing boundary; the lookahead just keeps words like `nosemantic`
|
|
211
|
+
// ordinary.
|
|
212
|
+
{ pattern: /(?:^|\s)nosem(?:grep)?(?![\w-])/i, name: "nosemgrep", anyLine: true },
|
|
213
|
+
// CodeQL / LGTM alert suppressions: the AlertSuppression queries only read
|
|
214
|
+
// `//` comments, so block comments — even single-line ones — stay ordinary.
|
|
215
|
+
// `lgtm[...]` matches anywhere in the comment; bare `lgtm` only at the
|
|
216
|
+
// start or after a `;`; `codeql[...]` requires the bracketed query id.
|
|
217
|
+
{ pattern: /\blgtm\s*\[[^\]]*\]/i, lineOnly: true, name: "lgtm" },
|
|
218
|
+
{ pattern: /(?:^|;)\s*lgtm(?!\w)(?!\s*\[)/i, lineOnly: true, name: "lgtm" },
|
|
219
|
+
{ pattern: /\bcodeql\s*\[[^\]]*\]/i, lineOnly: true, name: "codeql" },
|
|
220
|
+
// DeepSource: bare `skipcq` or `skipcq: CODE1, CODE2`, on the flagged line
|
|
221
|
+
// or standalone above it (it may trail other comment text).
|
|
222
|
+
{ pattern: /\bskipcq(?![\w-])/, name: "skipcq", anyLine: true },
|
|
223
|
+
// Snyk Code (DeepCode, legacy): `deepcode ignore RuleId: reason`, with a
|
|
224
|
+
// `file ` prefix for the file-wide form.
|
|
225
|
+
{ pattern: /^(?:file\s+)?deepcode\s+ignore\b/, name: "deepcode-ignore" },
|
|
226
|
+
// Datadog static analysis: the keyword must directly follow the comment
|
|
227
|
+
// opener (whitespace aside); a `/**` star defeats it. Applies to the next
|
|
228
|
+
// line, or the whole file from line 1.
|
|
229
|
+
{ pattern: /^(no-dd-sa|datadog-disable)/, notDocblock: true, name: (match) => match[1] },
|
|
230
|
+
// Secret scanners: raw substring checks on the finding line.
|
|
231
|
+
{ pattern: /gitleaks:allow/, name: "gitleaks:allow", anyLine: true },
|
|
232
|
+
{ pattern: /trufflehog:ignore/, name: "trufflehog:ignore", anyLine: true },
|
|
233
|
+
// detect-secrets: `pragma: allowlist secret` (legacy `whitelist`) on the
|
|
234
|
+
// finding line, or the nextline form standing alone above it.
|
|
235
|
+
{ pattern: /^pragma: ?allowlist[ -]nextline[ -]secret/, name: "pragma-allowlist-nextline-secret" },
|
|
236
|
+
{ pattern: /^pragma: ?(?:allow|white)list[ -]secret/, name: "pragma-allowlist-secret" },
|
|
237
|
+
// cspell in-document directives: `\b(?:spell-?checker|c?spell)::?` (yes,
|
|
238
|
+
// bare `spell:` counts) anywhere in the text, case-insensitive, followed by
|
|
239
|
+
// one of the known directive verbs. Names are normalised to `cspell:<verb>`.
|
|
240
|
+
{
|
|
241
|
+
pattern: /\b(?:c?spell|spell-?checker)::?\s*(disable(?:-line|-next(?:-line)?)?|enable|ignore(?:-?words?)?|words?|(?:flag|forbid)(?:-?words?)?|ignore_?reg_?exp|include_?reg_?exp|dictionar(?:y|ies)|locale?|language|(?:enable|disable)(?:allow)?compoundwords|(?:enable|disable)casesensitive)\b(?!-)/i,
|
|
242
|
+
name: (match) => `cspell:${match[1].toLowerCase()}`,
|
|
243
|
+
anyLine: true,
|
|
244
|
+
},
|
|
245
|
+
// cspell's legacy emacs-style word list (case-sensitive, colon optional).
|
|
246
|
+
{ pattern: /\bLocalWords(?::|\s+\S)/, name: "LocalWords", anyLine: true },
|
|
247
|
+
// codespell: the tag must follow a punctuation character (the comment
|
|
248
|
+
// marker itself at line starts) with at most one space between.
|
|
249
|
+
{
|
|
250
|
+
pattern: /(?:^|[^\w\s]\s?)codespell:ignore(-next-line)?(?![\w-])/,
|
|
251
|
+
name: (match) => `codespell:ignore${match[1] ?? ""}`,
|
|
252
|
+
anyLine: true,
|
|
253
|
+
},
|
|
254
|
+
// JetBrains IDEs. `noinspection` suppressions are line comments in JS/TS
|
|
255
|
+
// and take comma-separated inspection ids; editor-fold markers are
|
|
256
|
+
// substring checks; a `language=` comment injects a language into the
|
|
257
|
+
// literal that follows.
|
|
258
|
+
{ pattern: /^noinspection\s+[A-Za-z0-9_.-]+/, lineOnly: true, name: "noinspection" },
|
|
259
|
+
{
|
|
260
|
+
pattern: /<(\/?)editor-fold/,
|
|
261
|
+
name: (match) => (match[1] === "/" ? "editor-fold-end" : "editor-fold"),
|
|
262
|
+
anyLine: true,
|
|
263
|
+
},
|
|
264
|
+
{ pattern: /^language=\S/, name: "language-injection" },
|
|
265
|
+
// ReSharper/Rider suppressions (`ReSharper disable once RuleName`, ...).
|
|
266
|
+
{ pattern: /^ReSharper (disable|restore)\b/, lineOnly: true, name: (match) => `resharper-${match[1]}` },
|
|
60
267
|
// Editor folding
|
|
61
268
|
{ pattern: /^#(?:region|endregion)\b/ },
|
|
62
269
|
];
|
|
63
270
|
const TRIPLE_SLASH = /^\/\/\/\s*<(reference|amd-dependency|amd-module)\b/;
|
|
271
|
+
const ANY_PLACEMENT = { header: true, firstComment: true, fileStart: true };
|
|
272
|
+
// File-wide pragmas (check pragmas, triple-slash directives, Flow/JSLint
|
|
273
|
+
// header pragmas, Deno's *-ignore-file and @ts-self-types forms) only count
|
|
274
|
+
// before the first token; anywhere later the tools treat them as ordinary
|
|
275
|
+
// text. dprint-ignore-file is deliberately absent: a stray one below the
|
|
276
|
+
// header no longer skips the file, but dprint's node pragma still matches
|
|
277
|
+
// inside it, so the comment stays an active `dprint-ignore` and must keep its
|
|
278
|
+
// tag. Coverage file pragmas (`istanbul ignore file`, `c8/v8 ignore file`)
|
|
279
|
+
// are NOT gated: istanbul-lib-instrument and Vitest's v8 provider
|
|
280
|
+
// (ast-v8-to-istanbul) honour them on any comment in the file. Test
|
|
281
|
+
// environment pragmas are not gated either: Vitest matches them (including
|
|
282
|
+
// the @jest- spellings) with a regex over the whole file, and neither are
|
|
283
|
+
// @ts-strict pragmas (typescript-strict-plugin scans every line). @jsx
|
|
284
|
+
// pragmas stay ungated too: tsc only reads leading ones, but Babel's JSX
|
|
285
|
+
// transform scans every comment in the file.
|
|
286
|
+
const HEADER_ONLY_DIRECTIVES = new Set([
|
|
287
|
+
"@ts-nocheck",
|
|
288
|
+
"@ts-check",
|
|
289
|
+
"@flow",
|
|
290
|
+
"@noflow",
|
|
291
|
+
"@ts-self-types",
|
|
292
|
+
"jslint",
|
|
293
|
+
"property",
|
|
294
|
+
]);
|
|
295
|
+
// Prettier's pragma mode reads the pragma through jest-docblock, which only
|
|
296
|
+
// ever extracts the file's FIRST comment (a shebang may precede it) — a
|
|
297
|
+
// docblock behind any other comment is ignored. Verified against prettier 3.8.
|
|
298
|
+
const FIRST_COMMENT_ONLY_DIRECTIVES = new Set(["@format", "@noformat", "@prettier", "@noprettier"]);
|
|
299
|
+
// Bun treats a file as pre-transpiled only when it literally STARTS with
|
|
300
|
+
// `// @bun`; after a shebang or any other leading content the marker is inert.
|
|
301
|
+
const FILE_START_ONLY_DIRECTIVES = new Set(["@bun"]);
|
|
302
|
+
function isActiveAt(name, placement) {
|
|
303
|
+
if (FILE_START_ONLY_DIRECTIVES.has(name))
|
|
304
|
+
return placement.fileStart;
|
|
305
|
+
if (FIRST_COMMENT_ONLY_DIRECTIVES.has(name))
|
|
306
|
+
return placement.firstComment;
|
|
307
|
+
if (HEADER_ONLY_DIRECTIVES.has(name) ||
|
|
308
|
+
(name.startsWith("deno-") && name.endsWith("-ignore-file")) ||
|
|
309
|
+
name.startsWith("triple-slash-")) {
|
|
310
|
+
return placement.header;
|
|
311
|
+
}
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
64
314
|
// Mirrors the TypeScript compiler's own comment-directive matching, verified
|
|
65
315
|
// against tsc: the suppression directives are case-sensitive PREFIX matches
|
|
66
316
|
// (`@ts-ignoreTODO` is active), while the file-wide check pragmas are
|
|
@@ -75,12 +325,21 @@ const TS_BLOCK_SUPPRESSION = /^\s*[/*]*\s*@ts-(ignore|expect-error)/;
|
|
|
75
325
|
/**
|
|
76
326
|
* Returns the canonical name of the compiler/linter/tooling directive the
|
|
77
327
|
* comment represents, or `undefined` when the comment is an ordinary comment.
|
|
328
|
+
*
|
|
329
|
+
* When a placement is given, directives that the corresponding tool only
|
|
330
|
+
* honours in certain positions (header pragmas, prettier's docblock pragma,
|
|
331
|
+
* `// @bun`) are skipped elsewhere — and the remaining rules still run, so a
|
|
332
|
+
* live directive later in the same comment (`// deno-lint-ignore-file
|
|
333
|
+
* nosemgrep` in mid-file) is not masked by a positionally dead one.
|
|
78
334
|
*/
|
|
79
|
-
export function detectDirective(kind, text) {
|
|
335
|
+
export function detectDirective(kind, text, placement) {
|
|
336
|
+
const at = placement ?? ANY_PLACEMENT;
|
|
80
337
|
if (kind === "line") {
|
|
81
338
|
const tripleSlash = TRIPLE_SLASH.exec(text);
|
|
82
339
|
if (tripleSlash) {
|
|
83
|
-
|
|
340
|
+
const name = `triple-slash-${tripleSlash[1]}`;
|
|
341
|
+
if (isActiveAt(name, at))
|
|
342
|
+
return name;
|
|
84
343
|
}
|
|
85
344
|
const suppression = TS_LINE_SUPPRESSION.exec(text);
|
|
86
345
|
if (suppression) {
|
|
@@ -88,7 +347,9 @@ export function detectDirective(kind, text) {
|
|
|
88
347
|
}
|
|
89
348
|
const checkPragma = TS_LINE_CHECK_PRAGMA.exec(text);
|
|
90
349
|
if (checkPragma) {
|
|
91
|
-
|
|
350
|
+
const name = `@ts-${checkPragma[1]?.toLowerCase()}`;
|
|
351
|
+
if (isActiveAt(name, at))
|
|
352
|
+
return name;
|
|
92
353
|
}
|
|
93
354
|
}
|
|
94
355
|
else {
|
|
@@ -97,31 +358,45 @@ export function detectDirective(kind, text) {
|
|
|
97
358
|
return `@ts-${suppression[1]}`;
|
|
98
359
|
}
|
|
99
360
|
}
|
|
100
|
-
const lines = contentLines(kind, text);
|
|
361
|
+
const lines = contentLines(kind, text, false);
|
|
362
|
+
const literalLines = kind === "block" ? contentLines(kind, text, true) : lines;
|
|
101
363
|
for (const rule of RULES) {
|
|
102
364
|
if (rule.blockOnly === true && kind !== "block")
|
|
103
365
|
continue;
|
|
104
|
-
|
|
366
|
+
if (rule.lineOnly === true && kind !== "line")
|
|
367
|
+
continue;
|
|
368
|
+
if (rule.notDocblock === true && kind === "block" && text.startsWith("/**"))
|
|
369
|
+
continue;
|
|
370
|
+
const ruleLines = rule.keepStars === true ? literalLines : lines;
|
|
371
|
+
const candidates = rule.rawText === true
|
|
372
|
+
? [text]
|
|
373
|
+
: rule.anyLine === true
|
|
374
|
+
? ruleLines
|
|
375
|
+
: rule.joinLines === true
|
|
376
|
+
? [ruleLines.join(" ")]
|
|
377
|
+
: ruleLines.slice(0, 1);
|
|
105
378
|
for (const line of candidates) {
|
|
106
379
|
const match = rule.pattern.exec(line);
|
|
107
380
|
if (!match)
|
|
108
381
|
continue;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return rule.name(match);
|
|
113
|
-
return match[0];
|
|
382
|
+
const name = typeof rule.name === "string" ? rule.name : typeof rule.name === "function" ? rule.name(match) : match[0];
|
|
383
|
+
if (isActiveAt(name, at))
|
|
384
|
+
return name;
|
|
114
385
|
}
|
|
115
386
|
}
|
|
116
387
|
return undefined;
|
|
117
388
|
}
|
|
118
389
|
/**
|
|
119
|
-
* True for license/legal comments (`/*!`, `@license`, `@preserve`,
|
|
120
|
-
*
|
|
390
|
+
* True for license/legal comments (`/*!`, `@license`, `@preserve`,
|
|
391
|
+
* `@copyright`, and the machine-readable `SPDX-License-Identifier:` /
|
|
392
|
+
* `SPDX-FileCopyrightText:` tags) that build tools conventionally keep when
|
|
393
|
+
* stripping comments and that license scanners rely on.
|
|
121
394
|
*/
|
|
122
395
|
export function isLegalComment(text) {
|
|
123
396
|
if (text.startsWith("/*!") || text.startsWith("//!"))
|
|
124
397
|
return true;
|
|
398
|
+
if (/\bSPDX-(?:License-Identifier|FileCopyrightText):/i.test(text))
|
|
399
|
+
return true;
|
|
125
400
|
return /@(?:license|preserve|copyright)\b/i.test(text);
|
|
126
401
|
}
|
|
127
402
|
// Every ECMAScript line terminator, the way the scanner breaks lines: CRLF as
|
|
@@ -131,13 +406,22 @@ const LINE_BREAK = /\r\n|[\n\r\u2028\u2029]/;
|
|
|
131
406
|
* Non-empty content lines of the comment, with comment markers stripped.
|
|
132
407
|
* For line comments only the `//` marker itself is removed: extra slashes or
|
|
133
408
|
* stars are content, so `//// @ts-ignore` and `// * prettier-ignore` stay
|
|
134
|
-
* ordinary. JSDoc-style `*` prefixes are stripped for block comments
|
|
409
|
+
* ordinary. JSDoc-style `*` prefixes are stripped for block comments unless
|
|
410
|
+
* `keepStars` asks for the literal lines (for tools that compare the raw
|
|
411
|
+
* comment value, where a leading `*` defeats the directive).
|
|
135
412
|
*/
|
|
136
|
-
function contentLines(kind, text) {
|
|
137
|
-
|
|
413
|
+
function contentLines(kind, text, keepStars) {
|
|
414
|
+
// In keepStars mode only the literal `/*` and `*/` markers go, matching how
|
|
415
|
+
// prettier/oxfmt read the comment value: the second star of a `/**` opener
|
|
416
|
+
// is content and defeats their exact comparison.
|
|
417
|
+
const inner = kind === "line"
|
|
418
|
+
? text.replace(/^\/\//, "")
|
|
419
|
+
: keepStars
|
|
420
|
+
? text.replace(/^\/\*/, "").replace(/\*\/\s*$/, "")
|
|
421
|
+
: text.replace(/^\/\*+/, "").replace(/\*+\/\s*$/, "");
|
|
138
422
|
const lines = [];
|
|
139
423
|
for (const line of inner.split(LINE_BREAK)) {
|
|
140
|
-
const stripped = (kind === "block" ? line.replace(/^\s*\*+\s*/, "") : line).trim();
|
|
424
|
+
const stripped = (kind === "block" && !keepStars ? line.replace(/^\s*\*+\s*/, "") : line).trim();
|
|
141
425
|
if (stripped !== "")
|
|
142
426
|
lines.push(stripped);
|
|
143
427
|
}
|
package/dist/directives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAkBA,MAAM,KAAK,GAAoB;IAC7B,SAAS;IACT,EAAE,OAAO,EAAE,mDAAmD,EAAE;IAChE,EAAE,OAAO,EAAE,eAAe,EAAE;IAC5B,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;IAC7E;QACE,OAAO,EAAE,2BAA2B;QACpC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ;QACrC,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;KAChB;IACD,kBAAkB;IAClB,EAAE,OAAO,EAAE,iBAAiB,EAAE;IAC9B,oEAAoE;IACpE,6EAA6E;IAC7E,uEAAuE;IACvE,EAAE,OAAO,EAAE,+CAA+C,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE;IAC7F,4EAA4E;IAC5E,iDAAiD;IACjD,EAAE,OAAO,EAAE,o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AY,CAAC,IAAiB,EAAE,IAAY,EAAE,SAAkB;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,iDAAiD;IACjD,MAAM,KAAK,GACT,IAAI,KAAK,MAAM;QACb,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3B,CAAC,CAAC,SAAS;YACT,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YACnD,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACjG,IAAI,QAAQ,KAAK,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,2FAA2F;AAC3F,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAW,CAAC;AAC3C,CAAC"}
|
package/dist/files.d.ts
CHANGED
|
@@ -13,6 +13,40 @@ export interface CollectOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function collectFiles(inputs: string[], options?: CollectOptions): Promise<string[]>;
|
|
15
15
|
export declare function isJsxFile(file: string): boolean;
|
|
16
|
+
export type FileEncoding = "utf8" | "utf16le" | "utf16be";
|
|
17
|
+
export interface FileText {
|
|
18
|
+
/** Decoded content with any byte-order mark stripped. */
|
|
19
|
+
text: string;
|
|
20
|
+
encoding: FileEncoding;
|
|
21
|
+
/** Whether the file carried a byte-order mark. */
|
|
22
|
+
bom: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether re-encoding `text` reproduces the original bytes exactly. False
|
|
25
|
+
* for invalid UTF-8 (decoded with replacement characters), truncated
|
|
26
|
+
* UTF-16 and other undecodable input; such files must not be rewritten.
|
|
27
|
+
*/
|
|
28
|
+
lossless: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Decodes a source file. UTF-16 (either endianness) is recognised by its
|
|
32
|
+
* byte-order mark; everything else is treated as UTF-8. Positions reported by
|
|
33
|
+
* the scanner are relative to the decoded, BOM-stripped text, matching
|
|
34
|
+
* editors, GitHub annotations and the removal report.
|
|
35
|
+
*/
|
|
36
|
+
export declare function decodeFileText(data: Buffer): FileText;
|
|
37
|
+
/** Re-encodes decoded text in the encoding (and BOM) it was read with. */
|
|
38
|
+
export declare function encodeFileText(text: string, target: {
|
|
39
|
+
encoding: FileEncoding;
|
|
40
|
+
bom: boolean;
|
|
41
|
+
}): Buffer;
|
|
42
|
+
export declare function readFileText(file: string): Promise<FileText>;
|
|
43
|
+
/**
|
|
44
|
+
* Replaces a file's content atomically: the data is written to a temporary
|
|
45
|
+
* sibling, flushed, and renamed into place, so a crash, full disk or write
|
|
46
|
+
* error can never leave the target truncated. Symlinks are followed (the
|
|
47
|
+
* link's target is replaced, not the link) and the file mode is preserved.
|
|
48
|
+
*/
|
|
49
|
+
export declare function writeFileAtomic(file: string, data: Buffer): Promise<void>;
|
|
16
50
|
export declare function scanFile(file: string): Promise<FileScanResult>;
|
|
17
51
|
export declare function scanPaths(inputs: string[], options?: CollectOptions): Promise<FileScanResult[]>;
|
|
18
52
|
export declare const FILE_CONCURRENCY = 16;
|
package/dist/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKjD,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAID,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkCpG;AAsHD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACvB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,kDAAkD;IAClD,GAAG,EAAE,OAAO,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAmBrD;AASD,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CASrG;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAElE;AAED;;;;;GA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