.eslintrc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. {
  2. "env": {
  3. "browser": true,
  4. "es6": true,
  5. "node": true
  6. },
  7. "parser": "@babel/eslint-parser",
  8. "parserOptions": {
  9. "ecmaVersion": 12,
  10. "sourceType": "module",
  11. "ecmaFeatures": {
  12. "jsx": true
  13. },
  14. "requireConfigFile": false,
  15. "babelOptions": {
  16. "babelrc": false,
  17. "configFile": false,
  18. "presets": ["@babel/preset-react"]
  19. }
  20. },
  21. "settings": {
  22. "react": {
  23. "version": "detect"
  24. }
  25. },
  26. "plugins": ["unused-imports"],
  27. "extends": ["eslint:recommended", "plugin:react/recommended"],
  28. "rules": {
  29. "semi": ["error", "always"],
  30. "indent": ["error", 2],
  31. // follow antd's style guide
  32. "quotes": ["error", "double"],
  33. "jsx-quotes": ["error", "prefer-double"],
  34. "space-in-parens": ["error", "never"],
  35. "object-curly-spacing": ["error", "never"],
  36. "array-bracket-spacing": ["error", "never"],
  37. "comma-spacing": ["error", { "before": false, "after": true }],
  38. "react/jsx-curly-spacing": [
  39. "error",
  40. { "when": "never", "allowMultiline": true, "children": true }
  41. ],
  42. "arrow-spacing": ["error", { "before": true, "after": true }],
  43. "space-before-blocks": ["error", "always"],
  44. "spaced-comment": ["error", "always"],
  45. "react/jsx-tag-spacing": ["error", { "beforeSelfClosing": "always" }],
  46. "block-spacing": ["error", "never"],
  47. "space-before-function-paren": ["error", "never"],
  48. "no-trailing-spaces": ["error", { "ignoreComments": true }],
  49. "eol-last": ["error", "always"],
  50. "no-var": ["error"],
  51. "prefer-const": [
  52. "error",
  53. {
  54. "destructuring": "all"
  55. }
  56. ],
  57. "curly": ["error", "all"],
  58. "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
  59. "no-mixed-spaces-and-tabs": "error",
  60. "sort-imports": [
  61. "error",
  62. {
  63. "ignoreDeclarationSort": true
  64. }
  65. ],
  66. "no-multiple-empty-lines": [
  67. "error",
  68. { "max": 1, "maxBOF": 0, "maxEOF": 0 }
  69. ],
  70. "space-unary-ops": ["error", { "words": true, "nonwords": false }],
  71. "space-infix-ops": "error",
  72. "key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
  73. "comma-style": ["error", "last"],
  74. "comma-dangle": [
  75. "error",
  76. {
  77. "arrays": "always-multiline",
  78. "objects": "always-multiline",
  79. "imports": "never",
  80. "exports": "never",
  81. "functions": "never"
  82. }
  83. ],
  84. "no-multi-spaces": ["error", { "ignoreEOLComments": true }],
  85. "unused-imports/no-unused-imports": "error",
  86. "unused-imports/no-unused-vars": [
  87. "error",
  88. {
  89. "vars": "all",
  90. "varsIgnorePattern": "^_",
  91. "args": "none",
  92. "argsIgnorePattern": "^_"
  93. }
  94. ],
  95. "no-unused-vars": "off",
  96. "react/no-deprecated": "error",
  97. "react/jsx-key": "error",
  98. "no-console": "error",
  99. "eqeqeq": "error",
  100. "keyword-spacing": "error",
  101. "react/prop-types": "off",
  102. "react/display-name": "off",
  103. "react/react-in-jsx-scope": "off",
  104. "no-case-declarations": "off"
  105. }
  106. }