.eslintrc.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. module.exports = {
  2. root: true, // https://eslint.org/docs/user-guide/configuring/configuration-files#cascading-and-hierarchy
  3. extends: [
  4. 'weseek',
  5. 'weseek/typescript',
  6. ],
  7. plugins: [
  8. 'regex',
  9. ],
  10. rules: {
  11. 'import/prefer-default-export': 'off',
  12. 'import/order': [
  13. 'warn',
  14. {
  15. pathGroups: [
  16. {
  17. pattern: '(vitest|vitest-mock-extended)',
  18. group: 'builtin',
  19. position: 'before',
  20. },
  21. {
  22. pattern: 'react',
  23. group: 'builtin',
  24. position: 'before',
  25. },
  26. {
  27. pattern: '^/**',
  28. group: 'parent',
  29. position: 'before',
  30. },
  31. {
  32. pattern: '~/**',
  33. group: 'parent',
  34. position: 'before',
  35. },
  36. {
  37. pattern: '*.css',
  38. group: 'type',
  39. patternOptions: { matchBase: true },
  40. position: 'after',
  41. },
  42. {
  43. pattern: '*.scss',
  44. group: 'type',
  45. patternOptions: { matchBase: true },
  46. position: 'after',
  47. },
  48. ],
  49. alphabetize: {
  50. order: 'asc',
  51. },
  52. pathGroupsExcludedImportTypes: ['react'],
  53. 'newlines-between': 'always',
  54. },
  55. ],
  56. '@typescript-eslint/no-explicit-any': 'off',
  57. '@typescript-eslint/explicit-module-boundary-types': 'off',
  58. indent: [
  59. 'error',
  60. 2,
  61. {
  62. SwitchCase: 1,
  63. ArrayExpression: 'first',
  64. FunctionDeclaration: { body: 1, parameters: 2 },
  65. FunctionExpression: { body: 1, parameters: 2 },
  66. },
  67. ],
  68. 'regex/invalid': ['error', [
  69. {
  70. regex: '\\?\\<\\!',
  71. message: 'Do not use any negative lookbehind',
  72. }, {
  73. regex: '\\?\\<\\=',
  74. message: 'Do not use any Positive lookbehind',
  75. },
  76. ]],
  77. },
  78. overrides: [
  79. {
  80. // enable the rule specifically for TypeScript files
  81. files: ['*.ts', '*.tsx'],
  82. rules: {
  83. '@typescript-eslint/explicit-module-boundary-types': ['error'],
  84. },
  85. },
  86. ],
  87. };