Skip to content

Commit f503789

Browse files
committedMar 4, 2025
Initialize all the config packages
1 parent 8337af4 commit f503789

33 files changed

+4583
-3716
lines changed
 

‎.github/workflows/tests.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
34-
node: ['20.x']
34+
node: ['22.x']
3535

3636
steps:
3737
- name: Checkout repo
@@ -68,7 +68,7 @@ jobs:
6868
strategy:
6969
fail-fast: false
7070
matrix:
71-
node: ['20.x']
71+
node: ['22.x']
7272
react:
7373
[
7474
{
@@ -130,7 +130,7 @@ jobs:
130130
strategy:
131131
fail-fast: false
132132
matrix:
133-
node: ['20.x']
133+
node: ['22.x']
134134
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
135135
react:
136136
[
@@ -194,7 +194,7 @@ jobs:
194194
strategy:
195195
fail-fast: false
196196
matrix:
197-
node: ['20.x']
197+
node: ['22.x']
198198
example:
199199
[
200200
'cra4',
@@ -264,7 +264,7 @@ jobs:
264264
strategy:
265265
fail-fast: false
266266
matrix:
267-
node: ['20.x']
267+
node: ['22.x']
268268
steps:
269269
- name: Checkout repo
270270
uses: actions/checkout@v4
@@ -296,7 +296,7 @@ jobs:
296296
strategy:
297297
fail-fast: false
298298
matrix:
299-
node: ['20.x']
299+
node: ['22.x']
300300
ts: ['5.3', '5.4', '5.5', 'next']
301301
example:
302302
[

‎packages/configs/eslint/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
*.log
3+
node_modules
4+
.vscode
5+
dist
6+
build
7+
temp
8+
.yalc
9+
yalc.lock
10+
tsconfig.vitest-temp.json
11+
.eslintcache
12+
*.tgz

‎packages/configs/eslint/README.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# ESLint Config
2+
3+
ESLint configuration tailored for Redux projects.
4+
5+
## Installation
6+
7+
#### NPM
8+
9+
```bash
10+
npm install --save-dev @reduxjs/eslint-config
11+
```
12+
13+
#### Yarn
14+
15+
```bash
16+
yarn add --dev @reduxjs/eslint-config
17+
```
18+
19+
#### PNPM
20+
21+
```bash
22+
pnpm add --save-dev @reduxjs/eslint-config
23+
```
24+
25+
#### Bun
26+
27+
```bash
28+
bun add --dev @reduxjs/eslint-config
29+
```
30+
31+
## Usage
32+
33+
**ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`**:
34+
35+
```ts
36+
import { reduxESLintConfig } from '@reduxjs/eslint-config'
37+
38+
export default reduxESLintConfig
39+
```
40+
41+
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)**:
42+
43+
```ts
44+
const { reduxESLintConfig } = require('@reduxjs/eslint-config')
45+
46+
module.exports = reduxESLintConfig
47+
```
48+
49+
**CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)**:
50+
51+
```ts
52+
module.exports = (async () =>
53+
(await import('@reduxjs/eslint-config')).reduxESLintConfig)()
54+
```
55+
56+
**CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)**:
57+
58+
```ts
59+
import ReduxESLintConfig = require('@reduxjs/eslint-config')
60+
import reduxESLintConfig = ReduxESLintConfig.reduxESLintConfig
61+
62+
export = reduxESLintConfig
63+
```
64+
65+
Navigating ESLint's configuration options can occasionally feel overwhelming, especially when trying to take advantage of TypeScript's strong typing for better IntelliSense support. To alleviate this complexity and enhance your development experience, we also provide a function called `createESLintConfig` that you can import and use to create your own ESLint configuration. This function already includes the default `reduxESLintConfig` and you can pass in an array of flat configs as additional overrides.
66+
67+
**ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`**:
68+
69+
```ts
70+
import { createESLintConfig } from '@reduxjs/eslint-config'
71+
72+
export default createESLintConfig([
73+
{
74+
rules: {
75+
'no-console': [0],
76+
},
77+
},
78+
{
79+
// ...Other additional overrides
80+
},
81+
])
82+
```
83+
84+
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)**:
85+
86+
```ts
87+
const { createESLintConfig } = require('@reduxjs/eslint-config')
88+
89+
module.exports = createESLintConfig([
90+
{
91+
rules: {
92+
'no-console': [0],
93+
},
94+
},
95+
{
96+
// ...Other additional overrides
97+
},
98+
])
99+
```
100+
101+
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)**:
102+
103+
```ts
104+
module.exports = (async () =>
105+
(await import('@reduxjs/eslint-config')).createESLintConfig([
106+
{
107+
rules: {
108+
'no-console': [0],
109+
},
110+
},
111+
{
112+
// ...Other additional overrides
113+
},
114+
]))()
115+
```
116+
117+
**CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)**:
118+
119+
```ts
120+
import ReduxESLintConfig = require('@reduxjs/eslint-config')
121+
import createESLintConfig = ReduxESLintConfig.createESLintConfig
122+
123+
export = createESLintConfig([
124+
{
125+
rules: {
126+
'no-console': [0],
127+
},
128+
},
129+
{
130+
// ...Other additional overrides
131+
},
132+
])
133+
```

‎packages/configs/eslint/package.json

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"name": "@reduxjs/eslint-config",
3+
"version": "0.0.1",
4+
"description": "ESLint configuration for Redux projects",
5+
"keywords": [
6+
"eslint",
7+
"config",
8+
"eslint-config",
9+
"reduxjs",
10+
"redux-toolkit",
11+
"configuration"
12+
],
13+
"homepage": "https://github.com/reduxjs/redux-toolkit/tree/master/packages/configs/eslint#readme",
14+
"bugs": {
15+
"url": "https://github.com/reduxjs/redux-toolkit/issues"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/reduxjs/redux-toolkit.git",
20+
"directory": "packages/configs/eslint"
21+
},
22+
"sideEffects": false,
23+
"type": "module",
24+
"exports": {
25+
".": {
26+
"bun": {
27+
"types": "./dist/index.d.ts",
28+
"default": "./src/index.ts"
29+
},
30+
"module-sync": {
31+
"types": "./dist/index.d.ts",
32+
"default": "./dist/index.js"
33+
},
34+
"module": {
35+
"types": "./dist/index.d.ts",
36+
"default": "./dist/index.js"
37+
},
38+
"import": {
39+
"types": "./dist/index.d.ts",
40+
"default": "./dist/index.js"
41+
},
42+
"default": {
43+
"types": "./dist/index.d.cts",
44+
"default": "./dist/index.cjs"
45+
}
46+
},
47+
"./package.json": "./package.json"
48+
},
49+
"main": "./dist/index.js",
50+
"module": "./dist/index.js",
51+
"source": "./src/index.ts",
52+
"types": "./dist/index.d.ts",
53+
"files": [
54+
"dist",
55+
"src"
56+
],
57+
"scripts": {
58+
"build": "tsup --config=$INIT_CWD/tsup.config.mts",
59+
"check-exports": "attw --pack $INIT_CWD",
60+
"check-package-json": "publint --strict $INIT_CWD",
61+
"clean": "rimraf $INIT_CWD/dist/",
62+
"prepack": "yarn clean && yarn build",
63+
"test-types": "tsc -p $INIT_CWD/tsconfig.json"
64+
},
65+
"dependencies": {
66+
"@eslint/js": "^9.21.0",
67+
"@typescript-eslint/utils": "^8.26.0",
68+
"eslint-config-prettier": "^10.0.2",
69+
"typescript-eslint": "^8.26.0"
70+
},
71+
"devDependencies": {
72+
"@arethetypeswrong/cli": "^0.17.4",
73+
"@reduxjs/tsconfig": "workspace:^",
74+
"@types/eslint-config-prettier": "^6.11.3",
75+
"@types/node": "^22.13.9",
76+
"eslint": "^9.21.0",
77+
"publint": "^0.3.8",
78+
"rimraf": "^6.0.1",
79+
"tsup": "^8.4.0",
80+
"typescript": "^5.8.2"
81+
},
82+
"peerDependencies": {
83+
"eslint": ">=8.56.0",
84+
"typescript": "*"
85+
},
86+
"peerDependenciesMeta": {
87+
"eslint": {
88+
"optional": true
89+
},
90+
"typescript": {
91+
"optional": true
92+
}
93+
},
94+
"publishConfig": {
95+
"access": "public",
96+
"provenance": true
97+
}
98+
}

0 commit comments

Comments
 (0)
Failed to load comments.