8.0.0-2 • Published 4 months ago

@ndhoule/eslint-config v8.0.0-2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 months ago

@ndhoule/eslint-config

An opinionated but flexible set of ESLint configurations.

This configuration:

  • Is mostly composed out of other plugins' recommended configuration sets. It further enables some (hopefully uncontroversial) rules that catch common gotchas and improve consistency.
  • Aggressively enables rules that produce consistent style. It assumes you're using Prettier to style your code, and further enables rules that free developers up from style (sorting import declarations and members, etc.).
  • Centralizes installation and maintenance of ESLint plugins as much as possible. Rather than installing, configuring, and maintaining a ton of ESLint plugins, install one package.
  • Reduces boilerplate by smoothing out common conflicts between plugins.

Installation

Install via your package manager of choice:

npm install -D @ndhoule/eslint-config
yarn add -D @ndhoule/eslint-config

You'll also need to install eslint and prettier, which are peer dependencies.

You will also need to install react and typescript if you're using those configurations; these are also represented as peer dependencies.

Configurations

  • @ndhoule/eslint-config/recommended: A base configuration that enforces best practices. You probably want this rule set enabled at the root of your configuration.
  • @ndhoule/eslint-config/jest: A configuration for Jest tests.
  • @ndhoule/eslint-config/lodash: A configuration for Lodash. You may need to configure the eslint-plugin-lodash plugin; consult its documentation for more information.
  • @ndhoule/eslint-config/node: A configuration for files run in a Node runtime.
  • @ndhoule/eslint-config/node/babel: A configuration for files run in a Node runtime that are first transpiled via Babel (or a similar transpiler like TSC).
  • @ndhoule/eslint-config/node/typescript: A configuration for TypeScript files run in a Node runtime.
  • @ndhoule/eslint-config/react: A configuration for React components/applications. You may need to configure the eslint-plugin-react plugin; consult its documentation for more information.
  • @ndhoule/eslint-config/react/typescript: A configuration for React components/applications with TypeScript-specific rules enabled.
  • @ndhoule/eslint-config/react/jsx-runtime: A configuration for React applications that use the JSX transform.
  • @ndhoule/eslint-config/testing-library: A configuration for Testing Library tests.
  • @ndhoule/eslint-config/testing-library/react: A configuration for Testing Library React tests.
  • @ndhoule/eslint-config/typescript: A configuration for TypeScript files.

Usage

The most effective way to use this configuration is in conjunction with overrides. For example:

// .eslintrc.js
module.exports = {
  root: true,
  extends: "@ndhoule/eslint-config/recommended",
  overrides: [
    // TypeScript files
    {
      files: ["src/**/*.ts", "src/**/*.tsx"],
      parserOptions: {
        tsconfigRootDir: __dirname,
        project: "./tsconfig.json",
      },
      extends: "@ndhoule/eslint-config/typescript",
    },
    // Tests
    {
      files: ["src/**/*.test.js", "src/**/*.test.ts"],
      extends: ["@ndhoule/eslint-config/jest"],
    },
    // React tests
    {
      files: ["src/**/*.test.jsx", "src/**/*.test.tsx"],
      extends: [
        "@ndhoule/eslint-config/jest",
        "@ndhoule/eslint-config/testing-library/react",
      ],
    },
  ],
};
8.0.0-2

4 months ago

8.0.0-1

1 year ago

9.0.0-0

1 year ago

8.0.0-0

1 year ago

7.0.0

2 years ago

7.2.0

2 years ago

7.1.0

2 years ago

6.0.0

2 years ago

5.1.1

2 years ago

5.0.2

3 years ago

5.1.0

2 years ago

5.0.1

3 years ago

5.0.0

3 years ago

5.0.0-beta.8

3 years ago

5.0.0-beta.9

3 years ago

5.0.0-beta.6

3 years ago

5.0.0-beta.7

3 years ago

5.0.0-beta.5

3 years ago

5.0.0-beta.4

3 years ago

4.1.5-0

3 years ago

5.0.0-beta.2

3 years ago

5.0.0-beta.3

3 years ago

5.0.0-beta.1

3 years ago

4.1.4

3 years ago

4.1.3

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago