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
New: Add rule schemas (refs #2179) #2580
Conversation
"exceptions": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^([A-Z][a-z]*)+$": { |
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.
Should this be "^[A-Za-z]+$"
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.
Don't think so. I'm looking to match ESTree node types, which, so far, are PascalCased. I think that's what this does.
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.
...and now I see yours is a simpler version of the above. I'll change it, good call!
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.
Wait, mine is not a check for pascal case. It's just a check for a string of letters. Yours is a check for PascalCased string. Not 100% sure it's necessary, but those two RegEx do different things.
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 suppose the extra restriction can't hurt. I just pushed a commit to change it back.
I think this is ready to merge. It shouldn't affect anything, since it's not going to be enabled yet. |
New: Add rule schemas (refs #2179)
There are a lot of files in this PR, most of which are just adding schemas, so I've summarized the interesting changes below. Because this only adds schemas but does not enable any validation, there aren't any tests here to make sure the schemas are actually correct. I did that back in #2179, but I do anticipate that some will have fallen out of sync and will need to be updated when validation is enabled by a subsequent PR.
Docs
docs/developer-guide/working-with-rules.md
: Document the newschema
property exported by rules.Rule defaults
lib/rules/max-len.js
: Default to 4-space tabs and 80-character lines.tests/lib/rules/max-len.js
: Add tests for default option values.lib/rules/quotes.js
: Default to double quotes.tests/lib/rules/quotes.js
: Add tests for default option values.Invalid test cases
tests/lib/rules/comma-dangle.js
: Incorrect configuration values are now caught.tests/lib/rules/indent.js
: Incorrect configuration values are now caught.tests/lib/rules/newline-after-var.js
: Incorrect configuration values are now caught.tests/lib/rules/brace-style.js
: Test caseargs
were using string error levels. Switch tooptions
instead.tests/lib/rules/comma-style.js
: Test caseargs
were using string error levels. Switch tooptions
instead.tests/lib/rules/no-cond-assign
: Test caseargs
were using string error levels. Switch tooptions
instead.tests/lib/rules/space-in-parens.js
: Test caseargs
were using string error levels. Switch tooptions
instead. Additionally, incorrect configuration values are now caught.tests/lib/rules/no-undef.js
: Remove vestigial options left over from since-removed React support.tests/lib/rules/no-unused-vars.js
: Correct spelling of an invalid test case option.tests/lib/rules/one-var.js
: Correct type of invalid test case options.tests/lib/rules/quotes.js
: Correct position of invalid test case options.