@hominis/fireforge 0.13.0 → 0.13.1
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
CHANGED
|
@@ -188,30 +188,30 @@ If the manifest drifts after an interrupted export or manual edits, `fireforge i
|
|
|
188
188
|
|
|
189
189
|
`fireforge lint` runs automatically during export, export-all and re-export. Use `--skip-lint` to downgrade errors to warnings. Errors block the export; warnings are printed but do not block.
|
|
190
190
|
|
|
191
|
-
| Check | Scope
|
|
192
|
-
| ------------------------------ |
|
|
193
|
-
| `missing-license-header` | New files (JS/CSS/FTL)
|
|
194
|
-
| `relative-import` | JS/MJS files
|
|
195
|
-
| `token-prefix-violation` | CSS files (with furnace)
|
|
196
|
-
| `raw-color-value` | Introduced CSS color values
|
|
197
|
-
| `duplicate-new-file-creation` | Same path created by multiple patches
|
|
198
|
-
| `forward-import` | Patch imports from a later-patch file
|
|
199
|
-
| `missing-jsdoc` | Exports in patch-owned `.sys.mjs`
|
|
200
|
-
| `jsdoc-param-mismatch` | Exports in patch-owned `.sys.mjs`
|
|
201
|
-
| `jsdoc-missing-returns` | Exports in patch-owned `.sys.mjs`
|
|
202
|
-
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in)
|
|
203
|
-
| `missing-modification-comment` | Modified upstream JS/MJS
|
|
204
|
-
| `modified-file-missing-header` | Modified upstream files (JS/CSS/FTL)
|
|
205
|
-
| `file-too-large` | New files (tiered: 500/750/900 general, 1200/1400/1600 test)
|
|
206
|
-
| `observer-topic-naming` | Observer topics with binaryName
|
|
207
|
-
| `large-patch-files` | Patches affecting >5 files
|
|
208
|
-
| `large-patch-lines` | Patch line count (tiered: 800/1500/3000 general, 1500/3000/6000 test)
|
|
191
|
+
| Check | Scope | Severity |
|
|
192
|
+
| ------------------------------ | ------------------------------------------------------------------------- | ------------------------ |
|
|
193
|
+
| `missing-license-header` | New files (JS/CSS/FTL) | error |
|
|
194
|
+
| `relative-import` | JS/MJS files | error |
|
|
195
|
+
| `token-prefix-violation` | CSS files (with furnace) | error |
|
|
196
|
+
| `raw-color-value` | Introduced CSS color values (allowlist via `patchLint.rawColorAllowlist`) | error |
|
|
197
|
+
| `duplicate-new-file-creation` | Same path created by multiple patches | error |
|
|
198
|
+
| `forward-import` | Patch imports from a later-patch file | error |
|
|
199
|
+
| `missing-jsdoc` | Exports in patch-owned `.sys.mjs` | error |
|
|
200
|
+
| `jsdoc-param-mismatch` | Exports in patch-owned `.sys.mjs` | error |
|
|
201
|
+
| `jsdoc-missing-returns` | Exports in patch-owned `.sys.mjs` | error |
|
|
202
|
+
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in) | error |
|
|
203
|
+
| `missing-modification-comment` | Modified upstream JS/MJS | warning |
|
|
204
|
+
| `modified-file-missing-header` | Modified upstream files (JS/CSS/FTL) | warning |
|
|
205
|
+
| `file-too-large` | New files (tiered: 500/750/900 general, 1200/1400/1600 test) | notice / warning / error |
|
|
206
|
+
| `observer-topic-naming` | Observer topics with binaryName | warning |
|
|
207
|
+
| `large-patch-files` | Patches affecting >5 files | warning |
|
|
208
|
+
| `large-patch-lines` | Patch line count (tiered: 800/1500/3000 general, 1500/3000/6000 test) | notice / warning / error |
|
|
209
209
|
|
|
210
210
|
**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.
|
|
211
211
|
|
|
212
212
|
**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. This pass solely focuses on type errors within the patch-owned code itself (mismatched JSDoc types, wrong argument counts, unreachable code, etc.).
|
|
213
213
|
|
|
214
|
-
The two cross-patch rules (`duplicate-new-file-creation` and `forward-import`) run over the whole patch queue rather than a single diff, catching ordering issues that only surface during `import`. Forward-import detection compares leaf filenames, so a false positive is theoretically possible when two patches create files with the same basename in different directories. Suppress with an inline `// fireforge-ignore: forward-import` comment on or above the import line.
|
|
214
|
+
The two cross-patch rules (`duplicate-new-file-creation` and `forward-import`) run over the whole patch queue rather than a single diff, catching ordering issues that only surface during `import`. Forward-import detection compares leaf filenames, so a false positive is theoretically possible when two patches create files with the same basename in different directories. Suppress with an inline `// fireforge-ignore: forward-import` comment on or above the import line. Both `forward-import` and `raw-color-value` support inline suppression comments (`// fireforge-ignore: forward-import` and `/* fireforge-ignore: raw-color-value */` respectively).
|
|
215
215
|
|
|
216
216
|
</details>
|
|
217
217
|
|
|
@@ -360,7 +360,11 @@ fireforge token --name "--my-color" --value "light-dark(#fff, #000)"
|
|
|
360
360
|
"product": "firefox-esr"
|
|
361
361
|
},
|
|
362
362
|
"build": { "jobs": 8 },
|
|
363
|
-
"wire": { "subscriptDir": "browser/components/mybrowser" }
|
|
363
|
+
"wire": { "subscriptDir": "browser/components/mybrowser" },
|
|
364
|
+
"patchLint": {
|
|
365
|
+
"checkJs": true,
|
|
366
|
+
"rawColorAllowlist": ["hominis-tokens.css"]
|
|
367
|
+
}
|
|
364
368
|
}
|
|
365
369
|
```
|
|
366
370
|
|
|
@@ -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"];
|
|
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"];
|
|
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.rawColorAllowlist"];
|
|
23
23
|
/**
|
|
24
24
|
* Gets all project paths based on a root directory.
|
|
25
25
|
* @param root - Root directory of the project
|
|
@@ -118,6 +118,14 @@ export function validateConfig(data) {
|
|
|
118
118
|
}
|
|
119
119
|
config.patchLint.checkJs = checkJs;
|
|
120
120
|
}
|
|
121
|
+
const rawColorAllowlist = patchLintRec.raw('rawColorAllowlist');
|
|
122
|
+
if (rawColorAllowlist !== undefined) {
|
|
123
|
+
if (!Array.isArray(rawColorAllowlist) ||
|
|
124
|
+
rawColorAllowlist.some((v) => typeof v !== 'string')) {
|
|
125
|
+
throw new ConfigError('Config field "patchLint.rawColorAllowlist" must be an array of strings');
|
|
126
|
+
}
|
|
127
|
+
config.patchLint.rawColorAllowlist = rawColorAllowlist;
|
|
128
|
+
}
|
|
121
129
|
}
|
|
122
130
|
// Warn on unknown root keys
|
|
123
131
|
const knownRootKeys = new Set(SUPPORTED_CONFIG_ROOT_KEYS);
|
|
@@ -87,10 +87,10 @@ export async function lintPatchedCss(repoDir, affectedFiles, diffContent, config
|
|
|
87
87
|
let tokenAllowlist;
|
|
88
88
|
try {
|
|
89
89
|
const root = join(repoDir, '..');
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
tokenPrefix =
|
|
93
|
-
tokenAllowlist = new Set(
|
|
90
|
+
const furnaceConfig = await loadFurnaceConfig(root);
|
|
91
|
+
if (furnaceConfig.tokenPrefix) {
|
|
92
|
+
tokenPrefix = furnaceConfig.tokenPrefix;
|
|
93
|
+
tokenAllowlist = new Set(furnaceConfig.tokenAllowlist ?? []);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
catch (error) {
|