Skip to content

Commit

Permalink
Initialize all the config packages
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Nov 6, 2024
1 parent 9b2d9d9 commit e2401a9
Show file tree
Hide file tree
Showing 30 changed files with 11,123 additions and 7,073 deletions.
12 changes: 12 additions & 0 deletions packages/configs/eslint/.gitignore
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
133 changes: 133 additions & 0 deletions packages/configs/eslint/README.md
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
},
])
```
86 changes: 86 additions & 0 deletions packages/configs/eslint/package.json
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.14.0",
"@typescript-eslint/utils": "^8.13.0",
"eslint-config-prettier": "^9.1.0",
"typescript-eslint": "^8.13.0"
},
"devDependencies": {
"@reduxjs/tsconfig": "workspace:^",
"@types/eslint-config-prettier": "^6.11.3",
"eslint": "^9.14.0",
"rimraf": "^6.0.1",
"tsup": "^8.3.5",
"typescript": "^5.6.3"
},
"peerDependencies": {
"eslint": ">= 8.56.0",
"typescript": "*"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
},
"typescript": {
"optional": true
}
},
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit e2401a9

Please sign in to comment.