diff --git a/.analysis_options b/.analysis_options new file mode 100644 index 000000000..b73a3daac --- /dev/null +++ b/.analysis_options @@ -0,0 +1,24 @@ +analyzer: + exclude: + - integrate/** +linter: + rules: + - annotate_overrides + - avoid_empty_else + - avoid_init_to_null + - avoid_return_types_on_setters + - camel_case_types + - empty_constructor_bodies + - hash_and_equals + - library_names + - library_prefixes + - package_api_docs + - package_names + - package_prefixed_library_names + - prefer_is_not_empty + - slash_for_doc_comments + - sort_constructors_first + - sort_unnamed_constructors_first + - type_init_formals + - unnecessary_brace_in_string_interp + - unnecessary_getters_setters diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..8098fc9ab --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: dart +dart: + - "1.17.1" +with_content_shell: true +before_install: + - export DISPLAY=:99.0 + - ./tool/setup_dartium.sh + - export PATH=$PATH":$PWD" + - sh -e /etc/init.d/xvfb start +script: + - pub run dart_dev analyze + - pub run dart_dev test + - ./tool/generate_coverage.sh + - bash <(curl -s https://codecov.io/bash) -f coverage/coverage.lcov diff --git a/lib/src/component/aria_mixin.dart b/lib/src/component/aria_mixin.dart index 1b4413c33..126ee5891 100644 --- a/lib/src/component/aria_mixin.dart +++ b/lib/src/component/aria_mixin.dart @@ -16,6 +16,9 @@ library over_react.aria_mixin; import 'dart:collection'; +// Must import these consts because they are used in the transformed code. +// ignore: unused_import +import 'package:over_react/over_react.dart' show PropDescriptor, ConsumedProps; import 'package:over_react/src/component_declaration/annotations.dart'; /// Typed getters/setters for accessibility props. diff --git a/lib/src/component/prop_mixins.dart b/lib/src/component/prop_mixins.dart index a4a387107..a5b979b4d 100644 --- a/lib/src/component/prop_mixins.dart +++ b/lib/src/component/prop_mixins.dart @@ -15,6 +15,9 @@ /// Various prop related mixins to be used with [UiComponent] descendants. library over_react.prop_mixins; +// Must import these consts because they are used in the transformed code. +// ignore: unused_import +import 'package:over_react/over_react.dart' show PropDescriptor, ConsumedProps; import 'package:over_react/src/component/callback_typedefs.dart'; import 'package:over_react/src/component_declaration/annotations.dart'; diff --git a/lib/src/component/resize_sensor.dart b/lib/src/component/resize_sensor.dart index fb176fbab..99f90c83b 100644 --- a/lib/src/component/resize_sensor.dart +++ b/lib/src/component/resize_sensor.dart @@ -82,7 +82,6 @@ class ResizeSensorComponent extends UiComponent { Element _expandSensorChildRef; Element _expandSensorRef; - Element _collapseSensorChildRef; Element _collapseSensorRef; @override @@ -115,10 +114,7 @@ class ResizeSensorComponent extends UiComponent { ..key = 'expandSensor' )(expandSensorChild); - var collapseSensorChild = (Dom.div() - ..ref = (ref) { _collapseSensorChildRef = ref; } - ..style = _collapseSensorChildStyle - )(); + var collapseSensorChild = (Dom.div()..style = _collapseSensorChildStyle)(); var collapseSensor = (Dom.div() ..className = 'resize-sensor-collapse' diff --git a/lib/src/util/class_names.dart b/lib/src/util/class_names.dart index ae9746592..02a455152 100644 --- a/lib/src/util/class_names.dart +++ b/lib/src/util/class_names.dart @@ -17,6 +17,9 @@ library over_react.class_names; import 'dart:collection'; +// Must import these consts because they are used in the transformed code. +// ignore: unused_import +import 'package:over_react/over_react.dart' show PropDescriptor, ConsumedProps; import 'package:over_react/src/component_declaration/annotations.dart'; /// Typed getters/setters for props related to CSS class manipulation, and used by all UIP components. diff --git a/pubspec.yaml b/pubspec.yaml index 7adcf9f2f..146936734 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,4 @@ name: over_react -publish_to: https://pub.workiva.org version: 1.0.0 description: A library for building statically-typed React UI components using Dart. homepage: https://github.com/Workiva/over_react/ diff --git a/tool/dev.dart b/tool/dev.dart index 17fefd0d8..e3f9d88f0 100644 --- a/tool/dev.dart +++ b/tool/dev.dart @@ -19,7 +19,6 @@ import 'package:dart_dev/dart_dev.dart' show dev, config; main(List args) async { const directories = const [ 'lib/', - 'example/', 'test/', 'tool/', ]; diff --git a/tool/generate_coverage.sh b/tool/generate_coverage.sh new file mode 100755 index 000000000..0cf7e4411 --- /dev/null +++ b/tool/generate_coverage.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# DART_FLAGS has to be set to `--checked` because dart_dev does not run tests in checked mode. +DART_FLAGS=--checked pub run dart_dev coverage --no-html --no-open diff --git a/tool/setup_dartium.sh b/tool/setup_dartium.sh new file mode 100755 index 000000000..1895fa8fe --- /dev/null +++ b/tool/setup_dartium.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +DARTIUM_DIST="dartium-linux-x64-release.zip"; +echo "Installing Dartium
" +curl "http://storage.googleapis.com/dart-archive/channels/stable/raw/latest/dartium/$DARTIUM_DIST" > $DARTIUM_DIST +unzip -u $DARTIUM_DIST > /dev/null +rm $DARTIUM_DIST +mv dartium-* dartiumdir +export DARTIUM_BIN="$PWD/dartiumdir/chrome" + +SELENIUM_JAR="selenium-server.jar"; +echo "Installing Selenium" +curl "http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar" > $SELENIUM_JAR +echo "#!/usr/bin/env bash" | tee -a selenium-server +echo "exec java -jar $PWD/$SELENIUM_JAR \"$@\"" | tee -a selenium-server +chmod +x selenium-server + +CHROMEDRIVER="chromedriver.zip"; +echo "Installing Chromedriver" +curl "http://chromedriver.storage.googleapis.com/2.14/chromedriver_linux64.zip" > $CHROMEDRIVER +unzip $CHROMEDRIVER +chmod +x chromedriver +ln -s "$PWD/dartiumdir/chrome" "$PWD/dartium" + +export PATH=$PATH":$PWD"