-
Notifications
You must be signed in to change notification settings - Fork 58
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
FED-2112 Required props lint: respect @Props(ignoreRequiredProps: ...) #873
FED-2112 Required props lint: respect @Props(ignoreRequiredProps: ...) #873
Conversation
…2' into analyzer-plugin-opt-out-required-props
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
'unnecessary_null_in_if_null_operators', | ||
'prefer_null_aware_operators', | ||
// Needed to ignore the `requiredPropNamesToSkipValidation` checks. | ||
'invalid_use_of_visible_for_overriding_member', |
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 added this ignore to fix my test setup, which validated there were no warnings in generated code
…-opt-out-required-props--clean-base
7510775
to
cbec88a
Compare
…2' into analyzer-plugin-opt-out-required-props--clean-base
Needed for usages of requiredPropNamesToSkipValidation
cbec88a
to
8a2e187
Compare
…ilerplate parsing
@@ -50,32 +50,54 @@ class _PropsStateStringHelpersImpl extends Object with PropsStateStringHelpers { | |||
_PropsStateStringHelpersImpl({required this.isProps}); | |||
} | |||
|
|||
final Expando<String> props_ignoreRequiredProps_source = Expando(); | |||
|
|||
/// Uses [InstantiatedMeta] to analyze [node] and determine the proper annotation. | |||
annotations.TypedMap getPropsOrStateAnnotation(bool isProps, AnnotatedNode node) { |
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.
Whitespace-agnostic diff here is helpful
@@ -102,31 +105,38 @@ class InstantiatedComponentMeta<TMeta> extends InstantiatedMeta<TMeta> { | |||
final Identifier? subtypeOfValue; | |||
|
|||
InstantiatedComponentMeta._( | |||
Annotation? metaNode, TMeta meta, List<Expression> unsupportedArguments, this.subtypeOfValue) | |||
Annotation metaNode, TMeta meta, List<Expression> unsupportedArguments, this.subtypeOfValue) | |||
: super._(metaNode, meta, unsupportedArguments); | |||
|
|||
static InstantiatedComponentMeta<T>? fromNode<T>(AnnotatedNode node) { |
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.
Whitespace-agnostic diff here is helpful
1d33d19
to
14d6c32
Compare
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.
+10
- smoke tested in playground
…-out-required-props
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.
+10 refresh
Dependent PR
These changes are dependent on two different PRs:
For review, I've set the base as a branch that merges the two together.
Motivation
Part of adding
ignoreRequiredProps
functionality is supporting it in the analyzer plugin, by making the required props lint not treat those props as required.Changes
getAllRequiredProps
logic to mark props specified within@Props(ignoreRequiredProps: ...)
as ignoredinvalid_use_of_visible_for_overriding_member
to generated code, since it was causing analyzer plugin test setups to fail when verifying that there are no analysis errors in generated partsRelease Notes
Review
See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.
Please review:
QA Checklist
IgnoresSomeRequired
example doesn't warn for props that are ignoredignoreRequiredProps
argument doesn't cause IDE error notifications as you're typingMerge Checklist
While we perform many automated checks before auto-merging, some manual checks are needed: