|
| 1 | +--- |
| 2 | +title: ESLint Config |
| 3 | +description: Opinionated ESLint flat config for PleaseAI projects. |
| 4 | +navigation: |
| 5 | + icon: i-lucide-shield-check |
| 6 | +--- |
| 7 | + |
| 8 | +# ESLint Config |
| 9 | + |
| 10 | +`@pleaseai/eslint-config` is an opinionated ESLint flat config built on top of [`@antfu/eslint-config`](https://github.com/antfu/eslint-config). |
| 11 | + |
| 12 | +## Features |
| 13 | + |
| 14 | +- ESLint flat config format |
| 15 | +- Single quotes, no semicolons, 2-space indent |
| 16 | +- TypeScript support out of the box |
| 17 | +- Auto-detects `.gitignore` patterns |
| 18 | +- Re-exports all `@antfu/eslint-config` utilities |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +:::code-group |
| 23 | +```bash [bun] |
| 24 | +bun add -D @pleaseai/eslint-config eslint |
| 25 | +``` |
| 26 | + |
| 27 | +```bash [pnpm] |
| 28 | +pnpm add -D @pleaseai/eslint-config eslint |
| 29 | +``` |
| 30 | + |
| 31 | +```bash [npm] |
| 32 | +npm install -D @pleaseai/eslint-config eslint |
| 33 | +``` |
| 34 | +::: |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +Create an `eslint.config.ts` (or `eslint.config.mjs`) in your project root: |
| 39 | + |
| 40 | +```ts [eslint.config.ts] |
| 41 | +import pleaseai from '@pleaseai/eslint-config' |
| 42 | + |
| 43 | +export default pleaseai() |
| 44 | +``` |
| 45 | + |
| 46 | +### With Options |
| 47 | + |
| 48 | +The `pleaseai()` function accepts the same options as `@antfu/eslint-config`: |
| 49 | + |
| 50 | +```ts [eslint.config.ts] |
| 51 | +import pleaseai from '@pleaseai/eslint-config' |
| 52 | + |
| 53 | +export default pleaseai({ |
| 54 | + vue: true, |
| 55 | + react: true, |
| 56 | + // Override any @antfu/eslint-config option |
| 57 | +}) |
| 58 | +``` |
| 59 | + |
| 60 | +### With Additional Configs |
| 61 | + |
| 62 | +You can pass additional flat config items as rest arguments: |
| 63 | + |
| 64 | +```ts [eslint.config.ts] |
| 65 | +import pleaseai from '@pleaseai/eslint-config' |
| 66 | + |
| 67 | +export default pleaseai( |
| 68 | + { |
| 69 | + typescript: true, |
| 70 | + }, |
| 71 | + { |
| 72 | + rules: { |
| 73 | + 'no-console': 'warn', |
| 74 | + }, |
| 75 | + }, |
| 76 | +) |
| 77 | +``` |
| 78 | + |
| 79 | +## Defaults |
| 80 | + |
| 81 | +| Option | Value | |
| 82 | +|--------|-------| |
| 83 | +| `indent` | `2` (spaces) | |
| 84 | +| `quotes` | `single` | |
| 85 | +| `semi` | `false` | |
| 86 | +| `typescript` | `true` | |
| 87 | +| `gitignore` | `true` | |
| 88 | + |
| 89 | +## VS Code Integration |
| 90 | + |
| 91 | +Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add to your `.vscode/settings.json`: |
| 92 | + |
| 93 | +```json [.vscode/settings.json] |
| 94 | +{ |
| 95 | + "eslint.format.enable": true, |
| 96 | + "editor.codeActionsOnSave": { |
| 97 | + "source.fixAll.eslint": "explicit" |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
0 commit comments