-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
feat!: Set default schema: []
, drop support for function-style rules
#17792
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9d924e3
drop support for function-style rules in flat-rule-tester
mdjermanovic c7a0b42
drop support for function-style rules in rule-tester
mdjermanovic 0964578
drop support for function-style rules in config-rule (eslint-fuzzer)
mdjermanovic b37aeb4
add rule object checks to rule testers
mdjermanovic 1658e6f
drop support for function-style rules in flat config and Linter#defin…
mdjermanovic d868180
update JSDoc
mdjermanovic 47c060b
add rule object checks to Linter
mdjermanovic cd2caa0
drop support for function-style rules in eslintrc
mdjermanovic 3cc25bb
remove custom-rules-deprecated.md
mdjermanovic f7c4f8d
update flat config getRuleOptionsSchema for schema changes
mdjermanovic 1671198
add back and update custom-rules-deprecated.md
mdjermanovic e3ba846
show ruleId in error messages for invalid schema
mdjermanovic 91fe762
throw error in Linter if rule has invalid schema
mdjermanovic 5d6f96f
add short description of meta.schema to type errors in flat-rule-tester
mdjermanovic b3fa339
throw error for empty object schema in flat-rule-tester
mdjermanovic dabe3ef
update rule-tester for schema changes
mdjermanovic e078476
add integration tests for eslintrc schema changes
mdjermanovic 78145ec
add more flat-config-array unit tests for schema changes
mdjermanovic d268d81
throw error in Linter in eslintrc mode if rule has invalid schema
mdjermanovic a92d4ab
update docs for schema changes
mdjermanovic 27b4448
use eslintrc v3
mdjermanovic File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Disallowing
schema: {}
is most important since it's the most common, accidental, no-op schema.I'm fine with this one check for now, but just want to ask if any other obvious/common no-op schemas come to mind? In the RFC, I mentioned
schema: { type: "array" }
as another no-op schema we could disallow, with the intention being to leave the door open to any others that we judge worth checking for. Obviously, we can only add update the banned no-op list during major versions.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.
is there a related discussion in ajv repo? it could benefit all the dependents (not just eslint) - if it could be supported by ajv.
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 did a brief search and didn't immediately find a relevant discussion in in ajv. But I have included a lot more context in this issue discussing a potential lint rule:
no-incomplete-schema
eslint-community/eslint-plugin-eslint-plugin#296Overall, we should probably just allow any schema in ESLint except extremely common and obvious mistakes like
{}
, and consider linting to detect further possible problems.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.
Newer versions of Ajv have some built-in validations, but there were backwards compatibility issues when we tried to switch to Ajv 7+ (#13911). However, I believe
schema: { type: "array" }
would be considered valid by Ajv. It's just useless in ESLint because we're always passing arrays to these validations.I agree that for now RuleTester should only check for the common and obvious mistake
schema: {}
.