Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
eslint-config-digitalbazaar
Advanced tools
This package provides eslint rules used by Digital Bazaar as a set of extendable shared configs.
There are 6 rule sets:
eslint-config-digitalbazaar
: Base rules for both node and the browser.eslint-config-digitalbazaar/import
: Rules for es6 imports in the browser and node.eslint-config-digitalbazaar/jsdoc
: Rules for JSDoc for both node and the browser.eslint-config-digitalbazaar/module
: Rules for modules for both node and the browser.eslint-config-digitalbazaar/vue
: Rules for Vue 2 projects and browser only.eslint-config-digitalbazaar/vue3
: Rules for Vue 3 projects and browser only.If you do not have eslint installed:
npm i -D eslint
npm i -D eslint-config-digitalbazaar
To start an eslint config file:
npx eslint --init
or rename a template from the templates dir
cp node_modules/eslint-config-digitalbazaar/templates/node.js ./.eslintrc.cjs
All rules can be accessed via the shorthand digitalbazaar
or using the full module name eslint-config-digitalbazaar
.
Eslint's documentation on shareable configs can be found here.
Example .eslintrc.cjs root setup:
module.exports = {
root: true,
// using full module name
extends: ['eslint-config-digitalbazaar']
}
To use the import rules you need to install eslint-plugin-import
:
npm i -D eslint-plugin-import
Example .eslintrc.cjs import setup:
module.exports = {
extends: ['digitalbazaar/import']
}
To use the JSDoc rules you will need to install eslint-plugin-jsdoc
:
npm i -D eslint-plugin-jsdoc
Example .eslintrc.cjs JSDoc setup:
module.exports = {
// only the JSDoc rules and any rules in parent dirs
extends: ['digitalbazaar/jsdoc']
}
To use ES module code rather than CommonJS, you will need to install eslint-plugin-unicorn
:
npm i -D eslint-plugin-unicorn
Example .eslintrc.cjs ESM setup:
module.exports = {
// only the module rules and any rules in parent dirs
extends: ['digitalbazaar/module']
}
To use the Vue 2 rules you will need to install eslint-plugin-vue
:
npm i -D eslint-plugin-vue
Example .eslintrc.cjs Vue setup:
module.exports = {
// only the vue rules and any rules in parent dirs
extends: ['digitalbazaar/vue']
}
For command line use you may need to explicitly enable linting .vue
files.
To use the Vue 3 rules you will need to install eslint-plugin-vue
:
npm i -D eslint-plugin-vue
Example .eslintrc.cjs Vue setup:
module.exports = {
// only the vue3 rules and any rules in parent dirs
extends: ['digitalbazaar/vue3']
}
For command line use you may need to explicitly enable linting .vue
files.
The rules do not depend on each other and are composable:
module.exports = {
extends: [
'digitalbazaar',
'digitalbazaar/jsdoc',
'digitalbazaar/module'
'digitalbazaar/vue3'
] // 4 rule sets in one file using shorthand.
}
The rules can also be used together via cascade configuration.
Other rules that are not included above but can be useful:
unicorn/prefer-node-protocol
Use node:module
style for Node.js modules.
See unicorn/prefer-node-protocol
.
Requires:
npm i -D eslint-plugin-unicorn
Rules:
rules: {
'unicorn/prefer-node-protocol': 'error'
}
FAQs
Digital Bazaar's eslint rules
The npm package eslint-config-digitalbazaar receives a total of 1,440 weekly downloads. As such, eslint-config-digitalbazaar popularity was classified as popular.
We found that eslint-config-digitalbazaar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.