🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

eslint-config-node-opinionated

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-node-opinionated

The linter config and plugins for folks who does not like to be standard.

latest
Source
npmnpm
Version
0.6.3
Version published
Weekly downloads
23
-8%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

eslint

FAQs

Package last updated on 14 Jun 2022

Did you know?

Socket

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.

Install

Related posts