-
Notifications
You must be signed in to change notification settings - Fork 193
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 check for syntax parsing and connectivity, fix missed syntaxes #597
Conversation
|
|
||
try { | ||
if (key.startsWith('@')) { | ||
const prelude = syntax.trim().replace(/\{(.|\s)+\}/, '').match(/^@\S+\s+([^;\{]*)/)[1].trim() || null; |
Check failure
Code scanning / CodeQL
Inefficient regular expression
Now it reports 5 new issues:
|
@teoli2003 Could you please comment on PR? |
Sorry, I missed this one. We want to retire this repository, so we prefer not to add non-data features. If you are using it and need help getting rid of it (by using w3c/webref) we would happily be available for a discussion. If your use case is not covered by w3c/webref, we would be happy to know about it. |
@teoli2003 I understand that you and other maintainers aim to minimize work on the Recently, I attempted to update to the latest version of
Specifically, there is a mistake in the Regarding your suggestion to transition to I also noticed a recent discussion about removing syntaxes from I believe that integrating the proposed linting enhancements would improve the quality of the data and prevent future errors, ultimately reducing maintenance effort in the long run. //cc @pepelsbey |
seems that |
There are pretty common problems when updating CSS syntax dictionaries:
This PR adds new 2 types of examination:
<type>
and<'property'>
), i.e. refer to existing definitions only.The new checking rules found issues (there are connectivity issues only, because parse errors are ignored in some cases, see bellow):
These issues were addressed in the PR as well:
<attr-name>
,<attr-fallback>
,<rounding-strategy>
,<url>
,<url-mofdifier>
,<declaration>
,<declaration-list>
,<forgiving-relative-selector-list>
,<forgiving-selector-list>
<unicode-range>
into<urange>
(see The Unicode-Range microsyntax and a record in change log)<language-code>
for[ <string> | <ident> ]
since there is no a definition forlanguage-code
anywhere in the CSS specs, but a prose for:lang()
claims that a value should beident
orstring
.<selector>
(used for::cue
/::cue()
) for<compound-selector>
, since there is no<selector>
definition (a "selector" meaning depends on context of use), but<compound-selector>
looks pretty close to what is described in the spec.cursor
property syntax:<x> <y>
-><number> <number>
, since there is no definitions forx
andy
. I think that that's an artefact of the legacy, because it's a pretty old definition and all other definitions have no such precision in a syntax part naming. Except forshape()
(see below).<shape>
which is using for deprecatedclip
property. So, the same here, it's an artefact of legacy. The syntax was extended to allow parameters with no comma, andshape
definition was renamed intorect()
according to the spec.Some exceptions was added to the lint script, to avoid parse error warnings for now:
@charset
at-rule: syntax should be@charset <string>
(current syntax has no parse error, but can't be used for a syntax matching since incorrect)ID selectors
: syntax should be"#" <ident>
Universal selectors
: syntax should be"*"
Adjacent sibling combinator
: syntax should be"+"
::after
,::before
,::first-letter
and::first-line
All these exceptions can (should) be eliminated, but it should be discussed. The only reason these things have an invalid syntax that's more readable for humans when displaying on MDN. However, looks like currently
mdn/data
is not used for MDN, therefore may be no reason for such deviations from the specs now.