@code-pushup/eslint-config

Recommended ESLint presets by Code PushUp.
⚙️ Configs
 | javascript | Default config, suitable for any JavaScript/TypeScript project. |
 | typescript | Config for strict TypeScript projects. |
 | node | Config for Node.js projects. |
 | angular | Config for Angular projects. |
 | ngrx | Config for Angular projects using NgRx library. |
 | react | Config for React projects. |
 | graphql | Config for GraphQL servers implemented in Node.js. |
 | jest | Config for projects using Jest for testing. |
 | vitest | Config for projects using Vitest for testing. |
 | cypress | Config for projects using Cypress for testing. |
 | playwright | Config for projects using Playwright for testing. |
 | storybook | Config for projects using Storybook for UI components. |
 | react-testing-library | Config for projects using React Testing Library for testing. |
Some configs extend other configs, as illustrated below. So, for example, extending angular
config implicitly extends typescript
and javascript
configs as well.
graph BT;
typescript --extends--> javascript
node --extends--> javascript
angular --extends--> typescript
ngrx --extends--> angular
react --extends--> javascript
graphql --extends--> node
🏗️ Setup
To use the default config, follow these steps:
-
You must first install all the required peer dependencies (if you haven't already):
npm install -D eslint @eslint/js eslint-plugin-{functional,import,promise,sonarjs,unicorn} globals typescript-eslint
-
Install @code-pushup/eslint-config
with:
npm install -D @code-pushup/eslint-config
-
Include default config in your ESLint configuration file (usually eslint.config.js
):
import javascript from '@code-pushup/eslint-config/javascript.js';
import tseslint from 'typescript-eslint';
export default tseslint.config(...javascript);
Depending on your tech stack, you may wish to extend other configs as well (listed above). This will require installing additional peer dependencies. For more details, refer to setup docs for the configs you're interested in using.
📦 Peer dependencies
All peer dependencies used by @code-pushup/eslint-config
are listed below, along with their supported versions. Only the default config's dependencies are required, others are optional.
🧪 Test overrides
For non-production code, some rules are disabled (or downgraded from errors to warnings).
This applies to file paths matching any of the following globs:
**/*.spec.?(c|m)[jt]s?(x)
**/*.test.?(c|m)[jt]s?(x)
**/__tests__/**/*.?(c|m)[jt]s?(x)
**/__mocks__/**/*.?(c|m)[jt]s?(x)
**/*.cy.?(c|m)[jt]s?(x)
**/*.stories.?(c|m)[jt]s?(x)
**/*.e2e.?(c|m)[jt]s?(x)
**/*.mock.?(c|m)[jt]s?(x)
**/*.mocks.?(c|m)[jt]s?(x)
**/test/**/*.?(c|m)[jt]s?(x)
**/tests/**/*.?(c|m)[jt]s?(x)
**/mocks/**/*.?(c|m)[jt]s?(x)
**/testing-utils/**/*.?(c|m)[jt]s?(x)
**/test-utils/**/*.?(c|m)[jt]s?(x)
**/fixtures/**/*.?(c|m)[jt]s?(x)
**/*.config.?(c|m)[jt]s
**/.prettierrc.?(c|m)[jt]s
**/codegen.?(c|m)[jt]s
**/test-setup.?(c|m)[jt]s
🫴 Contributing
Node.js installation is a prerequisite (LTS version). Install dependencies with NPM:
npm install
To execute tests:
npm test
To generate documentation:
npm run docs