You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.eslintrc 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {
  2. "extends": ["sonarqube", "./.eslintrc-typescript"],
  3. "plugins": ["header", "typescript-sort-keys", "eslint-plugin-local-rules"],
  4. "root": true,
  5. "rules": {
  6. // Custom SonarCloud config that differs from eslint-config-sonarqube
  7. "camelcase": "off",
  8. "react/jsx-sort-props": "error",
  9. "react/jsx-pascal-case": [2, { "allowNamespace": true }],
  10. "react/jsx-no-constructed-context-values": "error",
  11. "react/jsx-uses-react": "off",
  12. "react/no-unstable-nested-components": ["error", { "allowAsProps": true }],
  13. "react/react-in-jsx-scope": "off",
  14. "testing-library/no-node-access": ["error", { "allowContainerFirstChild": true }],
  15. "no-implicit-coercion": [2, { "boolean": true, "number": true, "string": true }],
  16. "jest/no-large-snapshots": ["warn", { "maxSize": 200 }],
  17. "import/no-default-export": "warn",
  18. // Local rules
  19. "local-rules/use-componentqualifier-enum": "warn",
  20. "local-rules/use-metrickey-enum": "warn",
  21. "local-rules/use-metrictype-enum": "warn",
  22. "local-rules/use-visibility-enum": "warn",
  23. "local-rules/convert-class-to-function-component": "warn",
  24. "local-rules/no-conditional-rendering-of-spinner": "warn",
  25. "local-rules/use-jest-mocked": "warn",
  26. // New rules added after updating eslint packages to more recent versions than eslint-config-sonarqube
  27. "jest/prefer-mock-promise-shorthand": "error",
  28. "header/header": [
  29. "error",
  30. "block",
  31. [
  32. "",
  33. " * SonarQube",
  34. " * Copyright (C) 2009-2024 SonarSource SA",
  35. " * mailto:info AT sonarsource DOT com",
  36. " *",
  37. " * This program is free software; you can redistribute it and/or",
  38. " * modify it under the terms of the GNU Lesser General Public",
  39. " * License as published by the Free Software Foundation; either",
  40. " * version 3 of the License, or (at your option) any later version.",
  41. " *",
  42. " * This program is distributed in the hope that it will be useful,",
  43. " * but WITHOUT ANY WARRANTY; without even the implied warranty of",
  44. " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU",
  45. " * Lesser General Public License for more details.",
  46. " *",
  47. " * You should have received a copy of the GNU Lesser General Public License",
  48. " * along with this program; if not, write to the Free Software Foundation,",
  49. " * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.",
  50. " "
  51. ],
  52. 1
  53. ],
  54. "typescript-sort-keys/interface": "error",
  55. "promise/catch-or-return": ["warn", { "allowThen": true, "allowFinally": true }]
  56. },
  57. "overrides": [
  58. {
  59. "files": ["*-stories.tsx"],
  60. "rules": {
  61. "react/function-component-definition": "off"
  62. }
  63. },
  64. {
  65. "files": ["*-test.tsx"],
  66. "rules": {
  67. "react/jsx-no-constructed-context-values": "off"
  68. }
  69. }
  70. ],
  71. "settings": {
  72. "testing-library/utils-module": "~helpers/testUtils"
  73. }
  74. }