npm package: @planfredapp/eslint-config
Description: Shared ESLint 10 configurations for Planfred monorepo
Author: Planfred
Latest version: 1.2.0

# @planfredapp/eslint-config

[![npm version](https://img.shields.io/npm/v/@planfredapp/eslint-config.svg)](https://www.npmjs.com/package/@planfredapp/eslint-config)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

Shared ESLint 10 flat configs used in Planfred projects.

The package ships its plugins and parsers as dependencies. In consuming projects, `eslint` is the only required peer dependency.

## Requirements

- Node `^20.19.0 || ^22.13.0 || >=24`
- `eslint >= 10`
- An ESM flat config file such as `eslint.config.js` or `eslint.config.mjs`

## Installation

```bash
npm install --save-dev eslint @planfredapp/eslint-config
```

## Available Configs

| Config | Import Path | What It Adds |
| --- | --- | --- |
| Base | `@planfredapp/eslint-config` or `@planfredapp/eslint-config/base` | `@eslint/js`, import rules, promise rules, Node rules, stylistic rules, browser and Node globals |
| Vue | `@planfredapp/eslint-config/vue` | Base config, `eslint-plugin-vue` recommended flat config, Vue-specific style and correctness rules |
| Cypress | `@planfredapp/eslint-config/cypress` | Base config, `typescript-eslint` recommended rules, Cypress globals, `.only()` protection |
| Test | `@planfredapp/eslint-config/test` | Base config, Vitest recommended rules, test globals, `.only()` protection |

### Vue-Specific Assumptions

The Vue config contains a few project-structure assumptions:

- `src/**/*` must use `@` imports instead of relative imports
- `src/components/**/*` enforces component/file-name matching
- The config is intended for Vue 3 single-file components

## Usage

Use the entrypoint that matches the project you are linting.

### Base

```js
import config from '@planfredapp/eslint-config'

export default [
  ...config,
]
```

### Vue

```js
import config from '@planfredapp/eslint-config/vue'

export default [
  ...config,
]
```

### Cypress

```js
import config from '@planfredapp/eslint-config/cypress'

export default [
  ...config,
]
```

### Vitest

```js
import config from '@planfredapp/eslint-config/test'

export default [
  ...config,
]
```

## Customizing

Append your own config objects after the shared config:

```js
import vueConfig from '@planfredapp/eslint-config/vue'

export default [
  ...vueConfig,
  {
    ignores: [
      'dist/**',
      'coverage/**',
    ],
  },
  {
    rules: {
      'no-console': 'warn',
    },
  },
]
```

If you combine multiple specialized configs in one root `eslint.config.js`, scope the test-oriented ones to the files they should apply to:

```js
import baseConfig from '@planfredapp/eslint-config'
import cypressConfig from '@planfredapp/eslint-config/cypress'
import testConfig from '@planfredapp/eslint-config/test'

const scope = (configs, files) => configs.map(config => ({
  ...config,
  files,
}))

export default [
  ...baseConfig,
  ...scope(cypressConfig, [ 'cypress/**/*.{js,ts}' ]),
  ...scope(testConfig, [ 'test/**/*.{js,ts}' ]),
]
```

## What The Base Config Enforces

- 2-space indentation
- Single quotes
- No semicolons
- Trailing commas for multiline arrays, objects, imports, exports, and function params
- Blank lines between most statements
- Import ordering with grouped and alphabetized imports
- `no-var`, `prefer-const`, and a broad set of core correctness rules

## Development

```bash
npm run lint
npm run test:run
```

More details are in [TESTING.md](TESTING.md). Release history is in [CHANGELOG.md](CHANGELOG.md).

## License

[MIT](LICENSE)