-
Install dev dependencies:
yarn add -D eslint prettier typescript @20i/eslint-config
npm i -D eslint prettier typescript @20i/eslint-config
-
Create a new file, .eslintrc.js
, in the directory of your project.
-
Add the following code to the file.
module.exports = {
extends: ["@20i/eslint-config"],
parserOptions: {
project: ["./tsconfig.eslint.json"],
},
ignorePatterns: [],
}
⚠️ For React projects, set @20i/eslint-config/react
instead.
-
Add a special tsconfig.json
file to your project: tsconfig.eslint.json
{
// extend your base config to share compilerOptions, etc
"extends": "./tsconfig.json",
"compilerOptions": {
// ensure that nobody can accidentally use this config for a build
"noEmit": true
},
"include": [
"**/*",
"**/.*"
],
}
-
Add the following to your .prettierrc
file:
{
"endOfLine": "auto",
"semi": false,
"trailingComma": "es5"
}