Separate out prettier and ESLint to run as different processes
Categories
(Developer Infrastructure :: Lint and Formatting, task, P2)
Tracking
(firefox114 fixed)
Tracking | Status | |
---|---|---|
firefox114 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file, 1 obsolete file)
Running ESLint with prettier integrated as part of it causes several issues:
- eslint-plugin-html and prettier conflict if prettier is enabled on html files, causing inconsistent formatting.
- We are unable to run separate formatting only linters (xref bug 1803229).
- Prettier itself recommends against integrating the two. Quoting:
You end up with a lot of red squiggly lines in your editor, which gets annoying. Prettier is supposed to make you forget about formatting – and not be in your face about it!
They are slower than running Prettier directly.
They’re yet one layer of indirection where things may break.
Hence I think we should work towards separating these. From a configuration perspective it should be reasonably simple, the biggest part will be getting the commands hooked up right so as not to break workflows.
Assignee | ||
Comment 1•2 years ago
|
||
Actually, I think this bug should only separate the config & make ESLint and prettier run as separate commands behind the scenes - so that everything is the same from a developer's perspective.
Bug 1807711 should look at whatever ./mach <command>
changes are necessary for what is required there.
Assignee | ||
Comment 2•2 years ago
|
||
One downside here, is that prettier only supports one ignore file (the .prettierignore
), and not importing from other files. Something like that would require changes in prettier. That's currently stalled, but maybe we can cope with merging the files for now, and maybe see if we can help that move forward.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Assignee | ||
Comment 5•2 years ago
|
||
Depends on D174762
Updated•2 years ago
|
Comment 7•2 years ago
|
||
bugherder |
Comment 8•2 years ago
|
||
It seems now if I try to use await
in a non-async function I get an error message from prettier: SyntaxError: Unexpected token, expected ";"
IIRC earlier it told you pretty clearly "await can only be used in async functions" or something like this.
Are they run in the right order? Or are there ways to improve this?
Assignee | ||
Comment 9•2 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #8)
It seems now if I try to use
await
in a non-async function I get an error message from prettier: SyntaxError: Unexpected token, expected ";"
IIRC earlier it told you pretty clearly "await can only be used in async functions" or something like this.Are they run in the right order? Or are there ways to improve this?
ESlint is always run before Prettier when run via ./mach lint
.
My guess would be that you're running Prettier on the file, but not ESLint. Maybe it is ignored in comm-central's .eslintignore
but hasn't been added to .prettierignore
? One of the later follow-ups is to fix that duplication (bug 1825508).
Description
•