|
1 | 1 | # @code-pushup/eslint-config |
2 | 2 |
|
3 | 3 | [](https://www.npmjs.com/package/@code-pushup/eslint-config) |
| 4 | +[](https://github.com/code-pushup/eslint-config/actions/workflows/ci.yml?query=branch%3Amain) |
4 | 5 | [](https://opensource.org/licenses/MIT) |
5 | 6 |
|
6 | | -Recommended ESLint presets by [Code PushUp](https://github.com/code-pushup/cli/tree/main/packages/cli). |
| 7 | +Monorepo for [Code PushUp](https://github.com/code-pushup/cli) ESLint packages. |
7 | 8 |
|
8 | | -<!-- begin autogenerated --> |
| 9 | +## Packages |
9 | 10 |
|
10 | | -## ⚙️ Configs |
11 | | - |
12 | | -| Stack | Config | Description | |
13 | | -| :--------------------------------------------------------: | :------------------------------------------------------- | :------------------------------------------------------------------ | |
14 | | -|  | [javascript](./docs/javascript.md) | Default config, suitable for any **JavaScript/TypeScript** project. | |
15 | | -|  | [typescript](./docs/typescript.md) | Config for strict **TypeScript** projects. | |
16 | | -|  | [node](./docs/node.md) | Config for **Node.js** projects. | |
17 | | -|  | [angular](./docs/angular.md) | Config for **Angular** projects. | |
18 | | -|  | [ngrx](./docs/ngrx.md) | Config for **Angular** projects using **NgRx** library. | |
19 | | -|  | [react](./docs/react.md) | Config for **React** projects. | |
20 | | -|  | [graphql](./docs/graphql.md) | Config for **GraphQL servers** implemented in Node.js. | |
21 | | -|  | [jest](./docs/jest.md) | Config for projects using **Jest** for testing. | |
22 | | -|  | [vitest](./docs/vitest.md) | Config for projects using **Vitest** for testing. | |
23 | | -|  | [cypress](./docs/cypress.md) | Config for projects using **Cypress** for testing. | |
24 | | -|  | [playwright](./docs/playwright.md) | Config for projects using **Playwright** for testing. | |
25 | | -|  | [storybook](./docs/storybook.md) | Config for projects using **Storybook** for UI components. | |
26 | | -|  | [react-testing-library](./docs/react-testing-library.md) | Config for projects using **React Testing Library** for testing. | |
27 | | - |
28 | | -Some configs extend other configs, as illustrated below. So, for example, extending `angular` config implicitly extends `typescript` and `javascript` configs as well. |
29 | | - |
30 | | -```mermaid |
31 | | - graph BT; |
32 | | - typescript --extends--> javascript |
33 | | - node --extends--> javascript |
34 | | - angular --extends--> typescript |
35 | | - ngrx --extends--> angular |
36 | | - react --extends--> javascript |
37 | | - graphql --extends--> node |
38 | | -``` |
39 | | - |
40 | | -### 🏗️ Setup |
41 | | - |
42 | | -To use the default config, follow these steps: |
43 | | - |
44 | | -1. You must first install all the required peer dependencies (if you haven't already): |
45 | | - |
46 | | - ```sh |
47 | | - npm install -D eslint @eslint/js eslint-plugin-{functional,import,promise,sonarjs,unicorn} globals typescript-eslint |
48 | | - ``` |
49 | | - |
50 | | -2. Install `@code-pushup/eslint-config` with: |
51 | | - |
52 | | - ```sh |
53 | | - npm install -D @code-pushup/eslint-config |
54 | | - ``` |
55 | | - |
56 | | -3. Include default config in your [ESLint configuration file](https://eslint.org/docs/latest/use/configure/configuration-files) (usually `eslint.config.js`): |
57 | | - |
58 | | - ```js |
59 | | - import javascript from '@code-pushup/eslint-config/javascript.js'; |
60 | | - import { defineConfig } from 'eslint/config'; |
61 | | - |
62 | | - export default defineConfig(...javascript); |
63 | | - ``` |
64 | | - |
65 | | -Depending on your tech stack, you may wish to extend other configs as well ([listed above](#⚙️-configs)). This will require installing additional peer dependencies. For more details, refer to setup docs for the configs you're interested in using. |
66 | | - |
67 | | -#### 📦 Peer dependencies |
68 | | - |
69 | | -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. |
70 | | - |
71 | | -| | NPM package | Version | Required | |
72 | | -| :--------------------------------------------------------: | :--------------------------------------------------------------------------------------------------- | :----------------------------------------------: | :------: | |
73 | | -|  | [eslint](https://www.npmjs.com/package/eslint) | `^9.0.0` | ✅ | |
74 | | -|  | [@eslint/js](https://www.npmjs.com/package/@eslint/js) | `^9.0.0` | ✅ | |
75 | | -|  | [eslint-plugin-functional](https://www.npmjs.com/package/eslint-plugin-functional) | `^7.0.0 \|\| ^8.0.0 \|\| ^9.0.0` | ✅ | |
76 | | -|  | [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) | `^2.31.0` | ✅ | |
77 | | -|  | [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript) | `^3.0.0 \|\| ^4.0.0` | | |
78 | | -|  | [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise) | `>=6.4.0` | ✅ | |
79 | | -|  | [eslint-plugin-sonarjs](https://www.npmjs.com/package/eslint-plugin-sonarjs) | `^1.0.4` | ✅ | |
80 | | -|  | [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) | `>=50.0.0` | ✅ | |
81 | | -|  | [globals](https://www.npmjs.com/package/globals) | `>=14.0.0` | ✅ | |
82 | | -|  | [typescript-eslint](https://www.npmjs.com/package/typescript-eslint) | `^8.0.0` | ✅ | |
83 | | -|  | [@graphql-eslint/eslint-plugin](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin) | `^3.0.0 \|\| ^4.0.0` | | |
84 | | -|  | [@ngrx/eslint-plugin](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^18.0.0 \|\| ^19.0.0 \|\| ^20.0.0 \|\| ^21.0.0` | | |
85 | | -|  | [@vitest/eslint-plugin](https://www.npmjs.com/package/@vitest/eslint-plugin) | `^1.1.9` | | |
86 | | -|  | [angular-eslint](https://www.npmjs.com/package/angular-eslint) | `^18.0.0 \|\| ^19.0.0 \|\| ^20.0.0 \|\| ^21.0.0` | | |
87 | | -|  | [eslint-plugin-cypress](https://www.npmjs.com/package/eslint-plugin-cypress) | `>=3.3.0` | | |
88 | | -|  | [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest) | `^28.8.0 \|\| ^29.0.0` | | |
89 | | -|  | [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) | `^6.10.0` | | |
90 | | -|  | [eslint-plugin-n](https://www.npmjs.com/package/eslint-plugin-n) | `>=17.0.0` | | |
91 | | -|  | [eslint-plugin-playwright](https://www.npmjs.com/package/eslint-plugin-playwright) | `^2.1.0` | | |
92 | | -|  | [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) | `^7.36.0` | | |
93 | | -|  | [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) | `>=5.0.0` | | |
94 | | -|  | [eslint-plugin-rxjs-x](https://www.npmjs.com/package/eslint-plugin-rxjs-x) | `>=0.6.0` | | |
95 | | -|  | [eslint-plugin-storybook](https://www.npmjs.com/package/eslint-plugin-storybook) | `>=0.10.0` | | |
96 | | -|  | [eslint-plugin-testing-library](https://www.npmjs.com/package/eslint-plugin-testing-library) | `^7.1.1` | | |
97 | | - |
98 | | -### 🧪 Test overrides |
99 | | - |
100 | | -For non-production code, some rules are disabled (or downgraded from errors to warnings). |
101 | | - |
102 | | -This applies to file paths matching any of the following globs: |
103 | | - |
104 | | -- `**/*.spec.?(c|m)[jt]s?(x)` |
105 | | -- `**/*.test.?(c|m)[jt]s?(x)` |
106 | | -- `**/__tests__/**/*.?(c|m)[jt]s?(x)` |
107 | | -- `**/__mocks__/**/*.?(c|m)[jt]s?(x)` |
108 | | -- `**/*.cy.?(c|m)[jt]s?(x)` |
109 | | -- `**/*.stories.?(c|m)[jt]s?(x)` |
110 | | -- `**/*.e2e.?(c|m)[jt]s?(x)` |
111 | | -- `**/*.mock.?(c|m)[jt]s?(x)` |
112 | | -- `**/*.mocks.?(c|m)[jt]s?(x)` |
113 | | -- `**/test/**/*.?(c|m)[jt]s?(x)` |
114 | | -- `**/tests/**/*.?(c|m)[jt]s?(x)` |
115 | | -- `**/mocks/**/*.?(c|m)[jt]s?(x)` |
116 | | -- `**/testing-utils/**/*.?(c|m)[jt]s?(x)` |
117 | | -- `**/test-utils/**/*.?(c|m)[jt]s?(x)` |
118 | | -- `**/fixtures/**/*.?(c|m)[jt]s?(x)` |
119 | | -- `**/*.config.?(c|m)[jt]s` |
120 | | -- `**/.prettierrc.?(c|m)[jt]s` |
121 | | -- `**/codegen.?(c|m)[jt]s` |
122 | | -- `**/test-setup.?(c|m)[jt]s` |
123 | | - |
124 | | -<!-- end autogenerated --> |
125 | | - |
126 | | -## 🫴 Contributing |
127 | | - |
128 | | -Node.js installation is a prerequisite (LTS version). Install dependencies with NPM: |
129 | | - |
130 | | -```sh |
131 | | -npm install |
132 | | -``` |
133 | | - |
134 | | -To execute tests: |
135 | | - |
136 | | -```sh |
137 | | -npm test |
138 | | -``` |
139 | | - |
140 | | -To generate documentation: |
141 | | - |
142 | | -```sh |
143 | | -npm run docs |
144 | | -``` |
| 11 | +| Package | Description | |
| 12 | +| :------------------------------------------------------------------- | :------------------------------------------- | |
| 13 | +| [`@code-pushup/eslint-config`](./packages/eslint-config/README.md) | Recommended ESLint presets by Code PushUp | |
| 14 | +| `@code-pushup/create-eslint-config` | Interactive setup wizard _(coming soon)_ | |
0 commit comments