@lemonbot.fun/eslint-config-base v2.8.0
lemonbot/eslint-config-base
Enhances Airbnb's ESLint config with TypeScript support
Setup
1) Install dependencies (and peer dependencies)
npm i eslint \
@lemonbot.fun/eslint-config-base \
@typescript-eslint/eslint-plugin@^7.0.0 \
@typescript-eslint/parser@^7.0.0 \
typescript \
-D
# eg: pnpm
pnpm add eslint \
@lemonbot.fun/eslint-config-base \
@typescript-eslint/eslint-plugin@^7.0.0 \
@typescript-eslint/parser@^7.0.0 \
typescript \
-D
# eg: yarn
yarn add eslint \
@lemonbot.fun/eslint-config-base \
@typescript-eslint/eslint-plugin@^7.0.0 \
@typescript-eslint/parser@^7.0.0 \
typescript \
--dev
2) Configure ESLint
Within your ESLint config file:
extends: [
require.resolve('@lemonbot.fun/eslint-config-base/index'),
]
3) Configure the ESLint TypeScript parser
This config requires knowledge of your TypeScript config.
In your ESLint config, set
parserOptions.project
to the path of your tsconfig.eslint.json
.
For example:
{
extends: [
'@lemonbot.fun/eslint-config-base'
],
+ parserOptions: {
+ project: './tsconfig.eslint.json'
+ }
}
4) Set module resolver.
- If you are not using compiler like
webpack
orrullup
, addeslint-import-resolver-typescript
to thedevDependencies
, add config toeslintrc
like blow.
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/resolver': {
'typescript': {
'alwaysTryTypes': true,
'project': './tsconfig.eslint.json',
}
}
},
- If you are not using webpack, add
eslint-import-resolver-webpack
to thedevDependencies
, add config toeslintrc
like blow.
settings: {settings: {
'import/resolver': {
webpack: {
config: './path-to-your-webpack.config.js',
}
}
},
4) Run ESLint
Open a terminal to the root of your project, and run the following command:
npx eslint . --ext .js,.jsx,.ts,.tsx
ESLint will lint all .js, .jsx, .ts, and .tsx files within the current folder, and output results to your terminal.
You can also get results in realtime inside most IDEs via a plugin.
Credits
Authored and maintained by Jason Chang (Lemonbot).
License
Open source licensed as MIT.
2 months ago
4 months ago
9 months ago
9 months ago
7 months ago
9 months ago
9 months ago
8 months ago
8 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago