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

ESLint + Prettier + tsconfig #1825

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

wmertens
Copy link
Contributor

@wmertens wmertens commented Mar 6, 2021

This PR touches a lot of files due to the npm run lint final commit. This is all done by prettier and eslint and should be safe.

To see the changes without the auto-fixes, look at master...4f78356

Changes:

  • Set up ESLint together with Prettier and a JSDoc formatting plugin
  • Made npm run lint also auto-fix problems that ESLint finds
  • Added a tsconfig.json file so that VSCode (and anything else using tsc to check for errors) can do live code analysis and provide better tab completion. This doesn't touch anything else, it's just a single file.
  • Fixed some JSDoc entries so they were parseable by the Prettier plugin
  • Fixed straightforward ESLint errors (lint commit)
  • Changed some array.some() invocations that used side-effects with their for loop equivalent (lint++ commit)
  • Ran npm run lint

ESLint finds more problems than JSHint, and integrating with Prettier is faster than having the two separately, plus it automatically disables ESLint rules related to formatting which is automated by Prettier.

The JSDoc plugin ensures that the JSDoc entries are consistently formatted, and helps with detecting unparseable descriptions (they won't format).

Merging this will cause open PRs to have merge conflicts. To fix those, there are two options:

  • Rebasing the branch on top of master, running npm run lint after every merge conflict fixup (preferred for clean branches)
  • Cherry-picking the commit that adds eslint, running npm run lint and committing the result (easiest)

@wmertens wmertens changed the title Eslint prettier ESLint + Prettier + tsconfig Mar 6, 2021
@wmertens wmertens force-pushed the eslint-prettier branch 2 times, most recently from dce1cca to 144e0b8 Compare March 7, 2021 21:53
@wmertens
Copy link
Contributor Author

@ianhattendorf sorry for pinging you, I just updated this PR and now all tests pass, and I saw you were the last person to merge something. Are you interested in this PR? It takes the guesswork out of formatting and prevents some bugs.

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.

None yet

1 participant