Page MenuHomePhabricator

Add a prettier linter for the web tools
ClosedPublic

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

Details

Reviewers
deadalnix
josephroyking
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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien requested review of this revision.Fri, Nov 20, 10:05
deadalnix requested changes to this revision.Fri, Nov 20, 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.Fri, Nov 20, 14:36
deadalnix requested changes to this revision.Sat, Nov 21, 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.Sat, Nov 21, 13:14

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

josephroyking 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.Mon, Nov 23, 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.Tue, Nov 24, 00:20
This revision was automatically updated to reflect the committed changes.