Package detail

@perfective/eslint-config

perfective215MIT0.31.2

ESLint shareable rules configuration

code quality, code standard, code style, eslint

readme

Perfective ESLint Config

@perfective/eslint-config provides a shareable ESLint configuration that is used for the development of the @perfective packages. These rules are primarily configured for TypeScript projects.

In addition to the core ESLint rules, @typescript-eslint, and ESlint Stylistic plugin rules, @perfective/eslint-config includes configurations for the ESLint plugins:

To simplify configuring ESLint support in the IDEs and editors, the severity of all fixable rules is a warning. In addition, it allows distinguishing errors that have to be fixed manually from issues that will be fixed automatically.

Setup

@perfective/eslint-config only support ES module syntax. If your project uses CommonJS by default you need to use eslint.config.mjs file instead of eslint.config.js to run it in ESM mode.

  1. Install @perfective/eslint-config as a dev dependency:

     npm install --save-dev \
         @perfective/eslint-config

    Required peer dependencies are installed automatically.

  2. Import perfectiveEslintConfig to eslint.config.js.

     import { perfectiveEslintConfig } from '@perfective/eslint-config';
    
     const eslintConfig = perfectiveEslintConfig();
    
     export default eslintConfig;
  3. Optional Install optional peer dependencies to add tool-specific linting rules.

     npm install --save-dev \
         eslint-plugin-cypress \
         eslint-plugin-jest \
         eslint-plugin-jest-dom \
         eslint-plugin-rxjs-x \
         eslint-plugin-testing-library

    Import configurations to eslint.config.js.

     import { perfectiveEslintConfig } from '@perfective/eslint-config';
    
     // Optional dependencies.
     import { cypressConfig } from '@perfective/eslint-config/cypress';
     import { jestConfig } from '@perfective/eslint-config/jest';
     import { jestDomConfig } from '@perfective/eslint-config/jest-dom';
     import { rxjsConfig } from '@perfective/eslint-config/rxjs';
     import { testingLibraryConfig } from '@perfective/eslint-config/testing-library';
    
     const eslintConfig = perfectiveEslintConfig([
         cypressConfig,
         jestConfig,
         jestDomConfig,
         rxjsConfig,
         testingLibraryConfig,
     ]);
    
     export default eslintConfig;
  4. Optional Customize configuration rules in eslint.config.js

     import { perfectiveEslintConfig, typescriptFiles } from '@perfective/eslint-config';
    
     const eslintConfig = perfectiveEslintConfig([
         // ...Optional configurations...
         {
             // These rules are overridden to all files
             rules: {
                 '@stylistic/js/indent': ['warn', 2],
             },
         },
         {
             // These rules are overridden to TypeScript files only
             files: typescriptFiles,
             rules: {
                 '@stylistic/ts/indent': ['warn', 2],
             },
         },
     ]);
    
     export default eslintConfig;

Read full documentation in the repo.