-
Notifications
You must be signed in to change notification settings - Fork 83
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: add manual validation mode #8097
Conversation
5e621f1
to
1f3c000
Compare
eslint-plugin-local-rules/index.js
Outdated
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.
Someone else might have opinions about the location of the plugin, but to me it looks fine as there isn't too much clutter otherwise at the moment. Can also easily be changed at any time.
@@ -0,0 +1,5 @@ | |||
{ | |||
"name": "eslint-plugin-local-rules", | |||
"version": "1.0.0", |
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.
Let's add "private": true
to make sure this never gets published, then we don't need "version"
field.
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.
Replaced the custom implementation with no-restricted-syntax
* the `invalid` property directly through your application logic without conflicts | ||
* with the component's internal validation. | ||
*/ | ||
manualValidation: boolean; |
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.
Let's add @attr {boolean} manual-validation
annotation also to this comment.
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.
Done.
e26e980
to
2cc431a
Compare
4cd57d3
to
a6a051a
Compare
* @return {boolean} | ||
*/ | ||
checkValidity() { | ||
if (this.inputElement && this.inputElement.validate) { |
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.
note: We don't support iron form elements anymore.
if (this.inputElement.checkValidity) { | ||
inputValidity = this.inputElement.checkValidity(); | ||
} else if (this.inputElement.validate) { | ||
// Iron-form-elements have the validate API |
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.
note: We don't support iron form elements anymore.
Quality Gate passedIssues Measures |
Description
The PR adds a manual validation mode that turns off automatic constraint validation, letting you control the validation process yourself. Constraint validation can still be triggered by calling
validate()
– particularly useful for cases where you want to delay any validation until a submit button is clicked. In manual validation mode, you can also set the invalid property directly through your application logic without conflicting with built-in validation.Note
Instead of testing each validation case in every component, I decided to extend the
no-restricted-syntax
ESLint rule to make sure_requestValidation()
is used instead ofvalidate()
. I believe this approach provides better protection, as tests won't catch any newvalidate()
calls that may be added in the future.Fixes #7902
Type of change