UNPKG

putout

Version:

🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json

21 lines (17 loc) 426 B
export const parseError = (e, type = 'parser') => { const {line, column} = e.loc || { line: 1, column: 1, }; const rule = e.rule ? `${e.rule} (parser)` : type; const message = cutBrackets(e.message); return [{ rule, message, position: { line, column, }, }]; }; const cutBrackets = (a) => a.replace(/\s\(\d:\d+\)/, '');