.eslintrc.js 976 B

123456789101112131415161718192021222324252627282930
  1. /* eslint-disable no-undef */
  2. module.exports = {
  3. env: {
  4. node: true,
  5. es6: true
  6. },
  7. parser: '@typescript-eslint/parser',
  8. parserOptions: {
  9. ecmaVersion: 2020,
  10. project: ['./tsconfig.json'],
  11. tsconfigRootDir: __dirname,
  12. projectFolderIgnoreList: ['**/node_modules/**', './dist/**', './db/*', './logs/*'],
  13. createDefaultProgram: true
  14. },
  15. plugins: ['@typescript-eslint'],
  16. extends: [
  17. 'eslint:recommended',
  18. 'plugin:@typescript-eslint/recommended'
  19. ],
  20. rules: {
  21. 'no-var': 'error',
  22. 'no-extra-semi': 'off',
  23. 'quotes': [1, 'single'], // 必须使用单引号
  24. 'semi': [2, 'always'], //语句强制分号结尾
  25. 'max-len': ['warn', { code: 100, tabWidth: 2, ignoreUrls: true }],
  26. '@typescript-eslint/adjacent-overload-signatures': 'error', // 强制函数重载是连续的
  27. '@typescript-eslint/no-empty-function': 'off', // 允许空函数
  28. '@typescript-eslint/no-extra-semi': ['error'], // 多余分号去掉
  29. }
  30. };