Skip to content

Commit

Permalink
feat!: Provide ESLint v9 flat configs (#238)
Browse files Browse the repository at this point in the history
This is a major rewrite that migrates to ESLint v9, and exports a Flat
Config instead of the legacy config. The package is also now a pure
ESM package instead of CommonJS.

README.md describes how to utilize the new config format.

BREAKING CHANGE: There will be many changes in the lint results.
  • Loading branch information
meyfa authored Oct 13, 2024
1 parent 6a120a9 commit 5d86788
Show file tree
Hide file tree
Showing 13 changed files with 787 additions and 1,220 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.yml

This file was deleted.

59 changes: 47 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,63 @@

[![CI](https://github.com/meyfa/eslint-config/actions/workflows/main.yml/badge.svg)](https://github.com/meyfa/eslint-config/actions/workflows/main.yml)

ESLint config for personal TypeScript projects. It uses the RushStack patch to reduce dependency clutter.
ESLint config for personal TypeScript projects.

## Usage

Install ESLint, as well as this package (`-DE` means `--save-dev --save-exact`):

```sh
npm install -DE eslint@8 @meyfa/eslint-config
npm install -DE eslint@9 @meyfa/eslint-config
```

Then in the `.eslintrc.yml`:
Then in the `eslint.config.js`:

```yml
extends: '@meyfa/eslint-config'
parserOptions:
project: './tsconfig.eslint.json'
```js
import eslintConfig from '@meyfa/eslint-config'

export default [
...eslintConfig,
{
ignores: ['dist']
}
]
```

If needed, override the TypeScript config location (default: `./tsconfig.lint.json`):

```js
import eslintConfig from '@meyfa/eslint-config'

export default [
...eslintConfig,
{
ignores: ['dist']
},
{
languageOptions: {
parserOptions: {
project: './tsconfig.lint.json'
}
}
}
]
```

That's it! If the project requires JSDoc for some files, add the following to the `.eslintrc.yml`:
If the project requires JSDoc for some files, add the following:

```js
import eslintConfig from '@meyfa/eslint-config'
import eslintConfigJsdoc from '@meyfa/eslint-config/jsdoc'

```yml
overrides:
- files: ['src/**/*.ts']
extends: '@meyfa/eslint-config/jsdoc'
export default [
...eslintConfig,
{
ignores: ['dist']
},
{
...eslintConfigJsdoc,
files: ['src/**/*.ts']
}
]
```
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import eslintConfig from './dist/index.js'

export default [
...eslintConfig,
{
ignores: [
'dist',
'.idea',
'.vscode'
]
}
]
Loading

0 comments on commit 5d86788

Please sign in to comment.