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

HY-4964 Turn on strong mode and lint rules #13

Merged
merged 10 commits into from
Jun 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
/.pub
packages
/pubspec.lock

node_modules
/coverage
7 changes: 7 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
analyzer:
strong-mode: true

linter:
rules:
- cancel_subscriptions
- close_sinks
2 changes: 1 addition & 1 deletion example/echo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library echo;

import "dart:html";
import 'package:logging/logging.dart';
import "package:sockjs_client/sockjs.dart" as SockJS;
import "package:sockjs_client/sockjs_client.dart" as SockJS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this just straight up broken?

Copy link
Member Author

Choose a reason for hiding this comment

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

it was totally the wrong path .. i think the example must not have been able to work.


DivElement div = querySelector('#first div');
InputElement inp = querySelector('#first input');
Expand Down
8 changes: 6 additions & 2 deletions lib/src/ajax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ class XHRLocalObject extends AbstractXHRObject {
}
}

XHRLocalObjectFactory(method, baseUrl, {bool noCredentials, payload}) => new XHRLocalObject(method, baseUrl, noCredentials: noCredentials, payload: payload);
AbstractXHRObject XHRLocalObjectFactory(String method, String baseUrl, {bool noCredentials, payload}) {
return new XHRLocalObject(method, baseUrl, noCredentials: noCredentials, payload: payload);
}

XHRCorsObjectFactory(method, baseUrl, {bool noCredentials, payload}) => new XHRCorsObject(method, baseUrl, noCredentials: noCredentials, payload: payload);
AbstractXHRObject XHRCorsObjectFactory(String method, String baseUrl, {bool noCredentials, payload}) {
return new XHRCorsObject(method, baseUrl, noCredentials: noCredentials, payload: payload);
}

// 1. Is natively via XHR
// 2. Is natively via XDR
Expand Down
6 changes: 4 additions & 2 deletions lib/src/info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ class InfoReceiverFake extends InfoReceiver {
class WInfoReceiverIframe {
WInfoReceiverIframe(ri, _trans_url, baseUrl) {
var ir = new AjaxInfoReceiver(baseUrl, XHRLocalObjectFactory);
ir.onFinish.listen( (evt) {
ir.onFinish.listen( (event.Event evt) {
if (evt is InfoReceiverEvent) {
ri._didMessage('m${JSON.encode([evt.info, evt.rtt])}');
ri._didClose();
}
ri._didClose();
});
}
doCleanup() {}
Expand Down
4 changes: 3 additions & 1 deletion lib/src/transport/receiver-xhr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ part of sockjs_client;
}
}

XhrReceiverFactory(String recvUrl, AjaxObjectFactory xhrFactory, {bool noCredentials}) => new XhrReceiver(recvUrl, xhrFactory, noCredentials: noCredentials);
Receiver XhrReceiverFactory(String recvUrl, AjaxObjectFactory xhrFactory, {bool noCredentials}) {
return new XhrReceiver(recvUrl, xhrFactory, noCredentials: noCredentials);
}
2 changes: 1 addition & 1 deletion lib/src/transport/sender.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class JsonPGenericSender {
}
form.submit();

var readyStateChangeHandler = (e) {
var readyStateChangeHandler = (html.Event e) {
if (new JsObject.fromBrowserObject(iframe)["readyState"] == 'complete') completed(null);
};

Expand Down
43 changes: 43 additions & 0 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ dependencies:
browser: '>=0.9.0 <1.0.0'
logging: '>=0.9.0 <1.0.0'
dev_dependencies:
coverage: '^0.7.3'
coverage: '>=0.7.3 < 1.0.0'
dart_dev: '^1.0.0'
dart_style: '^0.2.0'
test: '>=0.12.5'
dart_style: '>=0.2.0 < 1.0.0'
test: '>=0.12.5 < 1.0.0'
environment:
sdk: '>=1.0.0 <2.0.0'
sdk: '>=1.0.0 <2.0.0'
4 changes: 2 additions & 2 deletions smithy.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
project: dart
language: dart

# dart 1.19.1
runner_image: drydock-prod.workiva.org/workiva/smithy-runner-generator:92530
runner_image: drydock-prod.workiva.net/workiva/smithy-runner-generator:165358 # 62.0.0

script:
- pub get
- pub run dart_dev analyze

artifacts:
build:
Expand Down
5 changes: 4 additions & 1 deletion test/xhr_streaming_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ void main() {
}


MockXHRCorsObjectFactory(String method, String baseUrl, {bool noCredentials, payload}) => new MockXHRCorsObject();
AbstractXHRObject MockXHRCorsObjectFactory(String method, String baseUrl, {bool noCredentials, payload}) {
return new MockXHRCorsObject();
}

class MockXHRCorsObject extends AbstractXHRObject {
MockXHRCorsObject();
}
6 changes: 3 additions & 3 deletions tool/dev.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
library tool.dev;

import 'dart:async';
import 'dart:io';

import 'package:dart_dev/dart_dev.dart' show dev, config;
import 'package:dart_dev/util.dart' show TaskProcess, reporter;

main(List<String> args) async {
// https://github.com/Workiva/dart_dev

config.analyze.entryPoints = ['example/', 'lib/', 'tool/'];
config.analyze
..entryPoints = ['example/', 'lib/', 'tool/']
..strong = true;
config.format.directories = ['example/', 'lib/', 'tool/'];

config.coverage
Expand Down