.eslintrc.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2021-2024 Avaiga Private Limited
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  5. * the License. You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  10. * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  11. * specific language governing permissions and limitations under the License.
  12. */
  13. module.exports = {
  14. parser: "@typescript-eslint/parser", // Specifies the ESLint parser
  15. extends: [
  16. "plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
  17. "plugin:@typescript-eslint/recommended", // Uses the recommended rules from @typescript-eslint/eslint-plugin
  18. // "plugin:react/jsx-runtime", //using the new JSX transform from React 17
  19. ],
  20. plugins: ["@typescript-eslint", "react-hooks", "eslint-plugin-tsdoc"],
  21. parserOptions: {
  22. ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
  23. sourceType: "module", // Allows for the use of imports
  24. ecmaFeatures: {
  25. jsx: true, // Allows for the parsing of JSX
  26. },
  27. },
  28. rules: {
  29. // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
  30. "@typescript-eslint/explicit-function-return-type": "off",
  31. "@typescript-eslint/explicit-module-boundary-types": "off",
  32. "@typescript-eslint/no-unused-expressions": "off", // allows a && b()
  33. "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
  34. "react-hooks/exhaustive-deps": "error", // Checks effect dependencies
  35. "tsdoc/syntax": "off", // "warn" to check tsdoc syntax
  36. },
  37. settings: {
  38. react: {
  39. version: "detect", // Tells eslint-plugin-react to automatically detect the version of React to use
  40. },
  41. },
  42. };