Skip to content

Instantly share code, notes, and snippets.

@gusflopes
Created October 29, 2019 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusflopes/c927002f91a983611f08bc485741db35 to your computer and use it in GitHub Desktop.
Save gusflopes/c927002f91a983611f08bc485741db35 to your computer and use it in GitHub Desktop.
ESlint and Prettier Initial Configuration

Configurações iniciais de um projeto com ESlint e Prettier

  1. Generate .editorconfig
  2. yarn add eslint -D
  3. yarn eslint --init e criar as configurações (Air BnB)
  4. Remover package-lock e rodar um yarn para organizar dependências
  5. Adicionar outras dependências: yarn add prettier eslint-config-prettier eslint-plugin-prettier babel-eslint -D
  6. Acrescentar configurações do ESlint
  7. Editar configurações do Prettier

EditorConfig

Mudar true para as 2 últimas opções e inserir end_of_line = lf

ESlint

Acrescentar o extends: prettier, prettier/react Incluir antes de parserOptions: `parser: 'babel-eslint', Usar as seguintes rules:

rules: {
    'prettier/prettier': 'error',
    'react/jsx-filename-extension': [
      'warn',
      { extensions: ['.jsx', '.js']}
    ],
    'import/prefer-default-export': 'off'
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment