Closed Bug 1610923 Opened 5 years ago Closed 5 years ago

Point npm run testmc to use mach to avoid error with linting

Categories

(Firefox :: New Tab Page, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 74
Iteration:
74.2 - Jan 20 - Feb 09
Tracking Status
firefox-esr68 --- unaffected
firefox72 --- unaffected
firefox73 --- unaffected
firefox74 --- fixed

People

(Reporter: thecount, Assigned: Mardak)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

From inside /browser/components/newtab

If you try to run npm run testmc

You get and error:

Error: Cannot read config file: /home/scott/mozilla-central/.eslintrc.js
Error: ENOENT: no such file or directory, open 'tools/rewriting/ThirdPartyPaths.txt'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Object.<anonymous> (/home/scott/mozilla-central/.eslintrc.js:37:9)
    at Module._compile (/home/scott/mozilla-central/browser/components/newtab/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (/home/scott/mozilla-central/browser/components/newtab/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
Failed to parse JSON:
Unexpected end of JSON input

I ran a bisect and found https://bugzilla.mozilla.org/show_bug.cgi?id=1607172 to be the first instance of this issue.

This fails because the m-c/.eslintrc.js is loaded when running m-c/browser/components/newtab/node_modules/.bin/eslint. I suppose a couple possible fixes could involve setting root: true from browser/components/newtab/.eslintrc.js or have m-c/.eslintrc.js add ignores only when invoked at m-c root.

Separately, this shows that browser/components/newtab$ npm run lint:eslint isn't run by automation (https://searchfox.org/mozilla-central/source/browser/components/newtab/bin/try-runner.js) which currently does karma and sasslint; and presumably not eslint because it is normally covered by ./mach lint

Regressed by: 1607172
Has Regression Range: --- → yes
Assignee: nobody → standard8
Status: NEW → ASSIGNED

Ed, I've not tested the patch with newtab code, but I think it'd probably work... feel free to land it if there's no changes required.

Flags: needinfo?(edilee)

Ah meh this current patch then runs into a related issue that browser/components/newtab/package.json says eslint@6.2.2 resulting in:

Error: ESLint configuration in ../../../.eslintrc.js is invalid:
	- Unexpected top-level property "ignorePatterns".

Maybe the more interesting question (but probably unblock local-dev newtab eslint failing first) is whether browser/components/newtab should even be doing eslint/prettier separately from ./mach lint anymore given that development is only happening from the context of mozilla-central now. This would avoid needing to keep eslint version matching root, and potentially we could just have npm run lint:eslint call mach lint -l eslint browser/components/newtab… ?

Flags: needinfo?(edilee)

(In reply to Ed Lee :Mardak from comment #4)

Maybe the more interesting question (but probably unblock local-dev newtab eslint failing first) is whether browser/components/newtab should even be doing eslint/prettier separately from ./mach lint anymore given that development is only happening from the context of mozilla-central now. This would avoid needing to keep eslint version matching root, and potentially we could just have npm run lint:eslint call mach lint -l eslint browser/components/newtab… ?

If everything is happening in m-c now, then I think it'd definitely be worth changing it. It looks like it is all linted from the top-level of m-c anyway. Maybe keep the browser/components/newtab/.eslintrc.js as it is for now, but drop the associated .eslintignore.

If you wanted the quick developer fix, then you could probably just change that npm command, and remove ESLint from package.json later?

Ah, I skimmed too fast; never mind! Marking my comment obsolete.

I'll fix up the command and maybe clean up a little bit. This only affects a few devs right now who can workaround by doing npm run testmc:unit to skip the lint step.

Assignee: standard8 → edilee
Iteration: --- → 74.2 - Jan 20 - Feb 09
Component: Lint and Formatting → New Tab Page
Priority: -- → P1
Product: Firefox Build System → Firefox
Summary: npm run testmc error with linting → Point npm run testmc to use mach to avoid error with linting

Depends on D60757

Attachment #9122754 - Attachment is obsolete: true
Pushed by elee@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/234c4a6c77aa
When loading files for ignoring lists in ESLint, use the absolute path. r=Mardak
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 74
Pushed by elee@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/31addc1c7666
Point npm run testmc to use mach to avoid error with linting r=thecount
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: