eslint.config.mjs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import github from 'eslint-plugin-github'
  2. import jest from 'eslint-plugin-jest'
  3. const githubConfigs = github.getFlatConfigs()
  4. export default [
  5. {
  6. ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**']
  7. },
  8. githubConfigs.recommended,
  9. ...githubConfigs.typescript,
  10. {
  11. files: ['**/*.ts'],
  12. languageOptions: {
  13. parserOptions: {
  14. project: './tsconfig.json'
  15. }
  16. },
  17. rules: {
  18. 'eslint-comments/no-use': 'off',
  19. 'import/no-namespace': 'off',
  20. 'no-unused-vars': 'off',
  21. '@typescript-eslint/no-unused-vars': 'error',
  22. '@typescript-eslint/explicit-member-accessibility': [
  23. 'error',
  24. {accessibility: 'no-public'}
  25. ],
  26. '@typescript-eslint/no-require-imports': 'error',
  27. '@typescript-eslint/array-type': 'error',
  28. '@typescript-eslint/await-thenable': 'error',
  29. camelcase: 'off',
  30. '@typescript-eslint/explicit-function-return-type': [
  31. 'error',
  32. {allowExpressions: true}
  33. ],
  34. '@typescript-eslint/no-array-constructor': 'error',
  35. '@typescript-eslint/no-explicit-any': 'error',
  36. '@typescript-eslint/no-extraneous-class': 'error',
  37. '@typescript-eslint/no-floating-promises': 'error',
  38. '@typescript-eslint/no-for-in-array': 'error',
  39. '@typescript-eslint/no-inferrable-types': 'error',
  40. '@typescript-eslint/no-misused-new': 'error',
  41. '@typescript-eslint/no-namespace': 'error',
  42. '@typescript-eslint/no-non-null-assertion': 'warn',
  43. '@typescript-eslint/no-unnecessary-qualifier': 'error',
  44. '@typescript-eslint/no-unnecessary-type-assertion': 'error',
  45. '@typescript-eslint/no-useless-constructor': 'error',
  46. '@typescript-eslint/prefer-for-of': 'warn',
  47. '@typescript-eslint/prefer-function-type': 'warn',
  48. '@typescript-eslint/prefer-includes': 'error',
  49. '@typescript-eslint/prefer-string-starts-ends-with': 'error',
  50. '@typescript-eslint/promise-function-async': 'error',
  51. '@typescript-eslint/require-array-sort-compare': 'error',
  52. '@typescript-eslint/restrict-plus-operands': 'error',
  53. '@typescript-eslint/unbound-method': 'error'
  54. }
  55. },
  56. {
  57. files: ['__test__/**/*.ts'],
  58. ...jest.configs['flat/recommended']
  59. }
  60. ]