-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add emu-grammar lint rules from ecmarkup to Grammarkdown's grammar checker #68
Comments
Strictly speaking none of those are linting checks: they're error conditions, and will fail the build entirely if hit (by throwing). Contrast a genuine lint failure, which only fails the build if you pass If the types can be made precise enough to rule out those cases, I'd be very happy to drop those checks from ecmarkup. If not I'll probably keep them as-is, even if grammarkdown makes them impossible; they'd then basically just be assertions, which don't hurt much, and they please the type checker. (I'd update the error messages to make that clear.) And as you say, either way it's definitely nicer for grammarkdown to do these sorts of checks itself. |
In some cases, grammarkdown uses |
Makes sense. Presumably it generates diagnostics for those cases? (Or will, when this issue is closed.) If so, I'll probably convert these It'd be nice if the documentation could call out which fields which are typed as |
ecmarkup
has a few lint rules that grammarkdown doesn't enforce on its own, but that make sense:[empty]
assertions should have no other content: https://github.com/tc39/ecmarkup/blob/52df46d6177a14f6d101a34aecbebf5834c77571/src/lint/utils.ts#L70but not
operators cannot be empty: https://github.com/tc39/ecmarkup/blob/52df46d6177a14f6d101a34aecbebf5834c77571/src/lint/utils.ts#L132one of
operators cannot be empty: https://github.com/tc39/ecmarkup/blob/52df46d6177a14f6d101a34aecbebf5834c77571/src/lint/utils.ts#L144There are also a few cases that indicate some property types include
| undefined
that shouldn't, including:Production.body
(unconditionally set during parse)Argument.name
(unconditionally set during parse)In other cases,
grammarkdown
already reports errors during parse that are also being reported by lint:In general, I'd like to move a lot of these checks to
grammarkdown
since they aren't precisely "lint" checks (i.e., cases where you're enforcing stylistic consistency with otherwise acceptable source text), but rather are syntactic or semantic checks that should result ingrammarkdown
reporting errors regardless of consumer (be itecmarkup
, or thegrammarkdown-vscode
extension, etc.).cc: @bakkot
The text was updated successfully, but these errors were encountered: