.eslintrc.cjs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * This is intended to be a basic starting point for linting in your app.
  3. * It relies on recommended configs out of the box for simplicity, but you can
  4. * and should modify this configuration to best suit your team's needs.
  5. */
  6. /** @type {import('eslint').Linter.Config} */
  7. module.exports = {
  8. root: true,
  9. parserOptions: {
  10. ecmaVersion: "latest",
  11. sourceType: "module",
  12. ecmaFeatures: {
  13. jsx: true,
  14. },
  15. },
  16. env: {
  17. browser: true,
  18. commonjs: true,
  19. es6: true,
  20. },
  21. // Base config
  22. extends: ["eslint:recommended"],
  23. overrides: [
  24. // React
  25. {
  26. files: ["**/*.{js,jsx,ts,tsx}"],
  27. plugins: ["react", "jsx-a11y"],
  28. extends: [
  29. "plugin:react/recommended",
  30. "plugin:react/jsx-runtime",
  31. "plugin:react-hooks/recommended",
  32. "plugin:jsx-a11y/recommended",
  33. ],
  34. settings: {
  35. react: {
  36. version: "detect",
  37. },
  38. formComponents: ["Form"],
  39. linkComponents: [
  40. { name: "Link", linkAttribute: "to" },
  41. { name: "NavLink", linkAttribute: "to" },
  42. ],
  43. "import/resolver": {
  44. typescript: {},
  45. },
  46. },
  47. },
  48. // Typescript
  49. {
  50. files: ["**/*.{ts,tsx}"],
  51. plugins: ["@typescript-eslint", "import"],
  52. parser: "@typescript-eslint/parser",
  53. settings: {
  54. "import/internal-regex": "^~/",
  55. "import/resolver": {
  56. node: {
  57. extensions: [".ts", ".tsx"],
  58. },
  59. typescript: {
  60. alwaysTryTypes: true,
  61. },
  62. },
  63. },
  64. extends: [
  65. "plugin:@typescript-eslint/recommended",
  66. "plugin:import/recommended",
  67. "plugin:import/typescript",
  68. ],
  69. },
  70. // Node
  71. {
  72. files: [".eslintrc.js"],
  73. env: {
  74. node: true,
  75. },
  76. },
  77. ],
  78. };