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
-
Require @perfective/eslint-config
and its peer dependencies as dev dependencies.
npm install --save-dev \
@perfective/eslint-config \
@stylistic/eslint-plugin \
@stylistic/eslint-plugin-js \
@stylistic/eslint-plugin-jsx \
@stylistic/eslint-plugin-ts \
@stylistic/eslint-plugin-plus \
eslint \
eslint-import-resolver-typescript \
eslint-plugin-array-func \
eslint-plugin-eslint-comments \
eslint-plugin-import \
eslint-plugin-jsdoc \
eslint-plugin-n \
eslint-plugin-prefer-arrow \
eslint-plugin-promise \
eslint-plugin-security \
eslint-plugin-simple-import-sort \
eslint-plugin-unicorn \
typescript-eslint
-
Require the configuration in your root eslint.config.js
.
const perfectiveEslintConfig = require('@perfective/eslint-config');
module.exports = perfectiveEslintConfig.default;
-
Install optional peer dependencies that add linting rules for the tools you use.
npm install --save-dev \
@smarttools/eslint-plugin-rxjs \
eslint-plugin-cypress \
eslint-plugin-jest \
eslint-plugin-jest-dom \
eslint-plugin-testing-library
The @perfective/eslint-config
automatically includes rules for these plugins,
if the dependency is installed.
-
Add optional configurations to your root eslint.config.js
.
const perfectiveEslintConfig = require('@perfective/eslint-config');
const perfectiveCypressConfig = require('@perfective/eslint-config/cypress');
const perfectiveJestConfig = require('@perfective/eslint-config/jest');
const perfectiveJestDomConfig = require('@perfective/eslint-config/jest-dom');
const perfectiveRxjsConfig = require('@perfective/eslint-config/rxjs');
const perfectiveTestingLibraryConfig = require('@perfective/eslint-config/testing-library');
module.exports = [
...perfectiveEslintConfig.default,
perfectiveCypressConfig.cypressConfig(),
perfectiveJestConfig.jestConfig(),
perfectiveJestDomConfig.jestDomConfig(),
perfectiveRxjsConfig.rxjsConfig(),
perfectiveTestingLibraryConfig.testingLibrarysConfig(),
];