@20i/eslint-config v4.0.10
eslint-config-20i
Auto Install
Use mrm to install all dependencies and add config files.
npx mrm eslint --preset @20i/mrm-presetManual Install
Install dev dependencies:
yarn add -D eslint prettier typescript @20i/eslint-config # or npm i -D eslint prettier typescript @20i/eslint-configCreate 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/reactinstead.Add a special
tsconfig.jsonfile 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
.prettierrcfile:{ "endOfLine": "auto", "semi": false, "trailingComma": "es5" }
Configure VS Code
Make sure these extensions are installed:
- ESlint
- Prettier - Code formatter
Install from the links above or via terminal:
code --install-extension dbaeumer.vscode-eslint && \ code --install-extension esbenp.prettier-vscode
Add the following to your global
~/.vscode/settings.jsonfile:{ "editor.codeActionsOnSave": { "source.fixAll": true }, // format on save for everything, but what prettier will handle through eslint "editor.formatOnSave": true, "[javascriptreact]": { "editor.formatOnSave": false, }, "[javascript]": { "editor.formatOnSave": false, }, "[typescript]": { "editor.formatOnSave": false, }, "[typescriptreact]": { "editor.formatOnSave": false, }, }Restart VS Code
References
Inspired heavily by eslint-config-wesbos
8 months ago
9 months ago
12 months ago
8 months ago
9 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago