0.5.2 • Published 7 months ago
@davidenke/lint v0.5.2
@davidenke/lint
Install packages
Make sure to install the necessary peer dependencies eslint
, prettier
and typescript
.
npm i -D @davidenke/lint eslint prettier typescript
Prepare config
Create a eslint.config.js
file in the root of your project and add the following content:
import config from '@davidenke/lint';
export default config;
Using Typescript
If you intend to use Typescript for your config file, you just have to install typescript
.
Your config file can then renamed to eslint.config.ts
and look like this at minimum:
import config from '@davidenke/lint';
export default config;
But you may want to modify the config to your needs:
import config from '@davidenke/lint';
import type { Linter } from 'eslint';
export default [
...config,
// ignore generated stuff
{ ignores: ['src/generated'] },
// override rules for test files with mocha / chai
{
files: ['**/*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': ['off'],
},
},
] satisfies Linter.Config[];
Until eslint 9.18.0 some hacks have been necessary to make this work. If your stuck to an older version, you can use a release prior 0.3.0.
Using monorepos
Like the experimental typescript config flag above, the VSCode Eslint plugin can be configured to pick up the packages correctly by setting:
{
"eslint.workingDirectories": ["./packages/foo", "./packages/bar"]
}