@slhs/eslint-config
Version:
67 lines (48 loc) • 1.9 kB
Markdown
This is the SLHS [ESLint](https://eslint.org/) configuration.
[](https://www.npmjs.com/package/@slhs/eslint-config)
[](https://github.com/slhs/eslint-config/actions?query=workflow%3Aci)
This config uses the new
"[Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new)" format and
comes with some requirements:
- Node.js 20.0.0 or newer
- ESLint 8.57.0 or newer
- Your project to be in native ESM (`"type": "module"` in your `package.json`)
- VSCode must be configured to use the Flat Config file (`eslint.config.js`). You'll probably want
to enable this as a **workspace setting** (not a user setting) and check it in to source control:

### Install
```
npm install --save-dev @slhs/eslint-config
```
> Be sure to install the appropriately versioned `eslint` peer dependency as well.
### Usage
Follow the ESLint documentation on
[shared configurations](https://eslint.org/docs/latest/use/configure/configuration-files#using-a-shareable-configuration-package).
See the documentation on
[ignoring files](https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files) if you
need to ignore anything the config doesn't already ignore by default.
### Examples
#### `eslint.config.js`
```js
import { defineConfig } from 'eslint/config';
import slhsConfig from '@slhs/eslint-config';
const config = defineConfig([
slhsConfig,
{
// your optional overrides here
},
]);
export default config;
```
```
{
"scripts": {
...
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
...
}
}
```