Skip to main content

1.3 Linter y formateo

Mantener sintaxis y estandares de codificacion

Generalmente se utilizan formateadores de codigo y linters para prevenir errores

My tip

Se recomienda utilizar algun tipo de linter y/o formateador de codigo. Esto es asumiendo que utilizas eslint y prettier

  • .eslintrc.js
    module.exports = {
    root: true,
    extends: '@react-native-community',
    parser: '@typescript-eslint/parser',
    };
  • .eslintignore
    node_modules
    __tests__
    jest-setup.js
  • .prettierrc.js
    module.exports = {
    bracketSameLine: false,
    bracketSpacing: true,
    semi: true,
    singleQuote: true,
    trailingComma: 'all',
    tabWidth: 2,
    };
  • settings.json
    {
    "editor.rulers": [80],
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "breadcrumbs.enabled": false,
    "editor.stickyScroll.enabled": true,
    "editor.guides.bracketPairs": true,
    "editor.bracketPairColorization.enabled": true,
    "editor.linkedEditing": true,
    "editor.cursorBlinking": "expand",
    "editor.cursorStyle": "line",
    "editor.cursorSmoothCaretAnimation": "on",
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.codeActionsOnSave": {
    "source.organizeImports": "always"
    },
    "json.schemaDownload.enable": true
    }
  • extensions.json
    {
    "recommendations": [
    "eamodio.gitlens",
    "dbaeumer.vscode-eslint",
    "kisstkondoros.vscode-gutter-preview",
    "pkief.material-icon-theme",
    "esbenp.prettier-vscode",
    "tabnine.tabnine-vscode",
    "dsznajder.es7-react-js-snippets",
    "mgmcdermott.vscode-language-babel",
    "usernamehw.errorl"
    ]
    }