Back to directory
perfective avatar
perfective / eslint-config

eslint-config

A shareable ESLint configuration for the development of Perfective TypeScript packages

5

Stars

1

Forks

1

Watchers

MIT

License

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/indent': ['warn', 2],
            },
        },
        {
            // These rules are overridden to TypeScript files only
            files: typescriptFiles,
            rules: {
                '@stylistic/indent': ['warn', 4],
            },
        },
    ]);
    
    export default eslintConfig;
    

Read full documentation in the repo.

Releases

Read the migration guide for migration steps from v0.33.

Upgraded eslint-plugin-jsdoc to 62.0.0. Included .cjs and .mjs files to the configuration files glob.

Read the migration guide for migration steps from v0.33.

Updated eslint-plugin-jsdoc to 61.7.1. Extracted jestTypescriptConfig() from jestConfig() in @perfective/eslint-config/jest:

Rules that requi...

Read the migration guide for migration steps from v0.32.

Updated eslint to 9.39.2. Updated typescript-eslint to 8.52.0:

Enabled the @typescript-eslint/no-unused-private-class-members rule as an erro...

Read the migration guide for migration steps from v0.31.

Removed Node.js v18 support, required v20+. Updated eslint to 9.34.0:

Enabled the no-unassigned-vars rule as an error. Changed the no-array-c...

Read the migration guide for migration steps from v0.30

Included package.json files for sub-packages into distribution.

Contributors

1 contributors by commits. Profile dekhne ke liye kisi bhi developer par click karein.