@aarongoldenthal/eslint-config-standard

27.0.1 • Public • Published

@aarongoldenthal/eslint-config-standard

Summary

Custom standard ESLint configuration for all projects. Includes configurations for eslint, @eslint-community/eslint-plugin-eslint-comments (formerly eslint-plugin-eslint-comments), eslint-plugin-jest, eslint-plugin-jsdoc, eslint-plugin-n (formerly eslint-plugin-node), eslint-plugin-playwright, eslint-plugin-promise, eslint-plugin-sonarjs, eslint-plugin-unicorn, and eslint-plugin-vitest. This package defines all required configurations as peerDependencies so they're installed and don't have to be defined in each project.

Per recommended best practices, the following configurations include overrides so they're only applicable to a subset of files:

  • jest-config, vitest-config: applicable to files matching ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], which is the default filter for Jest test files.
  • playwright-config: applicable to files matching ['**/*.pwtest.[jt]s'], which differentiates them from Jest test files.

The configuration as-defined includes a number of formatting rules. The eslint-config-prettier package is included as well, and can be added to the config if prettier is also being used so it takes priority for formatting.

There is also an esm-config included with 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 includes jest-config). To configure .eslintrc.json with this configuration:

{
  "extends": ["@aarongoldenthal/eslint-config-standard/recommended"]
}

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

{
  "extends": ["@aarongoldenthal/eslint-config-standard/recommended-vitest"]
}

To configure .eslintrc.json with individual plugins, use the appropriate subset of the options below:

{
  "extends": [
    "@aarongoldenthal/eslint-config-standard/eslint-comments-config.js",
    "@aarongoldenthal/eslint-config-standard/jest-config",
    "@aarongoldenthal/eslint-config-standard/jsdoc-config",
    "@aarongoldenthal/eslint-config-standard/node-config",
    "@aarongoldenthal/eslint-config-standard/playwright-config",
    "@aarongoldenthal/eslint-config-standard/promise-config",
    "@aarongoldenthal/eslint-config-standard/sonarjs-config",
    "@aarongoldenthal/eslint-config-standard/unicorn-config",
    "@aarongoldenthal/eslint-config-standard/vitest-config",
    "@aarongoldenthal/eslint-config-standard",
    "@aarongoldenthal/eslint-config-standard/esm-config",
    "prettier"
  ]
}

Notes:

  • If used, the @aarongoldenthal/eslint-config-standard config should be included after any other @aarongoldenthal/eslint-config-standard/* configurations except esm-config so those settings take precedence.
  • The jest-config and vitest-config have the same file overrides, 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 should be included last to take priority in disabling the applicable rules from all other configurations.

Dependents (0)

Package Sidebar

Install

npm i @aarongoldenthal/eslint-config-standard

Weekly Downloads

666

Version

27.0.1

License

MIT

Unpacked Size

50.3 kB

Total Files

16

Last publish

Collaborators

  • aarongoldenthal