.eslintrc.json 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {
  2. "env": {
  3. "browser": true,
  4. "es2021": true
  5. },
  6. "extends": [
  7. "eslint:recommended",
  8. "plugin:react/recommended",
  9. "plugin:@typescript-eslint/recommended",
  10. "prettier"
  11. ],
  12. "parser": "@typescript-eslint/parser",
  13. "parserOptions": {
  14. "ecmaFeatures": {
  15. "jsx": true
  16. },
  17. "ecmaVersion": 12,
  18. "sourceType": "module"
  19. },
  20. "plugins": ["react", "@typescript-eslint"],
  21. "rules": /* 校验规则 */ {
  22. "semi": /* 结尾分号 */ ["error", "always"], // [错误级别: off|0 关闭;warn|1 警告(不退出);error|2 错误(退出);]
  23. // "quotes": /* 引号方式 */ ["error", "double"],
  24. "curly": [1, "all"],
  25. "no-eval": [2],
  26. "eqeqeq": [2, "always"],
  27. "react/prop-types": 0, //防止在react组件定义中缺少props验证
  28. "no-unused-expressions": [1, { "allowTernary": true }],
  29. "jsx-quotes": [2, "prefer-double"],
  30. // "indent": [2, 2,{"SwitchCase":1}],
  31. "indent": [2, 2, { "ignoredNodes": ["ConditionalExpression"],"SwitchCase":1 }],
  32. "block-spacing": [2, "always"],
  33. "keyword-spacing": /* 关键字前后空格 */ [
  34. 2,
  35. { "before": true, "after": true }
  36. ],
  37. "space-infix-ops": /* 操作符前后空格 */ "error",
  38. "@typescript-eslint/explicit-module-boundary-types": "off",
  39. "@typescript-eslint/no-var-requires": 0,
  40. "react/display-name": 0
  41. },
  42. "settings": {
  43. "react": {
  44. "createClass": "createReactClass",
  45. "pragma": "React",
  46. "fragment": "Fragment",
  47. "version": "detect",
  48. "flowVersion": "0.53"
  49. }
  50. },
  51. "globals": {
  52. "process": true,
  53. "module": true,
  54. "require": true
  55. }
  56. }