.eslintrc.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ],
  19. plugins: [
  20. "@typescript-eslint",
  21. "react-hooks",
  22. "eslint-plugin-tsdoc"
  23. ],
  24. parserOptions: {
  25. ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
  26. sourceType: 'module', // Allows for the use of imports
  27. ecmaFeatures: {
  28. jsx: true, // Allows for the parsing of JSX
  29. },
  30. },
  31. rules: {
  32. // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
  33. "@typescript-eslint/explicit-function-return-type": "off",
  34. "@typescript-eslint/explicit-module-boundary-types": "off",
  35. "@typescript-eslint/no-unused-expressions": "off", // allows a && b()
  36. "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
  37. "react-hooks/exhaustive-deps": "error", // Checks effect dependencies
  38. "tsdoc/syntax": "off", // "warn" to check tsdoc syntax
  39. },
  40. settings: {
  41. react: {
  42. version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
  43. },
  44. },
  45. };