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
docs: fix ecmaVersion
in one example, add checks
#18241
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
Not sure we should update the examples - It seems more of an issue in the playground. Can we fix it in that, I mean, something like normalize the ecmaVersion to year-style, e.g. 6=>2015? |
Serialized configs are generated by our sites, so I think we don't need to support all variants. That said, the old demo (https://archive.eslint.org/demo) was using the 6, 7, 8... style, thus it's a good idea to normalize ecmaVersion in the Playground to support old links 👍 . I'll add normalization in eslint/eslint.org#509. But I'd still like to add this check to keep docs' configs consistent. What do you think? |
for consistency, I'm fine with it - seems it's most used in the docs. |
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.
LGTM. Just leaving open for a couple of days for others to get a chance to review.
There are 35 rule examples that use |
Yes, I'm planning to do that in another PR that will update links to send config in the flat format now that eslint/eslint.org#509 is merged. |
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.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
While testing eslint/eslint.org#509, I noticed that one example for the
strict
rule has"ecmaVersion": 6
in the configuration. This works mostly well because6
is an alias for2015
, but when the example is opened in the Playground, nothing is selected in the ECMA Version list:What changes did you make? (Give an overview)
"ecmaVersion": 2015
.tools/check-rule-examples.js
-ecmaVersion
, if present, must be one of 3, 5, 2015, 2016, ..., 2024 (the latest number)."latest"
string is also disallowed because it is unnecessary since it's the default.Is there anything you'd like reviewers to focus on?