39
loading...
This website collects cookies to deliver better user experience
prettier
and eslint
to format our code and enforce a consistent code style across our projects. We can save time by automatically formatting pasted code, or fix lint
errors while writing code, without running lint command to see all the errors.ext install esbenp.prettier-vscode
ext install dbaeumer.vscode-eslint
.vscode/settings.json
in the root of our monorepo and let's add the following settings:{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"search.exclude": {
"**/node_modules": true,
"**/.nyc_output": true,
"**/.rush": true
},
"files.exclude": {
"**/.nyc_output": true,
"**/.rush": true,
"**/*.build.log": true,
"**/*.build.error.log": true,
"**/generated-docs": true,
"**/package-deps.json": true,
"**/test-apps/**/build": true
},
"files.trimTrailingWhitespace": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"eslint.nodePath": "common/temp/node_modules",
"eslint.trace.server": "verbose",
"eslint.options": {
"resolvePluginsRelativeTo": "node_modules/@monorepo/eslint-config"
},
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"editor.codeActionsOnSave": {
"editor.action.fixAll": true,
"source.fixAll.eslint": true
}
}
node_modules
and .nyc_output
eslint
directly (we're using lint
script from react-scripts
) so we're helping the extension to find the eslint
binary.eslint
plugins. We're helping ESLint extension to pick up the right rules for each project.