◐ Shell
clean mode source ↗

ESLint + Prettier + tsconfig by wmertens · Pull Request #1825 · nodegit/nodegit

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)