I'm new to eslint and am using it to enforce coding style. However, when I write a TODO
item into my code I get an eslint warning, alright that's fine. But, now when I try to git commit, it comes back with:
**** ESLint errors found : line 145, col 9, Warning - Unexpected 'todo' comment. (no-warning-comments)
How can I prevent eslint from blocking me from committing? I want it to still warn me about TODOs etc, but I would like to be able to commit my code as well.
How do I turn off rule ESLint? If you want to disable an ESLint rule in a file or on a specific line, you can add a comment. On a single line: const message = 'foo'; console. log(message); // eslint-disable-line no-console // eslint-disable-next-line no-console console.
You can disable errors in browser by adding the environment variable ESLINT_NO_DEV_ERRORS as it is mentioned here.
If you want to manually run all pre-commit hooks on a repository, run pre-commit run --all-files . To run individual hooks use pre-commit run <hook_id> . The first time pre-commit runs on a file it will automatically download, install, and run the hook. Note that running a hook for the first time may be slow.
The pre-commit hook is run first, before you even type in a commit message. It's used to inspect the snapshot that's about to be committed, to see if you've forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code.
You have a pre-commit hook.
git commit --no-verify
allows to avoid it once. Or you can remove it completely from .git/hooks.
In my case the culprit were package.json
entries automatically created by a project creating CLI (nuxt.js
). I removed from my package.json
these entries:
"lint-staged": { ... }, "husky": { ... }
and it solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With