parserOptionsMapper.js 377 B

123456789101112131415161718192021222324
  1. const defaultParserOptions = {
  2. ecmaVersion: 2018,
  3. ecmaFeatures: {
  4. experimentalObjectRestSpread: true,
  5. jsx: true,
  6. },
  7. };
  8. export default function parserOptionsMapper({
  9. code,
  10. errors,
  11. options = [],
  12. parserOptions = {},
  13. }) {
  14. return {
  15. code,
  16. errors,
  17. options,
  18. parserOptions: {
  19. ...defaultParserOptions,
  20. ...parserOptions,
  21. },
  22. };
  23. }