eslint.base.config.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. module.exports = {
  6. plugins: ['prettier'],
  7. ignorePatterns: [
  8. '**/*.d.ts',
  9. '**/__mocks__',
  10. '**/node_modules',
  11. '**/build',
  12. '**/dist',
  13. '**/es',
  14. '**/lib',
  15. '**/.codebase',
  16. '**/.changeset',
  17. '**/config',
  18. '**/common/scripts',
  19. '**/output',
  20. 'error-log-str.js',
  21. '*.bundle.js',
  22. '*.min.js',
  23. '*.js.map',
  24. '**/*.log',
  25. '**/tsconfig.tsbuildinfo',
  26. '**/vitest.config.ts',
  27. 'package.json',
  28. '*.json',
  29. ],
  30. settings: {
  31. 'import/resolver': {
  32. node: {
  33. moduleDirectory: ['node_modules', 'src'],
  34. extensions: ['.js', '.jsx', '.ts', '.tsx'],
  35. },
  36. },
  37. react: {
  38. version: 'detect',
  39. },
  40. },
  41. rules: {
  42. 'prettier/prettier': [
  43. 'warn',
  44. {
  45. semi: true,
  46. singleQuote: true,
  47. printWidth: 100,
  48. usePrettierrc: false,
  49. },
  50. ],
  51. 'import/prefer-default-export': 'off',
  52. 'lines-between-class-members': 'warn',
  53. 'import/no-unresolved': 'warn',
  54. 'react/jsx-no-useless-fragment': 'off',
  55. 'no-unused-vars': 'off',
  56. 'no-redeclare': 'off',
  57. 'prefer-destructurin': 'off',
  58. 'no-underscore-dangle': 'off',
  59. 'no-empty-function': 'off',
  60. 'no-multi-assign': 'off',
  61. 'arrow-body-style': 'warn',
  62. 'no-useless-constructor': 'off',
  63. 'no-param-reassign': 'off',
  64. 'max-classes-per-file': 'off',
  65. 'grouped-accessor-pairs': 'off',
  66. 'no-plusplus': 'off',
  67. 'no-restricted-syntax': 'off',
  68. 'react/destructuring-assignment': 'off',
  69. 'import/extensions': 'off',
  70. 'consistent-return': 'off',
  71. 'jsx-a11y/no-static-element-interactions': 'off',
  72. 'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
  73. 'no-use-before-define': 'off',
  74. 'no-bitwise': 'off',
  75. 'no-case-declarations': 'off',
  76. 'react/no-array-index-key': 'off',
  77. 'react/require-default-props': 'off',
  78. 'no-dupe-class-members': 'off',
  79. 'react/self-closing-comp': ['error', { component: true, html: false }],
  80. 'react/jsx-props-no-spreading': 'off',
  81. 'no-console': ['error', { allow: ['warn', 'error'] }],
  82. 'no-shadow': 'off',
  83. 'class-methods-use-this': 'off',
  84. 'default-param-last': 'off',
  85. 'import/no-cycle': 'error',
  86. 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
  87. 'import/no-relative-packages': 'error',
  88. 'import/order': [
  89. 'warn',
  90. {
  91. groups: ['builtin', 'external', ['internal', 'parent', 'sibling', 'index'], 'unknown'],
  92. pathGroups: [
  93. { pattern: 'react*', group: 'builtin', position: 'before' },
  94. { pattern: '@/**', group: 'internal', position: 'before' },
  95. {
  96. pattern: './*.+(css|sass|less|scss|pcss|styl)',
  97. patternOptions: { dot: true, nocomment: true },
  98. group: 'unknown',
  99. position: 'after',
  100. },
  101. ],
  102. alphabetize: {
  103. order: 'desc',
  104. caseInsensitive: true,
  105. },
  106. pathGroupsExcludedImportTypes: ['builtin'],
  107. 'newlines-between': 'always',
  108. },
  109. ],
  110. },
  111. overrides: [
  112. {
  113. files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
  114. parserOptions: {
  115. ecmaFeatures: {
  116. jsx: true,
  117. },
  118. ecmaVersion: 'latest',
  119. sourceType: 'module',
  120. },
  121. },
  122. ],
  123. };