@hominis/fireforge 0.18.11 → 0.19.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/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/dist/src/core/config-paths.d.ts +1 -1
- package/dist/src/core/config-paths.js +2 -0
- package/dist/src/core/config-validate.js +47 -0
- package/dist/src/core/patch-lint-checkjs.d.ts +17 -1
- package/dist/src/core/patch-lint-checkjs.js +39 -6
- package/dist/src/core/patch-lint-reexports.d.ts +9 -0
- package/dist/src/core/patch-lint-reexports.js +11 -0
- package/dist/src/core/patch-lint.d.ts +1 -5
- package/dist/src/core/patch-lint.js +5 -12
- package/dist/src/types/config.d.ts +28 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- **`patchLint.checkJsStrict` and `patchLint.checkJsCompilerOptions`.** The patch-lint `checkJs` pass now defaults to the historical loose preset (`strict: false`, `noImplicitAny: false`). Set `"patchLint": { "checkJs": true, "checkJsStrict": true }` to enforce `strict` and `noImplicitAny` on patch-owned `.sys.mjs` so implicit-any parameters surface as `checkjs-type-error`, aligning with strict whole-project checkJs without changing module resolution (`noResolve` and `resource://` suppression unchanged). Optional `checkJsCompilerOptions` (requires `checkJsStrict`) merges allowlisted boolean compiler overrides — for example `{ "strictNullChecks": false }` — after the strict preset for gradual adoption. The Firefox globals shim and `SUPPRESSED_DIAGNOSTIC_CODES` remain shared with `fireforge typecheck` via `typecheck-shim.ts`.
|
|
8
|
+
|
|
3
9
|
## 0.18.0
|
|
4
10
|
|
|
5
11
|
### Compatibility
|
package/README.md
CHANGED
|
@@ -241,7 +241,7 @@ By default, a standalone `fireforge lint` (no arguments) lints the **aggregate**
|
|
|
241
241
|
| `missing-jsdoc` | Exports in patch-owned `.sys.mjs` | error |
|
|
242
242
|
| `jsdoc-param-mismatch` | Exports in patch-owned `.sys.mjs` | error |
|
|
243
243
|
| `jsdoc-missing-returns` | Exports in patch-owned `.sys.mjs` | error |
|
|
244
|
-
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in)
|
|
244
|
+
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in `patchLint.checkJs`) | error |
|
|
245
245
|
| `missing-jsdoc-class-method` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
246
246
|
| `jsdoc-class-method-param-mismatch` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
247
247
|
| `jsdoc-class-method-missing-returns` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
@@ -255,9 +255,9 @@ By default, a standalone `fireforge lint` (no arguments) lints the **aggregate**
|
|
|
255
255
|
|
|
256
256
|
**JSDoc validation** uses AST-based analysis (Acorn) to validate exported APIs in patch-owned `.sys.mjs` files. A file is "patch-owned" if it was newly created by the current diff or by an existing patch in the queue. Functions must document every `@param` (names must match) and include `@returns` when the function returns a value. Exported constants and classes require a JSDoc block.
|
|
257
257
|
|
|
258
|
-
**Optional `checkJs` pass.** Enable a TypeScript-esque bastardization of type checking for patch-owned `.sys.mjs` files by adding `"patchLint": { "checkJs": true }` to `fireforge.json`. This uses the TypeScript compiler API with `allowJs + checkJs + noEmit`, scoped only to patch-owned files. Firefox globals (`Services`, `ChromeUtils`, `lazy`, etc.) are shimmed automatically. Module-resolution errors from Firefox's `resource://` and `chrome://` URL schemes are suppressed since TypeScript cannot follow these.
|
|
258
|
+
**Optional `checkJs` pass.** Enable a TypeScript-esque bastardization of type checking for patch-owned `.sys.mjs` files by adding `"patchLint": { "checkJs": true }` to `fireforge.json`. This uses the TypeScript compiler API with `allowJs + checkJs + noEmit`, scoped only to patch-owned files. Firefox globals (`Services`, `ChromeUtils`, `lazy`, etc.) are shimmed automatically. Module-resolution errors from Firefox's `resource://` and `chrome://` URL schemes are suppressed since TypeScript cannot follow these. By default the pass uses a **loose** compiler preset (`strict: false`, `noImplicitAny: false`) so implicit `any` from untyped parameters does not flood the output. Set `"patchLint": { "checkJsStrict": true }` (requires `checkJs: true`) to enable `strict` and `noImplicitAny` for parity with strict whole-project checkJs — implicit-any parameters then surface as `checkjs-type-error`. Optional `"patchLint": { "checkJsCompilerOptions": { "strictNullChecks": false } }` (requires `checkJsStrict: true`) merges **allowlisted boolean** strict flags after that preset so forks can tighten `noImplicitAny` while relaxing e.g. null checks. The same built-in shim and the same eight suppressed diagnostic codes as `fireforge typecheck` apply; only explicit strictness differs. Projects that need to extend the built-in shim (e.g. for `MozLitElement`, `MozXULElement`, or fork-specific component bases) can point at an additional `.d.ts` via `"patchLint": { "checkJsExtraShim": "tools/types/<fork>-globals.d.ts" }`; the file is concatenated to the built-in shim — augment, don't redeclare.
|
|
259
259
|
|
|
260
|
-
**Whole-project type checking — `fireforge typecheck`.** `patchLint.checkJs` is patch-hygiene: scoped to patch-owned `.sys.mjs`, suppresses module-resolution noise, and runs every time `fireforge lint` runs. `fireforge typecheck`
|
|
260
|
+
**Whole-project type checking — `fireforge typecheck`.** `patchLint.checkJs` is patch-hygiene: scoped to patch-owned `.sys.mjs`, suppresses module-resolution noise, and runs every time `fireforge lint` runs. With `checkJsStrict`, that pass can match a strict jsconfig's `noImplicitAny` behaviour without replacing full-project resolution. `fireforge typecheck` remains the CI-grade complement: it runs whole projects you point at via `typecheck.projects` in `fireforge.json`, honours each jsconfig's strictness/include/exclude/`paths`, and is intended as a CI gate. The two are complementary; the recommended setup is `fireforge lint` on every patch export and `fireforge typecheck` on CI for the project-level baseline.
|
|
261
261
|
|
|
262
262
|
```jsonc
|
|
263
263
|
{
|
|
@@ -19,7 +19,7 @@ export declare const SRC_DIR = "src";
|
|
|
19
19
|
/** Supported top-level fireforge.json keys backed by the current schema. */
|
|
20
20
|
export declare const SUPPORTED_CONFIG_ROOT_KEYS: readonly ["name", "vendor", "appId", "binaryName", "firefox", "build", "license", "wire", "patchLint", "typecheck", "markerComment"];
|
|
21
21
|
/** Supported config paths that can be read or set without --force. */
|
|
22
|
-
export declare const SUPPORTED_CONFIG_PATHS: readonly ["name", "vendor", "appId", "binaryName", "license", "firefox", "firefox.version", "firefox.product", "build", "build.jobs", "wire", "wire.subscriptDir", "patchLint", "patchLint.checkJs", "patchLint.checkJsExtraShim", "patchLint.rawColorAllowlist", "patchLint.jsdocClassMethods", "patchLint.testAssertionFloor", "patchLint.chromeScriptJsDoc", "typecheck", "typecheck.projects", "typecheck.extraShim", "markerComment"];
|
|
22
|
+
export declare const SUPPORTED_CONFIG_PATHS: readonly ["name", "vendor", "appId", "binaryName", "license", "firefox", "firefox.version", "firefox.product", "build", "build.jobs", "wire", "wire.subscriptDir", "patchLint", "patchLint.checkJs", "patchLint.checkJsStrict", "patchLint.checkJsCompilerOptions", "patchLint.checkJsExtraShim", "patchLint.rawColorAllowlist", "patchLint.jsdocClassMethods", "patchLint.testAssertionFloor", "patchLint.chromeScriptJsDoc", "typecheck", "typecheck.projects", "typecheck.extraShim", "markerComment"];
|
|
23
23
|
/**
|
|
24
24
|
* Gets all project paths based on a root directory.
|
|
25
25
|
* @param root - Root directory of the project
|
|
@@ -47,6 +47,8 @@ export const SUPPORTED_CONFIG_PATHS = [
|
|
|
47
47
|
'wire.subscriptDir',
|
|
48
48
|
'patchLint',
|
|
49
49
|
'patchLint.checkJs',
|
|
50
|
+
'patchLint.checkJsStrict',
|
|
51
|
+
'patchLint.checkJsCompilerOptions',
|
|
50
52
|
'patchLint.checkJsExtraShim',
|
|
51
53
|
'patchLint.rawColorAllowlist',
|
|
52
54
|
'patchLint.jsdocClassMethods',
|
|
@@ -201,6 +201,36 @@ function optionalConfigObject(rec, key) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
const SEVERITY_GATE_VALUES = ['off', 'warning', 'error'];
|
|
204
|
+
/** Allowlisted keys for `patchLint.checkJsCompilerOptions` (boolean overrides only). */
|
|
205
|
+
const PATCH_LINT_CHECKJS_COMPILER_OPTION_KEYS = [
|
|
206
|
+
'strictNullChecks',
|
|
207
|
+
'strictFunctionTypes',
|
|
208
|
+
'strictBindCallApply',
|
|
209
|
+
'noImplicitThis',
|
|
210
|
+
'useUnknownInCatchVariables',
|
|
211
|
+
'strictPropertyInitialization',
|
|
212
|
+
'noUnusedLocals',
|
|
213
|
+
'noUnusedParameters',
|
|
214
|
+
];
|
|
215
|
+
function parsePatchLintCheckJsCompilerOptions(raw) {
|
|
216
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
217
|
+
throw new ConfigError('Config field "patchLint.checkJsCompilerOptions" must be a plain object');
|
|
218
|
+
}
|
|
219
|
+
const rec = raw;
|
|
220
|
+
const allowed = new Set(PATCH_LINT_CHECKJS_COMPILER_OPTION_KEYS);
|
|
221
|
+
const out = {};
|
|
222
|
+
for (const key of Object.keys(rec)) {
|
|
223
|
+
if (!allowed.has(key)) {
|
|
224
|
+
throw new ConfigError(`Config field "patchLint.checkJsCompilerOptions" has unknown key "${key}"`);
|
|
225
|
+
}
|
|
226
|
+
const val = rec[key];
|
|
227
|
+
if (typeof val !== 'boolean') {
|
|
228
|
+
throw new ConfigError(`Config field "patchLint.checkJsCompilerOptions.${key}" must be a boolean`);
|
|
229
|
+
}
|
|
230
|
+
out[key] = val;
|
|
231
|
+
}
|
|
232
|
+
return out;
|
|
233
|
+
}
|
|
204
234
|
function parseSeverityGate(raw, label) {
|
|
205
235
|
if (raw === undefined)
|
|
206
236
|
return undefined;
|
|
@@ -218,6 +248,17 @@ function parsePatchLintBlock(rec) {
|
|
|
218
248
|
}
|
|
219
249
|
out.checkJs = checkJs;
|
|
220
250
|
}
|
|
251
|
+
const checkJsStrict = rec.raw('checkJsStrict');
|
|
252
|
+
if (checkJsStrict !== undefined) {
|
|
253
|
+
if (typeof checkJsStrict !== 'boolean') {
|
|
254
|
+
throw new ConfigError('Config field "patchLint.checkJsStrict" must be a boolean');
|
|
255
|
+
}
|
|
256
|
+
out.checkJsStrict = checkJsStrict;
|
|
257
|
+
}
|
|
258
|
+
const checkJsCompilerOptionsRaw = rec.raw('checkJsCompilerOptions');
|
|
259
|
+
if (checkJsCompilerOptionsRaw !== undefined) {
|
|
260
|
+
out.checkJsCompilerOptions = parsePatchLintCheckJsCompilerOptions(checkJsCompilerOptionsRaw);
|
|
261
|
+
}
|
|
221
262
|
const checkJsExtraShim = rec.raw('checkJsExtraShim');
|
|
222
263
|
if (checkJsExtraShim !== undefined) {
|
|
223
264
|
out.checkJsExtraShim = parseShimPath(checkJsExtraShim, 'patchLint.checkJsExtraShim');
|
|
@@ -242,6 +283,12 @@ function parsePatchLintBlock(rec) {
|
|
|
242
283
|
if (chromeScriptJsDoc !== undefined) {
|
|
243
284
|
out.chromeScriptJsDoc = chromeScriptJsDoc;
|
|
244
285
|
}
|
|
286
|
+
if (out.checkJsStrict === true && out.checkJs !== true) {
|
|
287
|
+
throw new ConfigError('Config field "patchLint.checkJsStrict" requires "patchLint.checkJs": true');
|
|
288
|
+
}
|
|
289
|
+
if (out.checkJsCompilerOptions !== undefined && out.checkJsStrict !== true) {
|
|
290
|
+
throw new ConfigError('Config field "patchLint.checkJsCompilerOptions" requires "patchLint.checkJsStrict": true');
|
|
291
|
+
}
|
|
245
292
|
return out;
|
|
246
293
|
}
|
|
247
294
|
/**
|
|
@@ -12,8 +12,12 @@
|
|
|
12
12
|
* diagnostic code list now live in `typecheck-shim.ts` and are shared
|
|
13
13
|
* with the whole-project `fireforge typecheck` command — keeping a
|
|
14
14
|
* single source of truth for the Firefox-globals coverage.
|
|
15
|
+
* `patchLint.checkJsStrict` only tightens `strict` / `noImplicitAny`
|
|
16
|
+
* and optional allowlisted `checkJsCompilerOptions`; it does not change
|
|
17
|
+
* shim composition or suppressed diagnostic codes.
|
|
15
18
|
*/
|
|
16
19
|
import type { PatchLintIssue } from '../types/commands/index.js';
|
|
20
|
+
import type { PatchLintCheckJsCompilerOptions, PatchLintConfig } from '../types/config.js';
|
|
17
21
|
/**
|
|
18
22
|
* Runs TypeScript's checkJs pass on patch-owned `.sys.mjs` files.
|
|
19
23
|
*
|
|
@@ -28,6 +32,18 @@ import type { PatchLintIssue } from '../types/commands/index.js';
|
|
|
28
32
|
* @param projectRoot - Absolute project root for resolving `extraShimPath`.
|
|
29
33
|
* Defaults to `repoDir` for back-compat with callers that don't
|
|
30
34
|
* pass an extra shim (no resolution actually happens in that case).
|
|
35
|
+
* @param mode - When `strict` is true, enables `strict` and `noImplicitAny`
|
|
36
|
+
* (CI-style). Optional `compilerOptions` merges allowlisted boolean
|
|
37
|
+
* overrides after that preset (from `patchLint.checkJsCompilerOptions`).
|
|
38
|
+
* Omitted or `{ strict: false }` preserves the historical loose preset.
|
|
31
39
|
* @returns Array of lint issues from TS diagnostics
|
|
32
40
|
*/
|
|
33
|
-
export declare function runCheckJs(repoDir: string, patchOwnedFiles: Set<string>, extraShimPath?: string, projectRoot?: string
|
|
41
|
+
export declare function runCheckJs(repoDir: string, patchOwnedFiles: Set<string>, extraShimPath?: string, projectRoot?: string, mode?: {
|
|
42
|
+
strict: boolean;
|
|
43
|
+
compilerOptions?: PatchLintCheckJsCompilerOptions;
|
|
44
|
+
}): Promise<PatchLintIssue[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Invokes {@link runCheckJs} for a `patchLint` block with `checkJs: true`.
|
|
47
|
+
* `projectRoot` is the FireForge project root (`dirname(engine)`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function invokePatchLintCheckJs(repoDir: string, patchOwnedFiles: Set<string>, patchLint: PatchLintConfig, projectRoot: string): Promise<PatchLintIssue[]>;
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* diagnostic code list now live in `typecheck-shim.ts` and are shared
|
|
14
14
|
* with the whole-project `fireforge typecheck` command — keeping a
|
|
15
15
|
* single source of truth for the Firefox-globals coverage.
|
|
16
|
+
* `patchLint.checkJsStrict` only tightens `strict` / `noImplicitAny`
|
|
17
|
+
* and optional allowlisted `checkJsCompilerOptions`; it does not change
|
|
18
|
+
* shim composition or suppressed diagnostic codes.
|
|
16
19
|
*/
|
|
17
20
|
import { resolve } from 'node:path';
|
|
18
21
|
import { pathExists } from '../utils/fs.js';
|
|
@@ -35,9 +38,13 @@ import { composeShimSource, SHIM_FILENAME, SUPPRESSED_DIAGNOSTIC_CODES } from '.
|
|
|
35
38
|
* @param projectRoot - Absolute project root for resolving `extraShimPath`.
|
|
36
39
|
* Defaults to `repoDir` for back-compat with callers that don't
|
|
37
40
|
* pass an extra shim (no resolution actually happens in that case).
|
|
41
|
+
* @param mode - When `strict` is true, enables `strict` and `noImplicitAny`
|
|
42
|
+
* (CI-style). Optional `compilerOptions` merges allowlisted boolean
|
|
43
|
+
* overrides after that preset (from `patchLint.checkJsCompilerOptions`).
|
|
44
|
+
* Omitted or `{ strict: false }` preserves the historical loose preset.
|
|
38
45
|
* @returns Array of lint issues from TS diagnostics
|
|
39
46
|
*/
|
|
40
|
-
export async function runCheckJs(repoDir, patchOwnedFiles, extraShimPath, projectRoot) {
|
|
47
|
+
export async function runCheckJs(repoDir, patchOwnedFiles, extraShimPath, projectRoot, mode) {
|
|
41
48
|
if (patchOwnedFiles.size === 0)
|
|
42
49
|
return [];
|
|
43
50
|
// Dynamic import — typescript stays as a dev dependency
|
|
@@ -93,11 +100,28 @@ export async function runCheckJs(repoDir, patchOwnedFiles, extraShimPath, projec
|
|
|
93
100
|
}
|
|
94
101
|
const shimPath = resolve(repoDir, SHIM_FILENAME);
|
|
95
102
|
rootFiles.push(shimPath);
|
|
103
|
+
const strict = mode?.strict === true;
|
|
104
|
+
const strictness = strict
|
|
105
|
+
? { strict: true, noImplicitAny: true }
|
|
106
|
+
: {
|
|
107
|
+
// Loose default — implicit `any` is allowed unless `patchLint.checkJsStrict`.
|
|
108
|
+
strict: false,
|
|
109
|
+
noImplicitAny: false,
|
|
110
|
+
};
|
|
111
|
+
const overrides = {};
|
|
112
|
+
const co = mode?.compilerOptions;
|
|
113
|
+
if (co) {
|
|
114
|
+
for (const key of Object.keys(co)) {
|
|
115
|
+
const v = co[key];
|
|
116
|
+
if (v !== undefined) {
|
|
117
|
+
overrides[key] = v;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
96
121
|
const options = {
|
|
97
122
|
allowJs: true,
|
|
98
123
|
checkJs: true,
|
|
99
124
|
noEmit: true,
|
|
100
|
-
strict: false,
|
|
101
125
|
target: ts.ScriptTarget.ESNext,
|
|
102
126
|
module: ts.ModuleKind.ESNext,
|
|
103
127
|
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
@@ -108,10 +132,8 @@ export async function runCheckJs(repoDir, patchOwnedFiles, extraShimPath, projec
|
|
|
108
132
|
// resource:// and chrome:// import, flooding the output with
|
|
109
133
|
// "Cannot find module" errors for upstream Firefox modules.
|
|
110
134
|
noResolve: true,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// errors defeats the purpose of a focused check.
|
|
114
|
-
noImplicitAny: false,
|
|
135
|
+
...strictness,
|
|
136
|
+
...overrides,
|
|
115
137
|
};
|
|
116
138
|
// Custom compiler host: reads patch-owned files from disk, returns
|
|
117
139
|
// the shim for the shim path, and returns empty content for
|
|
@@ -189,4 +211,15 @@ export async function runCheckJs(repoDir, patchOwnedFiles, extraShimPath, projec
|
|
|
189
211
|
verbose(`checkJs: analyzed ${rootFiles.length - 1} file(s), found ${issues.length} issue(s)`);
|
|
190
212
|
return issues;
|
|
191
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Invokes {@link runCheckJs} for a `patchLint` block with `checkJs: true`.
|
|
216
|
+
* `projectRoot` is the FireForge project root (`dirname(engine)`).
|
|
217
|
+
*/
|
|
218
|
+
export async function invokePatchLintCheckJs(repoDir, patchOwnedFiles, patchLint, projectRoot) {
|
|
219
|
+
const strict = patchLint.checkJsStrict === true;
|
|
220
|
+
const mode = strict && patchLint.checkJsCompilerOptions
|
|
221
|
+
? { strict, compilerOptions: patchLint.checkJsCompilerOptions }
|
|
222
|
+
: { strict };
|
|
223
|
+
return runCheckJs(repoDir, patchOwnedFiles, patchLint.checkJsExtraShim, projectRoot, mode);
|
|
224
|
+
}
|
|
192
225
|
//# sourceMappingURL=patch-lint-checkjs.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public re-exports for {@link ./patch-lint.ts}. Split out so the
|
|
3
|
+
* orchestrator stays within the ESLint `max-lines` budget.
|
|
4
|
+
*/
|
|
5
|
+
export { runCheckJs } from './patch-lint-checkjs.js';
|
|
6
|
+
export { buildPatchQueueContext, collectNewFileCreatorsByPath, type ExtractedSpecifier, extractImportSpecifiers, extractImportSpecifiersWithLines, findForwardImportIgnoreLines, FORWARD_IMPORT_IGNORE_MARKER, isForwardImportableFile, lintPatchQueue, lintPatchQueueDuplicateCreations, lintPatchQueueForwardImports, type PatchQueueContext, type PatchQueueEntry, } from './patch-lint-cross.js';
|
|
7
|
+
export { buildModifiedFileAdditionsFromDiff, detectNewFilesInDiff } from './patch-lint-diff.js';
|
|
8
|
+
export { type JsDocCheck, type JsDocIssue, validateExportJsDoc } from './patch-lint-jsdoc.js';
|
|
9
|
+
export { resolvePatchOwnedChromeScripts, resolvePatchOwnedSysMjs } from './patch-lint-ownership.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EUPL-1.2
|
|
2
|
+
/**
|
|
3
|
+
* Public re-exports for {@link ./patch-lint.ts}. Split out so the
|
|
4
|
+
* orchestrator stays within the ESLint `max-lines` budget.
|
|
5
|
+
*/
|
|
6
|
+
export { runCheckJs } from './patch-lint-checkjs.js';
|
|
7
|
+
export { buildPatchQueueContext, collectNewFileCreatorsByPath, extractImportSpecifiers, extractImportSpecifiersWithLines, findForwardImportIgnoreLines, FORWARD_IMPORT_IGNORE_MARKER, isForwardImportableFile, lintPatchQueue, lintPatchQueueDuplicateCreations, lintPatchQueueForwardImports, } from './patch-lint-cross.js';
|
|
8
|
+
export { buildModifiedFileAdditionsFromDiff, detectNewFilesInDiff } from './patch-lint-diff.js';
|
|
9
|
+
export { validateExportJsDoc } from './patch-lint-jsdoc.js';
|
|
10
|
+
export { resolvePatchOwnedChromeScripts, resolvePatchOwnedSysMjs } from './patch-lint-ownership.js';
|
|
11
|
+
//# sourceMappingURL=patch-lint-reexports.js.map
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { PatchLintIssue } from '../types/commands/index.js';
|
|
2
2
|
import type { FireForgeConfig } from '../types/config.js';
|
|
3
3
|
import { type CommentStyle } from './license-headers.js';
|
|
4
|
-
export
|
|
5
|
-
export { buildPatchQueueContext, collectNewFileCreatorsByPath, type ExtractedSpecifier, extractImportSpecifiers, extractImportSpecifiersWithLines, findForwardImportIgnoreLines, FORWARD_IMPORT_IGNORE_MARKER, isForwardImportableFile, lintPatchQueue, lintPatchQueueDuplicateCreations, lintPatchQueueForwardImports, type PatchQueueContext, type PatchQueueEntry, } from './patch-lint-cross.js';
|
|
6
|
-
export { buildModifiedFileAdditionsFromDiff, detectNewFilesInDiff } from './patch-lint-diff.js';
|
|
7
|
-
export { type JsDocCheck, type JsDocIssue, validateExportJsDoc } from './patch-lint-jsdoc.js';
|
|
8
|
-
export { resolvePatchOwnedChromeScripts, resolvePatchOwnedSysMjs } from './patch-lint-ownership.js';
|
|
4
|
+
export * from './patch-lint-reexports.js';
|
|
9
5
|
/**
|
|
10
6
|
* Counts the total lines in a unified diff and the number of non-binary
|
|
11
7
|
* text lines, so binary hunks do not inflate patch size checks.
|
|
@@ -6,7 +6,7 @@ import { verbose } from '../utils/logger.js';
|
|
|
6
6
|
import { hasRawCssColors, stripJsComments } from '../utils/regex.js';
|
|
7
7
|
import { loadFurnaceConfig } from './furnace-config.js';
|
|
8
8
|
import { containsUpstreamLicenseText, getLicenseHeader, hasAnyLicenseHeader, hasAnyLicenseHeaderAnyStyle, } from './license-headers.js';
|
|
9
|
-
import {
|
|
9
|
+
import { invokePatchLintCheckJs } from './patch-lint-checkjs.js';
|
|
10
10
|
import { lintChromeScriptJsDocForFile } from './patch-lint-chrome-jsdoc.js';
|
|
11
11
|
import { detectNewFilesInDiff, extractAddedLinesPerFile } from './patch-lint-diff.js';
|
|
12
12
|
import { AGGREGATE_PATCH_FILE } from './patch-lint-diff-tag.js';
|
|
@@ -20,12 +20,9 @@ import { resolvePatchOwnedChromeScripts, resolvePatchOwnedSysMjs } from './patch
|
|
|
20
20
|
// creation and forward-import rules, ignore marker) lives in
|
|
21
21
|
// `patch-lint-cross.ts` so the per-patch and cross-patch rule bodies can
|
|
22
22
|
// each stay within the project's per-file line budget. Re-export the
|
|
23
|
-
// public surface so callers continue to
|
|
24
|
-
|
|
25
|
-
export
|
|
26
|
-
export { buildModifiedFileAdditionsFromDiff, detectNewFilesInDiff } from './patch-lint-diff.js';
|
|
27
|
-
export { validateExportJsDoc } from './patch-lint-jsdoc.js';
|
|
28
|
-
export { resolvePatchOwnedChromeScripts, resolvePatchOwnedSysMjs } from './patch-lint-ownership.js';
|
|
23
|
+
// public surface from `patch-lint-reexports.ts` so callers continue to
|
|
24
|
+
// import from a single module.
|
|
25
|
+
export * from './patch-lint-reexports.js';
|
|
29
26
|
// ---------------------------------------------------------------------------
|
|
30
27
|
// Helpers
|
|
31
28
|
// ---------------------------------------------------------------------------
|
|
@@ -737,12 +734,8 @@ export async function lintExportedPatch(repoDir, affectedFiles, diffContent, con
|
|
|
737
734
|
...jsIssues,
|
|
738
735
|
...modCommentIssues,
|
|
739
736
|
];
|
|
740
|
-
// Optional checkJs pass — only when explicitly enabled in config.
|
|
741
|
-
// `checkJsExtraShim` is project-relative; resolve against the
|
|
742
|
-
// project root (dirname(engine) by getProjectPaths convention).
|
|
743
737
|
if (config.patchLint?.checkJs) {
|
|
744
|
-
|
|
745
|
-
issues.push(...(await runCheckJs(repoDir, patchOwnedFiles, extraShim, dirname(repoDir))));
|
|
738
|
+
issues.push(...(await invokePatchLintCheckJs(repoDir, patchOwnedFiles, config.patchLint, dirname(repoDir))));
|
|
746
739
|
}
|
|
747
740
|
// Filter out ignored checks last so every rule still runs (keeps the
|
|
748
741
|
// implementation uniform) but suppressed rules do not surface. We do not
|
|
@@ -89,12 +89,40 @@ export interface WireConfig {
|
|
|
89
89
|
* `'warning'` and `'error'` emit issues at the matching severity.
|
|
90
90
|
*/
|
|
91
91
|
export type PatchLintSeverityGate = 'off' | 'warning' | 'error';
|
|
92
|
+
/**
|
|
93
|
+
* Allowlisted TypeScript `compilerOptions` overrides for the patch
|
|
94
|
+
* `checkJs` pass when {@link PatchLintConfig.checkJsStrict} is true.
|
|
95
|
+
* Merged after the strict preset; only boolean flags — no `paths`,
|
|
96
|
+
* `rootDir`, or other options that would fight the synthetic program.
|
|
97
|
+
*/
|
|
98
|
+
export interface PatchLintCheckJsCompilerOptions {
|
|
99
|
+
strictNullChecks?: boolean;
|
|
100
|
+
strictFunctionTypes?: boolean;
|
|
101
|
+
strictBindCallApply?: boolean;
|
|
102
|
+
noImplicitThis?: boolean;
|
|
103
|
+
useUnknownInCatchVariables?: boolean;
|
|
104
|
+
strictPropertyInitialization?: boolean;
|
|
105
|
+
noUnusedLocals?: boolean;
|
|
106
|
+
noUnusedParameters?: boolean;
|
|
107
|
+
}
|
|
92
108
|
/**
|
|
93
109
|
* Configuration for patch lint rules.
|
|
94
110
|
*/
|
|
95
111
|
export interface PatchLintConfig {
|
|
96
112
|
/** Enable TypeScript checkJs pass on patch-owned .sys.mjs files */
|
|
97
113
|
checkJs?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* When true with `checkJs: true`, run checkJs with `strict` and
|
|
116
|
+
* `noImplicitAny` enabled (CI-style). Default false preserves the
|
|
117
|
+
* historical loose preset. Optional {@link checkJsCompilerOptions}
|
|
118
|
+
* can relax individual strict flags (e.g. `strictNullChecks: false`).
|
|
119
|
+
*/
|
|
120
|
+
checkJsStrict?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Boolean overrides merged after the strict preset; only valid when
|
|
123
|
+
* `checkJsStrict` is true. Requires `checkJs: true`.
|
|
124
|
+
*/
|
|
125
|
+
checkJsCompilerOptions?: PatchLintCheckJsCompilerOptions;
|
|
98
126
|
/**
|
|
99
127
|
* Project-relative path to an additional `.d.ts` file whose contents
|
|
100
128
|
* are concatenated to the built-in `FIREFOX_GLOBALS_SHIM` for the
|