.eslintrc.js 763 B

12345678910111213141516171819202122
  1. // ESLint rules specific to writing react components.
  2. module.exports = {
  3. rules: {
  4. // Prefer arrow functions when defining functional components
  5. // This enables the `export const Foo: FC<FooProps> = ({ bar }) => ...` style we prefer.
  6. 'react/function-component-definition': [
  7. 'warn',
  8. {
  9. namedComponents: 'arrow-function',
  10. unnamedComponents: 'arrow-function',
  11. },
  12. ],
  13. // In functional components, mostly ensures Props are defined above components.
  14. '@typescript-eslint/no-use-before-define': 'error',
  15. // React components tend to use named exports.
  16. // Additionally, the `export default function` syntax cannot be auto-fixed by eslint when using ts.
  17. 'import/prefer-default-export': 'off',
  18. },
  19. };