@hominis/fireforge 0.19.0 → 0.19.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/CHANGELOG.md +4 -0
- package/README.md +22 -22
- package/dist/src/core/license-headers.js +12 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
+
### Hardening
|
|
10
|
+
|
|
11
|
+
- **`modified-file-missing-header` — standard Mozilla MPL-2.0 block headers with wrapped line breaks.** The upstream fallback scan required a contiguous `Mozilla Public License` substring in the first few lines, so files that follow Mozilla’s usual `/* … Mozilla Public` / ` * License, v. 2.0 … */` wrap (including after Emacs/vim directive blocks) were warned despite a valid notice. `containsUpstreamLicenseText` in `src/core/license-headers.ts` now normalizes common block-comment continuation prefixes before matching, so forks need not add SPDX solely to satisfy patch lint.
|
|
12
|
+
|
|
9
13
|
## 0.18.0
|
|
10
14
|
|
|
11
15
|
### Compatibility
|
package/README.md
CHANGED
|
@@ -230,28 +230,28 @@ If the manifest drifts after an interrupted export or manual edits, `fireforge i
|
|
|
230
230
|
|
|
231
231
|
By default, a standalone `fireforge lint` (no arguments) lints the **aggregate** `git diff HEAD` — i.e. every applied patch summed — with tool-managed branding paths (`browser/branding/<binaryName>/`) excluded. A fresh-setup workspace carries a large generated branding diff that operators did not author directly, and letting it through tripped the patch-size and license-header rules on content that matches the `branding` bucket in `fireforge status`. When the exclusion fires the command prints a one-line note naming the excluded count so the filter is visible. On a repo where `fireforge import` or `fireforge rebase` has just applied the full queue, the patch-size rules (`large-patch-lines`, `large-patch-files`) fire against the sum, which reads as "my queue is broken" when it is really an artefact of aggregation. Use `fireforge lint --per-patch` to rescope the diff to each patch's own `filesAffected`, honouring the patch's own `lintIgnore`. Cross-patch rules (`duplicate-new-file-creation`, `forward-import`) still run once over the whole queue either way. Pass explicit file paths to narrow the scope further — explicit-path mode does lint branding files (the operator's explicit request wins over the branding exclusion); the three modes (aggregate, file-scoped, per-patch) are mutually exclusive.
|
|
232
232
|
|
|
233
|
-
| Check | Scope
|
|
234
|
-
| ------------------------------------ |
|
|
235
|
-
| `missing-license-header` | New files (JS/CSS/FTL)
|
|
236
|
-
| `relative-import` | JS/MJS files
|
|
237
|
-
| `token-prefix-violation` | CSS files (with furnace)
|
|
238
|
-
| `raw-color-value` | Introduced CSS color values (allowlist via `patchLint.rawColorAllowlist`)
|
|
239
|
-
| `duplicate-new-file-creation` | Same path created by multiple patches
|
|
240
|
-
| `forward-import` | Patch imports from a later-patch file
|
|
241
|
-
| `missing-jsdoc` | Exports in patch-owned `.sys.mjs`
|
|
242
|
-
| `jsdoc-param-mismatch` | Exports in patch-owned `.sys.mjs`
|
|
243
|
-
| `jsdoc-missing-returns` | Exports in patch-owned `.sys.mjs`
|
|
244
|
-
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in `patchLint.checkJs`)
|
|
245
|
-
| `missing-jsdoc-class-method` | Class-method exports in patch-owned `.sys.mjs` (opt-in)
|
|
246
|
-
| `jsdoc-class-method-param-mismatch` | Class-method exports in patch-owned `.sys.mjs` (opt-in)
|
|
247
|
-
| `jsdoc-class-method-missing-returns` | Class-method exports in patch-owned `.sys.mjs` (opt-in)
|
|
248
|
-
| `test-needs-assertion` | Patch-introduced `browser_*.js` test files (opt-in)
|
|
249
|
-
| `missing-modification-comment` | Modified upstream JS/MJS
|
|
250
|
-
| `modified-file-missing-header` | Modified upstream files (JS/CSS/FTL)
|
|
251
|
-
| `file-too-large` | New files (tiered: 500/750/900 general, 1200/1400/1600 test)
|
|
252
|
-
| `observer-topic-naming` | Observer topics with binaryName
|
|
253
|
-
| `large-patch-files` | Patches affecting many files (tiered: >5 general, >5 test, >60 branding)
|
|
254
|
-
| `large-patch-lines` | Patch line count (tiered: 800/1500/3000 general, 1500/3000/6000 test, 8000/18000/30000 branding)
|
|
233
|
+
| Check | Scope | Severity |
|
|
234
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------- | ------------------------ |
|
|
235
|
+
| `missing-license-header` | New files (JS/CSS/FTL) | error |
|
|
236
|
+
| `relative-import` | JS/MJS files | error |
|
|
237
|
+
| `token-prefix-violation` | CSS files (with furnace) | error |
|
|
238
|
+
| `raw-color-value` | Introduced CSS color values (allowlist via `patchLint.rawColorAllowlist`) | error |
|
|
239
|
+
| `duplicate-new-file-creation` | Same path created by multiple patches | error |
|
|
240
|
+
| `forward-import` | Patch imports from a later-patch file | error |
|
|
241
|
+
| `missing-jsdoc` | Exports in patch-owned `.sys.mjs` | error |
|
|
242
|
+
| `jsdoc-param-mismatch` | Exports in patch-owned `.sys.mjs` | error |
|
|
243
|
+
| `jsdoc-missing-returns` | Exports in patch-owned `.sys.mjs` | error |
|
|
244
|
+
| `checkjs-type-error` | Patch-owned `.sys.mjs` (opt-in `patchLint.checkJs`) | error |
|
|
245
|
+
| `missing-jsdoc-class-method` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
246
|
+
| `jsdoc-class-method-param-mismatch` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
247
|
+
| `jsdoc-class-method-missing-returns` | Class-method exports in patch-owned `.sys.mjs` (opt-in) | configurable |
|
|
248
|
+
| `test-needs-assertion` | Patch-introduced `browser_*.js` test files (opt-in) | configurable |
|
|
249
|
+
| `missing-modification-comment` | Modified upstream JS/MJS | warning |
|
|
250
|
+
| `modified-file-missing-header` | Modified upstream files (JS/CSS/FTL); Mozilla MPL-2.0 `/* */` headers with wrapped lines are recognized | warning |
|
|
251
|
+
| `file-too-large` | New files (tiered: 500/750/900 general, 1200/1400/1600 test) | notice / warning / error |
|
|
252
|
+
| `observer-topic-naming` | Observer topics with binaryName | warning |
|
|
253
|
+
| `large-patch-files` | Patches affecting many files (tiered: >5 general, >5 test, >60 branding) | warning |
|
|
254
|
+
| `large-patch-lines` | Patch line count (tiered: 800/1500/3000 general, 1500/3000/6000 test, 8000/18000/30000 branding) | notice / warning / error |
|
|
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
|
|
|
@@ -129,6 +129,16 @@ export function hasAnyLicenseHeaderAnyStyle(content) {
|
|
|
129
129
|
const styles = ['js', 'css', 'hash'];
|
|
130
130
|
return styles.some((style) => hasAnyLicenseHeader(content, style));
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Collapses block-comment continuation lines (`\n` + ` * ` prefixes) so
|
|
134
|
+
* substring markers like `Mozilla Public License` match Mozilla's wrapped
|
|
135
|
+
* MPL boilerplate.
|
|
136
|
+
*/
|
|
137
|
+
function normalizeLicenseHeadForScan(head) {
|
|
138
|
+
let s = head.replace(/\r\n?/g, '\n');
|
|
139
|
+
s = s.replace(/\n[ \t]*\*[ \t]*/g, ' ');
|
|
140
|
+
return s.replace(/\s+/g, ' ').trim();
|
|
141
|
+
}
|
|
132
142
|
/**
|
|
133
143
|
* Returns true if the first few lines of `content` contain a recognized
|
|
134
144
|
* upstream license identifier string.
|
|
@@ -138,6 +148,7 @@ export function hasAnyLicenseHeaderAnyStyle(content) {
|
|
|
138
148
|
*/
|
|
139
149
|
export function containsUpstreamLicenseText(content, maxLines = 10) {
|
|
140
150
|
const head = content.split('\n').slice(0, maxLines).join('\n');
|
|
151
|
+
const scanText = normalizeLicenseHeadForScan(head);
|
|
141
152
|
const markers = [
|
|
142
153
|
'Mozilla Public License',
|
|
143
154
|
'SPDX-License-Identifier',
|
|
@@ -145,7 +156,7 @@ export function containsUpstreamLicenseText(content, maxLines = 10) {
|
|
|
145
156
|
'MIT License',
|
|
146
157
|
'GNU General Public License',
|
|
147
158
|
];
|
|
148
|
-
return markers.some((marker) =>
|
|
159
|
+
return markers.some((marker) => scanText.includes(marker));
|
|
149
160
|
}
|
|
150
161
|
/**
|
|
151
162
|
* Prepends the license header to a file on disk if it is not already present.
|