.eslintrc.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. 'plugin:jest/recommended',
  7. ],
  8. env: {
  9. 'jest/globals': true,
  10. },
  11. globals: {
  12. },
  13. plugins: [
  14. 'jest',
  15. 'regex',
  16. ],
  17. rules: {
  18. 'import/prefer-default-export': 'off',
  19. 'import/order': [
  20. 'warn',
  21. {
  22. pathGroups: [
  23. {
  24. pattern: 'react',
  25. group: 'builtin',
  26. position: 'before',
  27. },
  28. {
  29. pattern: '^/**',
  30. group: 'parent',
  31. position: 'before',
  32. },
  33. {
  34. pattern: '~/**',
  35. group: 'parent',
  36. position: 'before',
  37. },
  38. {
  39. pattern: '*.css',
  40. group: 'type',
  41. patternOptions: { matchBase: true },
  42. position: 'after',
  43. },
  44. {
  45. pattern: '*.scss',
  46. group: 'type',
  47. patternOptions: { matchBase: true },
  48. position: 'after',
  49. },
  50. ],
  51. alphabetize: {
  52. order: 'asc',
  53. },
  54. pathGroupsExcludedImportTypes: ['react'],
  55. 'newlines-between': 'always',
  56. },
  57. ],
  58. '@typescript-eslint/no-explicit-any': 'off',
  59. '@typescript-eslint/explicit-module-boundary-types': 'off',
  60. indent: [
  61. 'error',
  62. 2,
  63. {
  64. SwitchCase: 1,
  65. ArrayExpression: 'first',
  66. FunctionDeclaration: { body: 1, parameters: 2 },
  67. FunctionExpression: { body: 1, parameters: 2 },
  68. },
  69. ],
  70. 'jest/no-standalone-expect': [
  71. 'error',
  72. { additionalTestBlockFunctions: ['each.test'] },
  73. ],
  74. 'regex/invalid': ['error', [
  75. {
  76. regex: '\\?\\<\\!',
  77. message: 'Do not use any negative lookbehind',
  78. }, {
  79. regex: '\\?\\<\\=',
  80. message: 'Do not use any Positive lookbehind',
  81. },
  82. ]],
  83. },
  84. overrides: [
  85. {
  86. // enable the rule specifically for TypeScript files
  87. files: ['*.ts', '*.tsx'],
  88. rules: {
  89. '@typescript-eslint/explicit-module-boundary-types': ['error'],
  90. },
  91. },
  92. ],
  93. };