.eslintrc.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const DOMGlobals = ['window', 'document']
  2. const NodeGlobals = ['module', 'require']
  3. module.exports = {
  4. parser: '@typescript-eslint/parser',
  5. parserOptions: {
  6. sourceType: 'module'
  7. },
  8. rules: {
  9. // most of the codebase are expected to be env agnostic
  10. 'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
  11. // since we target ES2015 for baseline support, we need to forbid object
  12. // rest spread usage (both assign and destructure)
  13. 'no-restricted-syntax': [
  14. 'error',
  15. 'ObjectExpression > SpreadElement',
  16. 'ObjectPattern > RestElement'
  17. ]
  18. },
  19. overrides: [
  20. // Packages targeting DOM
  21. {
  22. files: ['packages/{vue,runtime-dom}/**'],
  23. rules: {
  24. 'no-restricted-globals': ['error', ...NodeGlobals]
  25. }
  26. },
  27. // Packages targeting Node
  28. {
  29. files: ['packages/{compiler-sfc,compiler-ssr,server-renderer}/**'],
  30. rules: {
  31. 'no-restricted-globals': ['error', ...DOMGlobals],
  32. 'no-restricted-syntax': 'off'
  33. }
  34. },
  35. // Private package, no syntax restrictions
  36. {
  37. files: ['packages/template-explorer/**'],
  38. rules: {
  39. 'no-restricted-globals': ['error', ...NodeGlobals],
  40. 'no-restricted-syntax': 'off'
  41. }
  42. }
  43. ]
  44. }