.eslintrc.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /**
  2. * @type {import('eslint').Linter.Config}
  3. */
  4. module.exports = {
  5. extends: [
  6. 'next/core-web-vitals',
  7. 'weseek/react',
  8. ],
  9. plugins: [
  10. ],
  11. ignorePatterns: [
  12. 'dist/**',
  13. '**/dist/**',
  14. 'transpiled/**',
  15. 'public/**',
  16. 'src/linter-checker/**',
  17. 'tmp/**',
  18. 'next-env.d.ts',
  19. 'next.config.js',
  20. 'playwright.config.ts',
  21. 'test/integration/global-setup.js',
  22. 'test/integration/global-teardown.js',
  23. 'test/integration/setup-crowi.ts',
  24. 'test/integration/crowi/**',
  25. 'test/integration/middlewares/**',
  26. 'test/integration/migrations/**',
  27. 'test/integration/models/**',
  28. 'test/integration/service/**',
  29. 'test/integration/setup.js',
  30. 'test-with-vite/**',
  31. 'public/**',
  32. 'bin/**',
  33. 'config/**',
  34. 'src/styles/**',
  35. 'src/linter-checker/**',
  36. 'src/migrations/**',
  37. 'src/models/**',
  38. 'src/features/callout/**',
  39. 'src/features/comment/**',
  40. 'src/features/templates/**',
  41. 'src/features/mermaid/**',
  42. 'src/features/search/**',
  43. 'src/features/plantuml/**',
  44. 'src/features/external-user-group/**',
  45. 'src/features/page-bulk-export/**',
  46. 'src/features/growi-plugin/**',
  47. 'src/features/opentelemetry/**',
  48. 'src/features/rate-limiter/**',
  49. 'src/stores-universal/**',
  50. 'src/interfaces/**',
  51. 'src/utils/**',
  52. 'src/services/**',
  53. ],
  54. settings: {
  55. // resolve path aliases by eslint-import-resolver-typescript
  56. 'import/resolver': {
  57. typescript: {},
  58. },
  59. },
  60. rules: {
  61. 'no-restricted-imports': ['error', {
  62. name: 'axios',
  63. message: 'Please use src/utils/axios instead.',
  64. }],
  65. '@typescript-eslint/no-var-requires': 'off',
  66. // set 'warn' temporarily -- 2021.08.02 Yuki Takei
  67. '@typescript-eslint/no-use-before-define': ['warn'],
  68. '@typescript-eslint/no-this-alias': ['warn'],
  69. },
  70. overrides: [
  71. {
  72. // enable the rule specifically for JavaScript files
  73. files: ['*.js', '*.mjs', '*.jsx'],
  74. rules: {
  75. // set 'warn' temporarily -- 2023.08.14 Yuki Takei
  76. 'react/prop-types': 'warn',
  77. // set 'warn' temporarily -- 2023.08.14 Yuki Takei
  78. 'no-unused-vars': ['warn'],
  79. },
  80. },
  81. {
  82. // enable the rule specifically for TypeScript files
  83. files: ['*.ts', '*.mts', '*.tsx'],
  84. rules: {
  85. 'no-unused-vars': 'off',
  86. // set 'warn' temporarily -- 2023.08.14 Yuki Takei
  87. 'react/prop-types': 'warn',
  88. // set 'warn' temporarily -- 2022.07.25 Yuki Takei
  89. '@typescript-eslint/explicit-module-boundary-types': ['warn'],
  90. },
  91. },
  92. ],
  93. };