Skip to content
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

Merge Dart 2.9 boilerplate wip #679

Merged
merged 70 commits into from
Feb 3, 2021
Merged

Conversation

joebingham-wk
Copy link
Contributor

@joebingham-wk joebingham-wk commented Feb 3, 2021

Motivation

Dart 2.9 removed support for ignoring error-severity analyzer errors. This is already an issue, as the library currently relies on those ignore comments for undefined identifiers. Into this future, this issue will be exasperated by the enforcement of implicit cast errors that will be enforced when NNBD is introduced in Dart 2.12.

For more context, see this issue.

Changes

Introducing castUiFactory!

The main change is that a new utility, castUiFactory, was introduced. This utility works by using generics to infer the typing from the surrounding context. This utility works around the implicit cast issue by inferring the typing from the surround context.

For a reference of all permutations of the boilerplate with this utility, see the over_react examples.

Private Generated Factory Configs

The solution to the undefined_identifier errors is that identifiers prefixed with _$ will be dynamic in the future.

Component factory declarations already followed this convention, but functional component's generated UiFactoryConfigs did not. Therefore, the public config is still generated, but is deprecated. Instead, use the private config. For example:

import 'package:over_react/over_react.dart';

part 'function_component.over_react.g.dart';

UiFactory<FunctionComponentProps> FunctionComponent = uiFunction(
  (props) {
    return Dom.div()('This is a post-Dart 2.9.0 function component.');
  },
-  $FunctionComponentConfig, // ignore: undefined_identifier
+  _$FunctionComponentConfig, // ignore: undefined_identifier
);

mixin FunctionComponentProps on UiProps {}

Migrating

To migrate, you should first ensure you have migrated to the mixin-based syntax.

From there, you can run an over_react_codemod script to perform the migration!

pub global activate over_react_codemod ^1.12.0
pub global run over_react_codemod:dart2_9_upgrade

sydneyjodon-wk and others added 30 commits December 9, 2020 09:34
…ry-configs-private

CPLAT-12620 Make factory config syntax use private variables
…orkiva/over_react into CPLAT-12619-support-new-factory-syntax
…act into CPLAT-12619-support-new-factory-syntax
@aviary-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

…rated-files

CPLAT-13170 Analyze over_react examples without generated code
Copy link
Contributor

@aaronlademann-wf aaronlademann-wf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@sydneyjodon-wk sydneyjodon-wk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA +1

  • All over_react subpackages build (including over_react itself)
  • Smoke tested all over_react apps / examples
  • Consumer test built

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from RM

@rmconsole7-wk rmconsole7-wk merged commit 2a6a609 into master Feb 3, 2021
@rmconsole7-wk rmconsole7-wk deleted the dart-2.9-boilerplate-wip branch February 3, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants