.eslintrc.js 959 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. module.exports = {
  2. extends: require.resolve('@umijs/max/eslint'),
  3. globals: {
  4. REACT_APP_ENV: true
  5. },
  6. rules: {
  7. semi: ['error', 'never'],
  8. 'no-multiple-empty-lines': [1, { max: 2 }],
  9. 'no-use-before-define': 'off',
  10. 'comma-dangle': [2, 'never'],
  11. 'react/prop-types': 0,
  12. 'spaced-comment': 'error',
  13. 'react/no-array-index-key': 0,
  14. // 'array-bracket-spacing': ['error', 'always'], // 和prettier冲突
  15. 'object-curly-spacing': ['error', 'always'],
  16. // 'no-use-before-define': ['error', { functions: false }], // 允许在未定义function前调用
  17. 'react/self-closing-comp': [
  18. 'error',
  19. {
  20. component: true,
  21. html: true
  22. }
  23. ],
  24. 'react-hooks/exhaustive-deps': 0,
  25. 'no-unused-expressions': [
  26. 'error',
  27. {
  28. allowShortCircuit: true
  29. }
  30. ],
  31. '@typescript-eslint/no-unused-expressions': 0
  32. },
  33. settings: {
  34. react: {
  35. version: 'detect'
  36. }
  37. }
  38. }