.eslintrc.js 2.1 KB

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