33.0.0 • Published 8 months ago

@aarongoldenthal/eslint-config-standard v33.0.0

Weekly downloads
478
License
MIT
Repository
gitlab
Last release
8 months ago

@aarongoldenthal/eslint-config-standard

Summary

Custom ESLint configuration for all projects. Includes flat-config formatted configurations compatible with ESLint v9+ for the following:

Plugin NameConfig filenameRule Prefix
eslintbase-configs.jsnone, core
@eslint-community/eslint-plugin-eslint-commentseslint-comments-config.jscomments
eslint-plugin-jestjest-config.jsjest
eslint-plugin-jsdocjsdoc-config.jsjsdoc
eslint-plugin-nnode-config.jsnode
eslint-plugin-playwrightplaywright-config.jsplaywright
eslint-plugin-promisepromise-config.jspromise
eslint-plugin-unicornunicorn-configs.js, esm-config.jsunicorn
eslint-plugin-vitestvitest-config.jsvitest

As flat configs, the package defines all required plugins/configurations as dependencies. Since flat config allows flexibility in the rule prefixes (that is, they don't have to match the plugin name), the rules prefixes are adapted in some cases to be more intuitive or readable. Since they may be combined, and flat config doesn't allow nested arrays of rules, file names that are singular export a single config object (for example jsdoc-config.js), and file names that are plural export an array of config objects (for example base-configs.js).

The core prefix has only one rule, core/complexity, that has a higher threshold. This provides a secondary check for cases where the lower threshold in the complexity rule is disabled, which otherwise allows unbounded complexity. Since re-use of core rules is an experimental capability, this must be enabled with environment variable ENABLE_ESLINT_CORE_RULE_DUPLICATES=true.

Most rule configurations are applicable to files matching '**/*.{js,mjs,cjs}'. The following configurations are exceptions and are applicable to files as noted:

  • base-configs.js includes a config that disables some rules for test files matching any of the following test patterns (for example max-lines, max-lines-per-function).
  • jest-config applies rules to files matching '**/__tests__/**/*.{js,mjs,cjs}' or '**/?(*.)+(spec|test).{js,mjs,cjs}'.
  • vitest-config applies rules to files matching '**/__tests__/**/*.{js,mjs}' or '**/?(*.)+(spec|test).{js,mjs}'.
  • playwright-config: applies rules to files matching '**/*.pwtest.{js,mjs,cjs}', which differentiates them from Jest/Vitest test files.
  • unicorn-configs.js includes a config that disables some rules for test files (matching any of the following test patterns).

With ESLint v9 the majority of formatting rules are deprecated and removed from base-configs, but the eslint-config-prettier package is included and can be added to the config if prettier is also being used to ensure it takes priority for formatting.

There is also an esm-config included with rule overrides for projects using ES modules instead of Common JS modules.

Usage

There is a recommended configuration with all plugin configurations enabled except esm-config and vitest-config (it does include jest-config). To configure eslint.config.js with this configuration:

const recommendedConfig = require('@aarongoldenthal/eslint-config-standard/recommended');

module.exports = [
  ...recommendedConfig,
  {
    ignores: ['.vscode/**', 'archive/**', 'node_modules/**', 'coverage/**'],
    name: 'ignores'
  }
];

Note the optional ignores config that can be added last to ignore certain directories.

There is also a recommended-esm configuration that's the same as the recommended config, but includes the vitest-config instead of the jest-config, and also the esm-config. It can be configured with:

import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended-esm.js';

export default [
  ...recommendedConfig,
  {
    ignores: ['.vscode/**', 'archive/**', 'node_modules/**', 'coverage/**'],
    name: 'ignores'
  }
];

To configure eslint.config.js with individual plugins, see the recommended or recommended-esm configurations as examples.

Notes:

  • If used, the base-configs should be included after other configurations, except esm-config and prettier, so those settings take precedence.
  • The jest-config and vitest-config have the same file applicability, so only one should be used.
  • If used, the esm-config should be configured after all functional rules to ensure the overridden settings take precedence.
  • If used, the prettier config should be included last to take priority in disabling the applicable rules from all other configurations.
33.0.0

8 months ago

32.0.0

9 months ago

31.1.0

9 months ago

29.0.0

1 year ago

28.0.0

1 year ago

31.0.0

11 months ago

31.0.1

11 months ago

30.0.0

12 months ago

27.0.1

1 year ago

27.0.0

1 year ago

26.0.1

1 year ago

26.0.0

1 year ago

25.0.0

2 years ago

24.0.1

2 years ago

23.0.0

2 years ago

23.1.1

2 years ago

23.1.0

2 years ago

24.0.0

2 years ago

22.0.0

2 years ago

21.0.0

2 years ago

22.1.0

2 years ago

20.1.0

2 years ago

19.0.2

2 years ago

20.0.0

2 years ago

19.0.1

3 years ago

19.0.0

3 years ago

18.0.0

3 years ago

17.0.1

3 years ago

17.0.0

3 years ago

16.0.1

3 years ago

16.0.0

3 years ago

15.0.0

3 years ago

14.0.0

3 years ago

13.0.0

3 years ago

12.0.0

3 years ago

12.0.1

3 years ago

12.0.2

3 years ago

11.0.0

3 years ago

10.0.2

4 years ago

10.0.1

4 years ago

10.0.0

4 years ago

9.1.0

4 years ago

9.0.0

4 years ago

8.0.0

4 years ago

7.0.2

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

6.2.0

4 years ago

6.1.4

4 years ago

6.1.3

4 years ago

6.1.2

4 years ago

6.1.1

4 years ago

6.1.0

5 years ago

6.0.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago