Page MenuHomePhabricator

Add a prettier linter for the web tools
ClosedPublic

Authored by Fabien on Nov 20 2020, 10:05.

Details

Reviewers
deadalnix
bytesofman
Group Reviewers
Restricted Project
Commits
rABC7577f721476c: Add a prettier linter for the web tools
Summary

This diff adds a web/ directory at the project root and a new linter
running prettier on all the Javascript files from this directory.

Test Plan

Follow the installation instructions from CONTRIBUTING.md.
Add a web/dummy.js file to the source tree with some Javascript
content, then:

arc lint --trace

Check the prettier linter is run.

Edit the web/.prettierrc file to set the tab width to 4.

arc lint

Check the web/dummy.js file is updated accordingly.

Event Timeline

Fabien requested review of this revision.Nov 20 2020, 10:05
deadalnix requested changes to this revision.Nov 20 2020, 14:36
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
.arclint
278 ↗(On Diff #25904)

It's nto just js, css, scss and so on are good candidates.

.gitignore
86 ↗(On Diff #25904)
web/.prettierrc
2 ↗(On Diff #25904)

The rest of the codebase use 80

4 ↗(On Diff #25904)

We use 4 in the rest of the codebase.

7 ↗(On Diff #25904)

quoteProps: consistent
arrowParens: avoid

This revision now requires changes to proceed.Nov 20 2020, 14:36
deadalnix requested changes to this revision.Nov 21 2020, 13:14

Back to your plate, this clearly hasn't been thought through.

.arclint
279 ↗(On Diff #25939)

I don't think this really make any sense.

This revision now requires changes to proceed.Nov 21 2020, 13:14

Don't lint everything but only the common web file extensions.

bytesofman added inline comments.
CONTRIBUTING.md
180 ↗(On Diff #25962)

npm is included with nodejs. For web development with node, nvm is an important tool. I think lines 171-180 should read:

Contributing to web projects

If you intend to contribute to web projects, you will need nodejs. Follow the installation instructions here to install node with node version manager. Then,

cd bitcoin-abc
npm i -g prettier
Fabien planned changes to this revision.Nov 23 2020, 19:00

Use a globaly installed prettier and update doc accordingly.

Add more extensions so we're future proof.

Looks good to me. We may see additional needs here as more web repositories are added, but I think this is an appropriate starting point.

This revision is now accepted and ready to land.Nov 24 2020, 00:20
This revision was automatically updated to reflect the committed changes.