Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
eslines
helps you to post-process an ESLint JSON report.
Originally, the project was created to downgrade errors into warnings if they were reported in lines not modified within the current git branch - hence the name.
This approach helped us to set all our ESLint rules to errors without the need to immediately fix all the linting errors in our codebase. Our linting tools (pre-commit hooks, continuous integration, etc) only reported errors in lines that were modified by a branch. All new code needed to adhere to the current linting standards, but legacy code could be migrated gradually - helping to evolve the linting standards as well.
Nowadays, it has grown to support more options than that.
Install it:
npm install eslines
Add the default .eslines.json
config file to your git repo:
{
"branches": {
"default": ["downgrade-unmodified-lines"]
},
"processors": {
"downgrade-unmodified-lines": {
"remote": "origin/master",
"rulesNotToDowngrade": ["no-unused-vars"]
}
}
}
Run it:
eslint -f json . | eslines
The resulting report will transform any ESLint error
into a warning
if it is reported in lines not modified within the current branch. The no-unused-vars
rule won't be downgraded, though - this is one case where changing one line can cause a linting error in a different one so we recommend preventing it from downgrading.
If you rather use node-like pipes, check the eslint-eslines utility.
eslines
reads its configuration from a file named .eslines.json
placed in the root of your git repository. Out of the box, it comes with four ways of post-processing an ESLint report - we call them processors: downgrade-unmodified-lines
, filter-parsing-errors
, filter-when-format
, enforce
.
Example config:
{
"branches": {
"default": ["downgrade-unmodified-lines", "enforce"],
"master": ["filter-parsing-errors"],
"my/topic-branch": ["filter-when-format"]
},
"processors": {
"downgrade-unmodified-lines": {
"remote": "origin/master",
"rulesNotToDowngrade": ["no-unused-vars"]
},
"filter-when-format": {
"rulesToIgnore": ["indent"]
},
"enforce": {
"rules": ["max-len"]
}
}
}
With the above configuration, the linting process will report only JavaScript parsing errors when running on a git branch called master
.
On the my/topic-branch
branch, eslines
will completely remove any breaks reported by the indent
rule in files that contain the @format
tag. It will keep them intact in other files that don't contain the tag.
For other branches, eslines
will report any max-len
or no-unused-vars
break, plus any error in lines modified within the current branch (provided that no-unused-vars
is defined as an error in ESLint).
branches: tell eslines
which processors to use by default and which ones to use for particular branches. If none is set, it'll use downgrade-unmodified-lines
.
processors: each processor may have its own configuration. Detailed info.
The eslines
Command Line Interface has the following options:
--diff or -d: let you choose between two diff strategies for the downgrade-unmodified-lines
processor
index
: to diff HEAD against the git index.remote
: to diff HEAD against the git remote. This is the default.--format or -f: set any ESLint formatter as the output for eslines
. stylish
will be used by default.
--processors or -p: choose one or several eslines
processors at run-time. downgrade-unmodified-lines
will be used by default. Processors can be composed by separating them with commas such as --processors downgrade-unmodified-lines,enforce
.
--quiet: report errors only.
Some examples:
to get a report with junit
format containing only the parsing errors
eslint -f json . | eslines -p parsing-errors -f junit
to get a report containing errors in lines modified within files at the git index
eslint -f json . | eslines -d index
See HACKING.md and Processors.md.
2017-09-05 v1.1.0
downgrade-unmodified-lines
processor: when there are no lines modified,
the report should still downgrade all rules except those not to downgrade.FAQs
Utility to process ESLint JSON reports
The npm package eslines receives a total of 46 weekly downloads. As such, eslines popularity was classified as not popular.
We found that eslines demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.