Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eslint, prettier, and re-format JS #213

Merged
merged 3 commits into from
May 25, 2020
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Apr 3, 2020

This pulls in the same lint/format method used for ipywidgets, though there are a few differences to minimize changes.

  • TypeScript isn't used, so I left out any typescript lint config/plugins.
  • Since you've used the spread operation, I've set ECMA version to 9, though it could be set to anything later if you wish.
  • Prettier is set to use 4-space tab width for existing files (except package*.json which is already 2-space), or else I've have to rewrite basically everything.

Some other non-defaullt changes:

  • I added braces on some if so they would stay separate lines.
  • I added a ignore pattern for args that start with _ so eslint wouldn't complain they were unused.

Having a common style is helpful for cross-project sharing, and I plan to apply the same change to Matplotlib's nbagg/webagg backends. However, I am not an expert in the JS ecosystem, so I may not have worked around any issues in the best way.

Adding the config and applying the format are separate commits for easier review.

@QuLogic
Copy link
Member Author

QuLogic commented Apr 4, 2020

I do not know what is failing here; when I run npm install and npm pack locally, it works fine.

@martinRenou
Copy link
Member

Thanks for your PR. If we can fix the CI I'd be happy to merge it.

@QuLogic
Copy link
Member Author

QuLogic commented Apr 24, 2020

I would if I could, but it seems unrelated. There is no line with ...accumulator in the repo.

@martinRenou
Copy link
Member

I will try to find time to look at it, sorry if it takes time

@martinRenou
Copy link
Member

Looks like this accumulator issue appears in other PRs so it's not related to yours. Not sure where this is coming from.

@martinRenou
Copy link
Member

@QuLogic sorry for the time it takes to merge your PR. Could you rebase your branch? The CI should pass now. It was stupid conda which was installing a very old nodejs version.

@QuLogic
Copy link
Member Author

QuLogic commented May 19, 2020

Rebased. Note, this seems to have bumped the jupyter widgets version in package-lock.json. I'm not sure if that's okay.

@QuLogic
Copy link
Member Author

QuLogic commented May 19, 2020

Actually, never mind the jupyter widgets version bump. I figured out how to get it to not change that.

@martinRenou
Copy link
Member

Awesome. Do you think it would make sense to run the lint checker in the CI? So that we make sure we respect the linter rules in the future. I would be in favor of this myself.

@QuLogic
Copy link
Member Author

QuLogic commented May 20, 2020

Yes, this is something we did in Matplotlib as well; I can pull that in here, or separately.

@martinRenou martinRenou merged commit 8257581 into matplotlib:master May 25, 2020
@QuLogic QuLogic deleted the format branch May 25, 2020 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants