-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4969e6d
commit 5c39c6f
Showing
30 changed files
with
2,457 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.DS_Store | ||
*.log | ||
node_modules | ||
.vscode | ||
dist | ||
build | ||
temp | ||
.yalc | ||
yalc.lock | ||
tsconfig.vitest-temp.json | ||
.eslintcache | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# ESLint Config | ||
|
||
ESLint configuration tailored for Redux projects. | ||
|
||
## Installation | ||
|
||
#### NPM | ||
|
||
```bash | ||
npm install --save-dev @reduxjs/eslint-config | ||
``` | ||
|
||
#### Yarn | ||
|
||
```bash | ||
yarn add --dev @reduxjs/eslint-config | ||
``` | ||
|
||
#### PNPM | ||
|
||
```bash | ||
pnpm add --save-dev @reduxjs/eslint-config | ||
``` | ||
|
||
#### Bun | ||
|
||
```bash | ||
bun add --dev @reduxjs/eslint-config | ||
``` | ||
|
||
## Usage | ||
|
||
**ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`**: | ||
|
||
```ts | ||
import { reduxESLintConfig } from '@reduxjs/eslint-config' | ||
|
||
export default reduxESLintConfig | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)**: | ||
|
||
```ts | ||
const { reduxESLintConfig } = require('@reduxjs/eslint-config') | ||
|
||
module.exports = reduxESLintConfig | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cjs` or `eslint.config.cts` (using dynamic import)**: | ||
|
||
```ts | ||
module.exports = (async () => | ||
(await import('@reduxjs/eslint-config')).reduxESLintConfig)() | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)**: | ||
|
||
```ts | ||
import ReduxESLintConfig = require('@reduxjs/eslint-config') | ||
import reduxESLintConfig = ReduxESLintConfig.reduxESLintConfig | ||
|
||
export = reduxESLintConfig | ||
``` | ||
|
||
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. | ||
|
||
**ECMAScript Modules (ESM) usage inside a file like `eslint.config.mts` or `eslint.config.mjs`**: | ||
|
||
```ts | ||
import { createESLintConfig } from '@reduxjs/eslint-config' | ||
|
||
export default createESLintConfig([ | ||
{ | ||
rules: { | ||
'no-console': [0], | ||
}, | ||
}, | ||
{ | ||
// ...Other additional overrides | ||
}, | ||
]) | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using `require`)**: | ||
|
||
```ts | ||
const { createESLintConfig } = require('@reduxjs/eslint-config') | ||
|
||
module.exports = createESLintConfig([ | ||
{ | ||
rules: { | ||
'no-console': [0], | ||
}, | ||
}, | ||
{ | ||
// ...Other additional overrides | ||
}, | ||
]) | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cts` or `eslint.config.cjs` (using dynamic import)**: | ||
|
||
```ts | ||
module.exports = (async () => | ||
(await import('@reduxjs/eslint-config')).createESLintConfig([ | ||
{ | ||
rules: { | ||
'no-console': [0], | ||
}, | ||
}, | ||
{ | ||
// ...Other additional overrides | ||
}, | ||
]))() | ||
``` | ||
|
||
**CommonJS (CJS) usage inside a file like `eslint.config.cts` (using import and export assignment)**: | ||
|
||
```ts | ||
import ReduxESLintConfig = require('@reduxjs/eslint-config') | ||
import createESLintConfig = ReduxESLintConfig.createESLintConfig | ||
|
||
export = createESLintConfig([ | ||
{ | ||
rules: { | ||
'no-console': [0], | ||
}, | ||
}, | ||
{ | ||
// ...Other additional overrides | ||
}, | ||
]) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"name": "@reduxjs/eslint-config", | ||
"version": "0.0.1", | ||
"description": "ESLint configuration for Redux projects", | ||
"keywords": [ | ||
"eslint", | ||
"config", | ||
"eslint-config", | ||
"reduxjs", | ||
"redux-toolkit", | ||
"configuration" | ||
], | ||
"homepage": "https://github.com/reduxjs/redux-toolkit/tree/master/packages/configs/eslint#readme", | ||
"bugs": { | ||
"url": "https://github.com/reduxjs/redux-toolkit/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/reduxjs/redux-toolkit.git", | ||
"directory": "packages/configs/eslint" | ||
}, | ||
"sideEffects": false, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"module-sync": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"module": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"default": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"source": "./src/index.mts", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"build": "yarn clean && tsup", | ||
"clean": "rimraf dist", | ||
"prepack": "yarn build" | ||
}, | ||
"dependencies": { | ||
"@eslint/js": "^9.17.0", | ||
"@typescript-eslint/utils": "^8.18.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"typescript-eslint": "^8.18.1" | ||
}, | ||
"devDependencies": { | ||
"@reduxjs/tsconfig": "workspace:^", | ||
"@types/eslint-config-prettier": "^6.11.3", | ||
"eslint": "^9.17.0", | ||
"rimraf": "^6.0.1", | ||
"tsup": "^8.3.5", | ||
"typescript": "^5.7.2" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=8.56.0", | ||
"typescript": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"eslint": { | ||
"optional": true | ||
}, | ||
"typescript": { | ||
"optional": true | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.