This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

eslint-config-node-opinionated

0.6.3 • Public • Published

An opinionated ESLint configuration

License Version Build Status Known Vulnerabilities

Across multiple Node.js projects, I use the same linter

  • ESLint with node reccomended defaults
  • A few plugins (node, security, sonarjs and jest)
  • A very strict and opinionated rule set

I was tired to copy-paste config and deps across projects, so I created a shareable eslint config for myself. Eventually could be interesting for somebody else as well.

Basic usage

Install all the dependencies:

yarn add -D eslint eslint-config-node-opinionated eslint-plugin-node eslint-plugin-security eslint-plugin-sonarjs

A one-liner eslint config file is all you need now:

echo "extends: ['node-opinionated']" > .eslintrc.yml

or create your own .eslintrc.js like this:

module.exports = {
  extends: [
    'node-opinionated',
  ],
}

In combo with Jest

I often use ESLint in combination with Jest, with some specific overrides for the tests folder:

module.exports = {
  extends: [
    'node-opinionated',
    'plugin:jest/recommended'
  ],
  plugins: ['jest'],
  overrides: [
    {
      files: ['**/*test*/**'],
      rules: {
        'node/no-unpublished-require': 'off',
        'node/no-unpublished-import': 'off',
        'max-nested-callbacks': ['warn', 3],
        'security/detect-child-process': 'off',
        'security/detect-non-literal-fs-filename': 'off',
      }
    },
  ]
}

Package Sidebar

Install

npm i eslint-config-node-opinionated

Weekly Downloads

93

Version

0.6.3

License

MIT

Unpacked Size

9.62 kB

Total Files

7

Last publish

Collaborators

  • ildella