Last active
May 28, 2019 11:18
-
-
Save tiagolpadua/6d1003b2f3930b5487bff4c1c1975ee0 to your computer and use it in GitHub Desktop.
Configurações de Plugins para o projeto InstaluraMobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Instalar o eslint e o prettier no projeto: | |
```bash | |
npm install -D eslint babel-eslint eslint-config-airbnb eslint-config-prettier \ | |
eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-prettier \ | |
eslint-plugin-react prettier | |
``` | |
- Criar o arquivo `.eslintrc` na raiz do projeto | |
``` | |
{ | |
"extends": ["airbnb", "prettier", "prettier/react"], | |
"parser": "babel-eslint", | |
"rules": { | |
"react/jsx-filename-extension": [ | |
1, | |
{ | |
"extensions": [".js", ".jsx"] | |
} | |
], | |
"no-use-before-define": "off", | |
"react/prop-types": "off", | |
"comma-dangle": "off", | |
"react/prefer-stateless-function": "off", | |
"prettier/prettier": [ | |
"error", | |
{ | |
"trailingComma": "es5", | |
"singleQuote": true, | |
"printWidth": 100 | |
} | |
] | |
}, | |
"globals": { | |
"fetch": false | |
}, | |
"plugins": ["prettier"] | |
} | |
``` | |
- Criar o arquivo `.editorconfig`: | |
``` | |
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
indent_size = 2 | |
indent_style = space | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
``` | |
- Instalar o plugin do eslint e do prettier no VSCode; | |
- Configurar o VSCode para formatar ao salvar: | |
File -> Prefferences -> Settings -> Folder Settings -> {} | |
``` | |
"settings": { | |
// other settings | |
// formatting using eslint | |
// let editor format using prettier for all other files | |
"editor.formatOnSave": true, | |
// disable editor formatting, so eslint can handle it | |
"[javascript]": { | |
"editor.formatOnSave": false | |
}, | |
// available through eslint plugin in vscode | |
"eslint.autoFixOnSave": true, | |
"eslint.alwaysShowStatus": true, | |
"javascript.validate.enable": false | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment