@cdoublev/eslint-config

0.11.0 • Public • Published

ESLint configuration

Minimal ESLint rule presets:

  • @cdoublev/eslint-config: to lint (ES6+) files executed anywhere
  • @cdoublev/eslint-config/node: to lint files executed in NodeJS
  • @cdoublev/eslint-config/browser: to lint files executed in a browser
  • @cdoublev/eslint-config/jest: to lint files executed in Jest
  • @cdoublev/eslint-config/react: to lint files executed in React

Usage

Simply add the required configurations to the main export of eslint.config.js. For example, in a server side rendered React application, tested with Jest:

// eslint.config.js

const common = require('@cdoublev/eslint-config')
const browser = require('@cdoublev/eslint-config/browser')
const jest = require('@cdoublev/eslint-config/jest')
const node = require('@cdoublev/eslint-config/node')
const react = require('@cdoublev/eslint-config/react')

module.exports = [
  common,
  jest, // Looks for __tests__/**/*.js, tests/**/*.js, **/*.test.js
  react,
  { ...node, files: ['server/**/*.js'] },
  { ...browser, files: ['src/**/*.js'] },
]

The following dependencies may need to be installed depending on the configuration:

How rules are selected?

  • they must be as few as possible to detect errors (tests already exist for this)
  • they must be otherwise related to spacing, line breaks, code complexity
  • they must not increase code complexity
  • they must be widely accepted by the JS community

This document provides some comments about each rule. If a rule exists in this document and is not activated, it will never be.

Readme

Keywords

Package Sidebar

Install

npm i @cdoublev/eslint-config

Weekly Downloads

19

Version

0.11.0

License

MIT

Unpacked Size

11.3 kB

Total Files

8

Last publish

Collaborators

  • cdoublev