
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
eslint-config-gbv
Advanced tools
Internal linting rules for GBV/coli-conc projects.
npm i -D eslint-config-gbv@"~2.6"
eslint-config-gbv v2.x only works with ESLint v9.x and the new flat config format. It is recommended to use the same minor version of ESLint in your project as is used in this project (as minor updates in ESLint can include rule changes). Current, this is ESLint v9.16:
npm i -D eslint@"~9.16"
For older versions of ESLint (using the previous config format), use eslint-config-gbv v1.1.0.
Create a eslint.config.js
file with the following content:
import gbv from "eslint-config-gbv"
export default gbv
If you need to include your own rules, or to add Vue.js-specific rules, do this:
import gbv from "eslint-config-gbv"
import vue from "eslint-config-gbv/vue"
// import vue from "eslint-config-gbv/vue2" // use this for Vue.js 2
export default [
...gbv,
...vue,
// Your own rules or other configs/plugins here:
{
// ...
},
]
See also: https://eslint.org/docs/latest/use/configure/combine-configs
Please enforce linting before a commit in all projects.
You can enforce linting before a commit on all staged files by utilizing the packages pre-commit and lint-staged:
npm i -D pre-commit lint-staged
Then add the following to package.json
:
{
"scripts": {
"lint-staged": "lint-staged"
},
"lint-staged": {
"**/*.js": [
"eslint --fix"
],
"*.js": [
"eslint --fix"
]
},
"pre-commit": "lint-staged"
}
Make sure to add other file extensions as necessary.
Additionally, you can add linting to your Mocha tests as well. Create a file test/eslint.js
(or test/eslint.mjs
in CommonJS projects) with the following content:
import assert from "node:assert"
import { loadESLint } from "eslint"
const DefaultESLint = await loadESLint()
const eslint = new DefaultESLint()
const results = await eslint.lintFiles([
"**/*.js",
// Add more file patterns here if necessary
])
describe("ESLint Errors", () => {
results.forEach(result => {
it(result.filePath, (done) => {
assert(
result.errorCount === 0,
"\n" + result.messages.map(m => `\t\t${m.line}:${m.column}\terror\t${m.message}\t${m.ruleId}`).join("\n"),
)
done()
})
})
})
Each file will be its own test case and errors will be appropriately reported.
Using ESLint's recommended
rules as a base, with the following overriding rules:
case
in switch statements._
to be unused.let
or const
instead of var
.Using Vue.js's flat/recommended
/flat/vue2-recommended
as a base, with the following overriding rules:
PRs are welcome, but we only use this for our own project and it shouldn't be of much interest for anyone else.
If editing the README, please conform to the standard-readme specification.
MIT @2024 Verbundzentrale des GBV (VZG)
FAQs
Internal linting rules for GBV projects.
The npm package eslint-config-gbv receives a total of 49 weekly downloads. As such, eslint-config-gbv popularity was classified as not popular.
We found that eslint-config-gbv demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.