eslintDeps.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const DEPS_MAP = {
  2. base: {
  3. eslint: '^7.32.0',
  4. 'eslint-plugin-vue': '^8.0.3'
  5. },
  6. airbnb: {
  7. '@vue/eslint-config-airbnb': '^6.0.0',
  8. 'eslint-plugin-import': '^2.25.3',
  9. 'eslint-plugin-vuejs-accessibility': '^1.1.0'
  10. },
  11. prettier: {
  12. 'eslint-config-prettier': '^8.3.0',
  13. 'eslint-plugin-prettier': '^4.0.0',
  14. prettier: '^2.4.1'
  15. },
  16. standard: {
  17. '@vue/eslint-config-standard': '^6.1.0',
  18. 'eslint-plugin-import': '^2.25.3',
  19. 'eslint-plugin-node': '^11.1.0',
  20. 'eslint-plugin-promise': '^5.1.0'
  21. },
  22. typescript: {
  23. '@vue/eslint-config-typescript': '^9.1.0',
  24. '@typescript-eslint/eslint-plugin': '^5.4.0',
  25. '@typescript-eslint/parser': '^5.4.0'
  26. }
  27. }
  28. exports.DEPS_MAP = DEPS_MAP
  29. exports.getDeps = function (api, preset, rootOptions = {}) {
  30. const deps = Object.assign({}, DEPS_MAP.base, DEPS_MAP[preset])
  31. if (api.hasPlugin('typescript')) {
  32. Object.assign(deps, DEPS_MAP.typescript)
  33. }
  34. if (api.hasPlugin('babel') && !api.hasPlugin('typescript')) {
  35. Object.assign(deps, {
  36. '@babel/eslint-parser': '^7.12.16',
  37. '@babel/core': '^7.12.16'
  38. })
  39. }
  40. return deps
  41. }