-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template Specification #1535
base: master
Are you sure you want to change the base?
Template Specification #1535
Conversation
That's a good start. This would be useful for eslint-plugin-vue parser, etc, but I'm more interested in spec for the sections. For example, is The current spec is pretty loose: https://vue-loader.vuejs.org/spec.html#vue-single-file-component-sfc-spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good addition too. 👍 I agree with @octref that some more detail on block parsing would be great, but I think that should probably be added in a separate PR, since this one is focused on template parsing specifically.
I like this! This would definitely be nice to have for tooling authors and also for ourselves (to discover and formally resolve edge cases). One improvement we can do is to use a more formal grammar description along the lines of BNF. The ECMAScript spec uses something similar: https://www.ecma-international.org/ecma-262/9.0/index.html#sec-names-and-keywords There are also parser-generator tools that can take a BNF-like grammar and automatically generate parsers, e.g. antlr, jison (a JavaScript port of bison). The Antlr v4 HTML grammar files can be a good source of reference. |
Also, like @octref said, we also want a more well-defined version of the SFC spec. However, I think the SFC spec and the Vue template spec should be separate. The SFC spec should live inside component-compiler-utils, and the template spec should live inside Vue core repo. |
Just today I run into an issue where spec for template would help: vuejs/vetur#1189. Would unquoted attributes be valid for Vue templates? |
Re unquoted attributes: should be consistent with HTML. i.e. |
- A JavaScript expression which must not include following characters: | ||
- `\t` (tab) | ||
- `\r` (carriage return) | ||
- `\n` (new lint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `\n` (new lint) | |
- `\n` (new line) |
preview
cc: @chrisvfritz @octref @yyx990803