Typescript ESLint config
LintUse provides a Typescript ESLint config to help you lint your Typescript code.
The config is based on the typescript-eslint plugin.
Prerequisites
- Install necessary dependencies:
sh
npm install -D lodash desm
1
sh
pnpm add -D lodash desm
1
sh
yarn add -D lodash desm
1
sh
bun add -D lodash desm
1
- Create a
tsconfig.json
file.
See What is a tsconfig.json for more information.
Configuration
js
import { eslint } from "@ljtang2009/lint-use";
import _ from "lodash";
import { dirname, join } from 'desm';
export default [
{
..._.merge(_.cloneDeep(eslint.ts.default), {
files: ['src/**/*.ts'],
languageOptions: {
parserOptions: {
project: join(import.meta.url, 'tsconfig.json'),
tsconfigRootDir: dirname(import.meta.url),
},
},
}),
},
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Configure ESlint reference ESLint official documentation.
Usage
sh
npx eslint .
1