Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@panbenson/suppress-eslint-errors
Advanced tools
A codemod that suppresses existing violations of eslint rules.
Have you ever tried to turn on a new eslint rule only to be discouraged by hundreds or thousands of errors in an existing codebase? So have we.
Sometimes, there isn't a great business case for updating all of the existing (working!) code, especially in a larger, legacy codebase.
For those times, suppress-eslint-errors
has you covered.
suppress-eslint-errors
is a codemod for jscodeshift that runs eslint against your existing code.
For each eslint error it finds, it adds a little snippet:
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line cool-new-rule
This way, you can get the benefits of the rule in new code without having to immediately work through a huge backlog.
suppress-eslint-errors
comes with a wrapper script so that you can call it directly without installing anything extra:
npx suppress-eslint-errors [jscodeshift options] PATH...
The wrapper will call jscodeshift
with the transformer and any other arguments that you pass to it.
If it detects a .gitignore
in the local directory, it will also specify that as the --ignore-config
.
suppress-eslint-errors
must be used with a locally installed copy of eslint
.
If it can't find one, it will bail out early.
NOTE: jscodeshift
has some bugs with respect to how it handles .gitignore
files that sometimes causes it to ignore all files.
If this tool detects that your .gitignore
contains problematic patterns, the --ignore-config
option will be skipped.
In some cases, the code produced by this codemod will make some unfortunate indentation decisions. Be sure to re-run any code formatting tools you use before committing!
--message: Sets the comment to add above eslint-disable-next-line comments.
--rules: Comma-separated list of ESLint rule IDs to disable. When specified, violations of rules not in this set will be left in place.
Suppress all errors in the index.js
file, using a custom comment:
npx suppress-eslint-errors ./index.js --message="TODO: Issue #123"
Suppress violations of the eqeqeq
and @typescript-eslint/no-explicit-any
rules in .ts and .tsx files in the src
directory:
npx suppress-eslint-errors ./src --extensions=ts,tsx --parser=tsx --rules=eqeqeq,@typescript-eslint/no-explicit-any
Like the name of the tool says, this only suppresses eslint errors.
If you have warnings that you'd like to suppress, change your eslint config to turn them into errors before running the tool or specify the rules using the --rules
flag.
Definitely not. PRs are welcome for any edge cases that you encounter.
FAQs
A codemod that suppresses existing violations of eslint rules.
We found that @panbenson/suppress-eslint-errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.