When adding eslint to an existing project, you'll usually find that there are a lot of errors to fix. Depending on the size of your project, you might even have thousands of linting errors.
You're a busy developer and you don't have time to make thousands of lint changes right now and then test everything to be sure that your app hasn't broken.
That's where grampa
comes in.
You can use grampa
to add // eslint-disable-next-line
comments to all of the lint errors in your codebase.
In your project:
yarn add -D eslint-formatter-grampa
First, be sure you've fixed everything that's auto-fixable in your project. Eg:
npx eslint --quiet --fix './src/**/*.{js,jsx,ts,tsx}'
Then, use grampa
to update all of the remaining errors with // eslint-disable
comments (but be sure you have no unstaged/uncommitted changes because grampa
will edit a bunch of your local files):
npx eslint --format grampa --quiet --fix './src/**/*.{js,jsx,ts,tsx}'
Then run git diff
and see what's changed.
You might need to run eslint --fix
again if you have a code formatter enabled, to ensure that the new // eslint-disable
comments have appropriate indentation.
- You should review the diff carefully before committing it
grampa
may run slowly on larger codebases with lots of lint errorsgrampa
hasn't yet been tested on Windows/Linux systems