3.5.0 • Published 11 months ago

@egor.xyz/eslint-config v3.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

eslint-config

This is my ESLint 9 flat configuration for any Node or React project using TypeScript.

It includes all my favorite rules and helps keep codebases aligned and in-sync with the highest standards.

Install the package

npm i -D eslint @egor.xyz/eslint-config

Create an eslint.config.mjs file, or eslint.config.js if you have type: "module", in the root of your project.

React

Includes all configurations (React, TypeScript, Node, etc.)

import config from '@egor.xyz/eslint-config';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  {
    // ignore files and folders from root: node_modules, dist, build, *.js, *.ts
    ignores: ['node_modules', 'dist', 'build', '*.js', '*.ts']
  },
  {
    extends: config,
    files: ['**/*.{ts,tsx}']
  }
);

Node

Node.js specific configuration, without React rules

import configNode from '@egor.xyz/eslint-config/node.js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  {
    ignores: ['node_modules', 'dist', 'build', '*.js', '*.ts']
  },
  {
    extends: configNode,
    files: ['**/*.{ts,tsx}']
  }
);

Customization

You can customize the ESLint configuration by extending it in your own configuration file. For example:

import config from '@egor.xyz/eslint-config';
import tseslint from 'typescript-eslint';
// or import partial configs
import { configEslint } from '@egor.xyz/eslint-config/configs/config-eslint.js';
import { configTS } from '@egor.xyz/eslint-config/configs/config-ts.js';
import { configReact } from '@egor.xyz/eslint-config/configs/config-react.js';

export default tseslint.config(
  {
    ignores: ['node_modules', 'dist', 'build', '*.js', '*.ts']
  },
  {
    extends: [
      // ...
      ...config,
      // or partial configs
      ...configEslint,
      ...configTS
      // ...
    ],
    files: ['**/*.{ts,tsx}'],
    rules: {
      // Override or add your custom rules here
      'no-console': 'warn',
      'react/prop-types': 'off',
      'no-explicit-any': 'off'
    }
  }
);

Development

ESLint Config Inspector

A visual tool to help you understand and inspect ESLint flat configuration files

npm run inspect

Testing

Checking for errors in the configuration file

npm test
3.4.0

11 months ago

3.3.0

11 months ago

3.2.0

11 months ago

3.1.0

11 months ago

3.5.0

11 months ago

3.0.0

1 year ago

2.1.0

2 years ago

2.0.0

2 years ago

1.6.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.0.0

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago