Skip to content

Commit 0eb61ff

Browse files
committed
Initialize all the config packages
1 parent c8bf86b commit 0eb61ff

33 files changed

+4118
-2860
lines changed

.github/workflows/test-configs.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Test Configs
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
test-types:
7+
name: Test types with TypeScript ${{ matrix.ts }} on ${{ matrix.os }} and Node.js ${{ matrix.node }}
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
fail-fast: false
12+
13+
matrix:
14+
package:
15+
[
16+
'@reduxjs/eslint-config',
17+
'@reduxjs/prettier-config',
18+
'@reduxjs/vitest-config',
19+
]
20+
node: ['22.x']
21+
os: [ubuntu-latest]
22+
ts: ['5.3', '5.4', '5.5', '5.6', '5.7', '5.8']
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Use node ${{ matrix.node }}
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: ${{ matrix.node }}
32+
cache: 'yarn'
33+
34+
- name: Install dependencies
35+
run: yarn install
36+
37+
- name: Install TypeScript ${{ matrix.ts }}
38+
run: yarn up typescript@${{ matrix.ts }}
39+
40+
- name: Run type tests
41+
run: yarn workspace ${{ matrix.package }} run test-types
42+
43+
are-the-types-wrong:
44+
name: Check if the type definitions for ${{ matrix.package }} are correct with Node.js ${{ matrix.node }} on ${{ matrix.os }}
45+
runs-on: ${{ matrix.os }}
46+
47+
strategy:
48+
fail-fast: false
49+
50+
matrix:
51+
node: ['22.x']
52+
package:
53+
[
54+
'@reduxjs/eslint-config',
55+
'@reduxjs/prettier-config',
56+
'@reduxjs/tsconfig',
57+
'@reduxjs/vitest-config',
58+
]
59+
os: [ubuntu-latest]
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Use node ${{ matrix.node }}
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: ${{ matrix.node }}
69+
cache: 'yarn'
70+
71+
- name: Install dependencies
72+
run: yarn install
73+
74+
- name: Run are-the-types-wrong for ${{ matrix.package }} with Node.js ${{ matrix.node }} on ${{ matrix.os }}
75+
run: yarn workspace ${{ matrix.package }} run check-exports --format table
76+
77+
- name: Did we fail?
78+
if: failure()
79+
run: ls -R
80+
81+
publint:
82+
name: Check if the package.json for ${{ matrix.package }} is correct with Node.js ${{ matrix.node }} on ${{ matrix.os }}
83+
runs-on: ${{ matrix.os }}
84+
85+
strategy:
86+
fail-fast: false
87+
88+
matrix:
89+
node: ['22.x']
90+
package:
91+
[
92+
'@reduxjs/eslint-config',
93+
'@reduxjs/prettier-config',
94+
'@reduxjs/tsconfig',
95+
'@reduxjs/vitest-config',
96+
]
97+
os: [ubuntu-latest]
98+
99+
steps:
100+
- name: Checkout repository
101+
uses: actions/checkout@v4
102+
103+
- name: Use node ${{ matrix.node }}
104+
uses: actions/setup-node@v4
105+
with:
106+
node-version: ${{ matrix.node }}
107+
cache: 'yarn'
108+
109+
- name: Install dependencies
110+
run: yarn install
111+
112+
- name: Run publint for ${{ matrix.package }} with Node.js ${{ matrix.node }} on ${{ matrix.os }}
113+
run: yarn workspace ${{ matrix.package }} run check-package-json
114+
115+
- name: Did we fail?
116+
if: failure()
117+
run: ls -R

packages/configs/eslint/.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.DS_Store
2+
*.log
3+
node_modules/
4+
dist/
5+
build/
6+
lib/
7+
.yalc/
8+
yalc.lock
9+
.idea/
10+
.vscode/
11+
temp/
12+
.temp/
13+
.tmp/
14+
.tmp-projections
15+
.rts2*
16+
coverage/
17+
.cache/
18+
.yarnrc
19+
.yarn/
20+
!.yarn/patches/
21+
!.yarn/releases/
22+
!.yarn/plugins/
23+
!.yarn/sdks/
24+
!.yarn/versions/
25+
.pnp.*
26+
*.tgz
27+
tsconfig*.vitest-temp.json
28+
.vitest-reports/
29+
.eslintcache
30+
tsconfig*.tsbuildinfo
31+
.docusaurus/

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

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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.24.0",
67+
"@typescript-eslint/utils": "^8.29.1",
68+
"eslint-config-prettier": "^10.1.2",
69+
"typescript-eslint": "^8.29.1"
70+
},
71+
"devDependencies": {
72+
"@arethetypeswrong/cli": "^0.17.4",
73+
"@reduxjs/tsconfig": "workspace:^",
74+
"@types/node": "^22.14.0",
75+
"eslint": "^9.24.0",
76+
"publint": "^0.3.11",
77+
"rimraf": "^6.0.1",
78+
"tsup": "^8.4.0",
79+
"typescript": "^5.8.3"
80+
},
81+
"peerDependencies": {
82+
"eslint": ">=8.56.0",
83+
"typescript": "*"
84+
},
85+
"peerDependenciesMeta": {
86+
"eslint": {
87+
"optional": true
88+
},
89+
"typescript": {
90+
"optional": true
91+
}
92+
},
93+
"publishConfig": {
94+
"access": "public",
95+
"provenance": true
96+
}
97+
}

0 commit comments

Comments
 (0)