.eslintrc.js 1.0 KB

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