Last active
February 19, 2020 17:04
-
-
Save victorcrbt/6d8b1737f251e0fce1244e487b5edb39 to your computer and use it in GitHub Desktop.
Root import on React with TypeScript
This file contains hidden or 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
module.exports = { | |
env: { | |
browser: true, | |
es6: true, | |
}, | |
extends: [ | |
'plugin:@typescript-eslint/recommended', | |
'plugin:react/recommended', | |
'airbnb', | |
'plugin:import/typescript', | |
], | |
globals: { | |
Atomics: 'readonly', | |
SharedArrayBuffer: 'readonly', | |
}, | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
ecmaFeatures: { | |
jsx: true, | |
}, | |
ecmaVersion: 2018, | |
sourceType: 'module', | |
}, | |
plugins: ['react', '@typescript-eslint', 'import', 'jsx-a11y', 'react-hooks'], | |
rules: { | |
// Permite o uso de JSX em apenas arquivos com a extensão .tsx | |
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }], | |
// Permite que nunca seja necessário informar a extensão quando a extensão dos arquivos forem qualquer uma que esteja dentro do objeto | |
'import/extensions': [ | |
'error', | |
{ | |
ts: 'never', | |
tsx: 'never', | |
js: 'never', | |
jsx: 'never', | |
}, | |
], | |
}, | |
settings: { | |
'import/resolver': { | |
// Configura o resolver do node para reconhecer arquivos com extensão .ts e .tsx | |
node: { | |
extensions: ['.ts', '.tsx', '.js', '.jsx'], | |
}, | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment