Skip to content

Commit 4d3698a

Browse files
committedJan 7, 2025
Initialize all the config packages
1 parent 6a46588 commit 4d3698a

30 files changed

+2272
-280
lines changed
 

‎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

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
"exports": {
24+
"./package.json": "./package.json",
25+
".": {
26+
"module-sync": {
27+
"types": "./dist/index.d.mts",
28+
"default": "./dist/index.mjs"
29+
},
30+
"module": {
31+
"types": "./dist/index.d.mts",
32+
"default": "./dist/index.mjs"
33+
},
34+
"import": {
35+
"types": "./dist/index.d.mts",
36+
"default": "./dist/index.mjs"
37+
},
38+
"default": {
39+
"types": "./dist/index.d.ts",
40+
"default": "./dist/index.js"
41+
}
42+
}
43+
},
44+
"main": "./dist/index.js",
45+
"module": "./dist/index.mjs",
46+
"source": "./src/index.mts",
47+
"types": "./dist/index.d.ts",
48+
"files": [
49+
"dist",
50+
"src"
51+
],
52+
"scripts": {
53+
"build": "yarn clean && tsup",
54+
"clean": "rimraf dist",
55+
"prepack": "yarn build"
56+
},
57+
"dependencies": {
58+
"@eslint/js": "^9.17.0",
59+
"@typescript-eslint/utils": "^8.19.1",
60+
"eslint-config-prettier": "^9.1.0",
61+
"typescript-eslint": "^8.19.1"
62+
},
63+
"devDependencies": {
64+
"@reduxjs/tsconfig": "workspace:^",
65+
"@types/eslint-config-prettier": "^6.11.3",
66+
"eslint": "^9.17.0",
67+
"rimraf": "^6.0.1",
68+
"tsup": "^8.3.5",
69+
"typescript": "^5.7.2"
70+
},
71+
"peerDependencies": {
72+
"eslint": ">=8.56.0",
73+
"typescript": "*"
74+
},
75+
"peerDependenciesMeta": {
76+
"eslint": {
77+
"optional": true
78+
},
79+
"typescript": {
80+
"optional": true
81+
}
82+
},
83+
"publishConfig": {
84+
"access": "public"
85+
}
86+
}

0 commit comments

Comments
 (0)
Failed to load comments.