Skip to content

Instantly share code, notes, and snippets.

  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Rocketseat - Modulo 02 - Video 06:ESLint, Prettier e EditorConfig


yarn add eslint -D


yarn eslint --init
    3 > To check syntax, find problems, and enforce code style
    2 > Javascript modules (import/export)
    3 > None of these
    2 > Apenas NODE
    1 > Use a popular style guide
    1 > Airbnb  
    1 > JavaScript
    Y > Yes, (instalar with npm)

remover arquivo do npm: package-lock.json
yarn //atualizar as dependencias


Necessita ter a extensao instalada

Fazer com o ESLint rode ao salvar, corrigindo o codigo automaticamente

Instala o Prettier no desenvolvimento

yarn add prettier eslint-config-prettier eslint-plugin-prettier -D

Alterar o arquivo eslintrc.js

Adicionar o arquivo .prettierrc

aplica as correcoes em todos os arquivos JS na pasta SRC

yarn eslint --fix src --ext .js

Plugin EditorConfig para o VSCode

Gerar arquivo de configuracao, conforme anexo ou commit

DICAS do grupo do DISCORD

Se estiver usando prettier, é só adicionar essa linha nos settings.json:   
"prettier.singleQuote": true
ou false, se não quiser aspas simples
root = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
module.exports = {
env: {
es6: true,
node: true,
extends: [
'airbnb-base', 'prettier'
plugins : ['prettier'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
rules: {
"prettier/prettier": "error",
"class-methods-use-this": "off",
"no-param-reassign": "off",
"camelcase": "off",
"no-unused-vars": ["error", { "argsIgorePattern": "next" }],
"singleQuote": true,
"trailingComma": "es5"
"workbench.colorTheme": "Dracula",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 12,
"editor.lineHeight": 18,
"workbench.iconTheme": "material-icon-theme",
"editor.rulers": [
"editor.formatOnSave": false,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"language": "javascript",
"autoFix": true
"language": "javascriptreact",
"autoFix": true
"language": "typescript",
"autoFix": true
"language": "typescriptreact",
"autoFix": true
"editor.tabSize": 2,
"editor.renderLineHighlight": "gutter",
"terminal.integrated.fontSize": 12,
"emmet.syntaxProfiles": {
"javascript": "jsx"
"emmet.includeLanguages": {
"javascript": "javascriptreact"
"javascript.updateImportsOnFileMove.enabled": "never",
"breadcrumbs.enabled": true,
"editor.parameterHints.enabled": false,
"vsicons.dontShowNewVersionMessage": true,
"prettier.eslintIntegration": true,
"workbench.startupEditor": "newUntitledFile",
"window.zoomLevel": 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment