npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-config-digitalbazaar

v5.2.0

Published

Digital Bazaar's eslint rules

Downloads

20,524

Readme

eslint-config-digitalbazaar

This package provides eslint rules used by Digital Bazaar as a set of extendable shared configs.

There are 6 rule sets:

  1. eslint-config-digitalbazaar: Base rules for both node and the browser.
  2. eslint-config-digitalbazaar/import: Rules for es6 imports in the browser and node.
  3. eslint-config-digitalbazaar/jsdoc: Rules for JSDoc for both node and the browser.
  4. eslint-config-digitalbazaar/module: Rules for modules for both node and the browser.
  5. eslint-config-digitalbazaar/vue: Rules for Vue 2 projects and browser only.
  6. eslint-config-digitalbazaar/vue3: Rules for Vue 3 projects and browser only.

Installation

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

Usage

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']
}

Imports

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']
}

JSDoc

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']
}

Modules

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']
}

Vue 2

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.

Vue 3

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.

Composition

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

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'
  }