Skip to content

Commit

Permalink
Merge pull request #856 from Workiva/null-safety
Browse files Browse the repository at this point in the history
FED-1713 Null safety: perform migration, set up base for 5.0.0 integration branch
  • Loading branch information
greglittlefield-wf authored Dec 1, 2023
2 parents d6b302e + a15bd8f commit 8eeb5cd
Show file tree
Hide file tree
Showing 544 changed files with 8,522 additions and 9,200 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/dart_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,18 @@ jobs:
name: Build generated files / precompile DDC assets
run: |
dart run build_runner build --delete-conflicting-outputs -o ddc_precompiled
if: always() && steps.install.outcome == 'success'

- name: Verify that generated files are up-to-date
run: |
if [ ${{ matrix.sdk }} = '2.18.7' ]; then
git diff --exit-code
else
# Don't check these generated files for other SDKs, since they may generate differently
# due to different resolved dependencies.
git diff --exit-code -- ":(exclude)test/mockito.mocks.dart" ":(exclude)test/over_react/component_declaration/redux_component_test/test_reducer.g.dart"
fi
if: always() && steps.install.outcome == 'success'
if: always() && steps.install.outcome == 'success' && steps.install.build == 'success'

# Analyze again after generated files are created to verify that those generated classes don't cause analysis errors
- name: Analyze project source (post-build)
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# OverReact Changelog

## 5.0.0 (unreleased, work in progress)
- Migrate to null safety
- Support generating code for null-safe libraries (while retaining support for non-null-safe libraries)
- Add ability to declare required, optionally-non-nullable props and state fields via `late`

#### Analyzer plugin
- Add new lint, `over_react_required_prop`
- Warns for missing `late` required props
- Hints for missing `@requiredProp` required props (these are deprecated in favor of `late`)
- Reinstate functionality disabled in over_react 4.8.3. Since newer Dart SDKs require sound null safety in analyzer plugins, this code couldn't be run since it depended on over_react code, which was not itself null safe.
- Diagnostics (AKA lints)
- `over_react_boilerplate_error`, `over_react_boilerplate_warning`
- `over_react_incorrect_doc_comment_location`
- Assist for toggling class component statefulness

### Breaking changes
- API removals:
- BuiltReduxUiComponent
- forwardRef (not to be confused with `uiForwardRef`)
- registerComponent and registerComponent2 `displayName` argument
- The following props classes can no longer be extended or instantiated directly (like most components). To instantiate them, use the factory instead.
- FragmentProps
- StrictModeProps
- ReduxProviderProps (for extension, mix in ReduxProviderPropsMixin instead)
- `PropsMeta`/`StateMeta` constructor arguments `fields` and `keys` are now required

## [4.10.3](https://github.com/Workiva/over_react/compare/4.10.2...4.10.3)
- [#846] Update internals to prepare for react-dart 7.0.0

Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ analyzer:
# Workaround for https://github.com/dart-lang/sdk/issues/51087
# TODO remove once we can run on Dart 2.19 (blocked by https://github.com/dart-lang/sdk/issues/51128 or working around it by upgrading to analyzer ^5.1.0)
part_of_different_library: ignore
cast_nullable_to_non_nullable: warning
linter:
rules:
cast_nullable_to_non_nullable: true
# -------------------
# Pedantic
# -------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ main() {
for (var todo in component.props.todos) {
final listItemComponent = getComponentByTestId(displayListInstance, 'todo_client.TodoListItem.${todo.id}');
expect(listItemComponent, isA<TodoListItemComponent>());
TodoListItemProps props = listItemComponent.props;
var props = listItemComponent.props;
expect(props.model, todo);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ main() {
for (var user in component.props.users) {
final listItemComponent = getComponentByTestId(displayListInstance, 'todo_client.UserListItem.${user.id}');
expect(listItemComponent, isA<UserListItemComponent>());
UserListItemProps props = listItemComponent.props;
var props = listItemComponent.props;
expect(props.model, user);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ main() {
expect(emptyListInstance, isNotNull);
expect(getDartComponent(emptyListInstance), isA<EmptyViewComponent>());

EmptyViewProps emptyViewProps = getDartComponent(emptyListInstance).props;
var emptyViewProps = getDartComponent(emptyListInstance).props;
expect(emptyViewProps.type, EmptyViewType.VBLOCK);
expect(emptyViewProps.header, 'No ${jacket.getDartInstance().props.listItemTypeDescription} to show');
expect(emptyViewProps.glyph, isNotNull);
Expand Down
10 changes: 0 additions & 10 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ targets:
# checked in.
- "example/boilerplate_versions/dart2_only/**"

built_value_generator|built_value:
generate_for:
include:
- test/over_react/component_declaration/redux_component_test/test_reducer.dart

built_redux|built_redux:
generate_for:
include:
- test/over_react/component_declaration/redux_component_test/test_reducer.dart

# build_vm_compilers|entrypoint:
# generate_for:
# include:
Expand Down
6 changes: 6 additions & 0 deletions dart_dependency_validator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
exclude:
- app/**
- tools/**
ignore:
- mockito
allow_pins: true
12 changes: 12 additions & 0 deletions dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ presets:

travis:
reporter: expanded

tags:
# Tests that should only run in DDC (Dart Dev Compiler, AKA dartdevc).
ddc: {}
# Tests that should only run in dart2js.
no-ddc: {}
# Tests that can pass in DDC even if something goes wrong;
# these tests must be run in dart2js in order to properly validate behavior.
ddc-false-positive: {}
# Tests that represent a case of undesirable JS interop behavior that's
# either unavoidable or exists as a tradeoff for improved behavior in other cases.
js-interop-tradeoff: {}
12 changes: 6 additions & 6 deletions example/boilerplate_versions/backwards_compatible/basic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class BasicProps extends _$BasicProps with _$BasicPropsAccessorsMixin {
class _$BasicProps extends UiProps {
@Deprecated('This is deprecated')
@requiredProp
String basicProp;
String? basicProp;

String basic1;
String basic2;
String basic3;
String basic4;
String basic5;
String? basic1;
String? basic2;
String? basic3;
String? basic4;
String? basic5;
}

@Component()
Expand Down
12 changes: 6 additions & 6 deletions example/boilerplate_versions/dart2_only/basic_component1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ UiFactory<BasicProps> Basic = _$Basic; // ignore: undefined_identifier, invalid_
class _$BasicProps extends UiProps {
@Deprecated('This is deprecated')
@requiredProp
String basicProp;
String? basicProp;

String basic1;
String basic2;
String basic3;
String basic4;
String basic5;
String? basic1;
String? basic2;
String? basic3;
String? basic4;
String? basic5;
}

@Component()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions example/boilerplate_versions/dart2_only/basic_component2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ UiFactory<BasicProps> Basic = _$Basic; // ignore: undefined_identifier, invalid_
class _$BasicProps extends UiProps {
@Deprecated('This is deprecated')
@requiredProp
String basicProp;
String? basicProp;

String basic1;
String basic2;
String basic3;
String basic4;
String basic5;
String? basic1;
String? basic2;
String? basic3;
String? basic4;
String? basic5;
}

@Component2()
Expand Down
Loading

0 comments on commit 8eeb5cd

Please sign in to comment.