diff --git a/src/compiler/parse/errors.ts b/src/compiler/parse/errors.ts new file mode 100644 index 0000000000..b563b7572a --- /dev/null +++ b/src/compiler/parse/errors.ts @@ -0,0 +1,192 @@ +// All parser errors should be listed and accessed from here + +import list from '../utils/list'; + +/** + * @internal + */ +export default { + css_syntax_error: (message) => ({ + code: 'css-syntax-error', + message + }), + duplicate_attribute: { + code: 'duplicate-attribute', + message: 'Attributes need to be unique' + }, + duplicate_element: (slug: string, name: string) => ({ + code: `duplicate-${slug}`, + message: `A component can only have one <${name}> tag` + }), + duplicate_style: { + code: 'duplicate-style', + message: 'You can only have one top-level