Commit graph

26 commits

Author SHA1 Message Date
Nicholas Shahan c438a48bc4 [dartdevc] Enforce more pedantic v1.9.0 lints and cleanup violations
- prefer_generic_function_type_aliases
- use_function_type_syntax_for_parameters

Change-Id: I138d4104c5de41acf44b7962d6e2ce58d78b8a75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134380
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-02-04 23:04:27 +00:00
Nicholas Shahan 3ca719b44c [dartdevc] Enforce omit_local_variable_types lint
Change-Id: I50d9c073ec337d5f05203b30abf289877fdeb08f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134082
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-02-03 23:41:17 +00:00
Nicholas Shahan 40e816b456 [dartdevc] Apply lints and cleanup violations
- always_require_non_null_named_parameters
- prefer_final_fields

Change-Id: I21dc5a9514fe2a7bb09c91fe28b2d4b79d7991e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133840
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2020-01-31 00:47:26 +00:00
Nicholas Shahan e3797b1bb7 [dartdevc] Apply more lints from pedantic v1.9.0 and cleanup violations
- avoid_null_checks_in_equality_operators
- camel_case_extensions
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_for_elements_to_map_fromIterable
- prefer_if_null_operators
- prefer_spread_collections

Change-Id: Iab816e71274a57cbca9b4006dc8dbc55604fcb2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133500
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-01-29 22:14:00 +00:00
Nicholas Shahan 2d5265f59d [dartdevc] Apply always_declare_return_types lint and cleanup violations
In most cases I provided the type that appeared in the return
statements. For a few test files I explicitly typed the return types as
dynamic because it caused diffs in the expected break point locations
when adding more explicit types and it wasn't totally clear what the
new locations should be.

Change-Id: Ifdd80edcccc5fc4a2083ecdbb0e5fbf1c4453e01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133339
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-01-29 07:17:22 +00:00
Nate Bosch 3eaae5405d Enable and fix directives_ordering lint
Change-Id: I7782bc44f79bb2317921ebf400411d5ef01e11cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132970
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-23 21:01:54 +00:00
Nate Bosch 2d82fb42ce Enforce and fix lint prefer_single_quotes
Change-Id: I7e7b18d90ae8518c700607ec383c73a0eda5a299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130726
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2020-01-08 22:07:21 +00:00
Nate Bosch 0a728f0f08 Enable null aware lints
- Enable `prefer_null_aware_operators`, it was already clean.
- Enable `prefer_conditional_assignment` and fix one violation.

Change-Id: I73a5062d5aeedaea9a7b542db02f455111566cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130724
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-08 20:39:50 +00:00
Nate Bosch 4be46419fa Add types to uninitialized variables in DDC
Enable and fix lint prefer_typing_uninitialied_variables

Change-Id: Ibb739b21ac8654feef01ecc2aa1c646882b0b749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130140
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-06 23:45:51 +00:00
Nicholas Shahan ac30ab12ab [dartdevc] Bump pedantic to v1.8.0 and apply new lints
Cleanup violations of:
* `prefer_iterable_whereType`
* `unnecessary_const`
* `unnecessary_new`

Ignore violations in lib/src/js_ast to avoid additional diffs when un-forking.

Change-Id: I7333903422bbf635cd0dea82116372f305f679d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108182
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-07-03 23:51:51 +00:00
Nicholas Shahan ffb044e4f0 [dartdevc] Apply all lints from pkg:pedantic
Ignore slash_for_doc_comments in lib/src/js_ast to avoid additional diffs when
potentially un-forking in the future.

Fixes: #37218
Change-Id: If5c5bacf2d77fbae432217ba6031a6a8fa5dfcd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106580
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2019-06-21 22:13:59 +00:00
Nicholas Shahan 177f425012 [dartdevc] Fix violations of library_prefix lint
Rename the library prefix used in imports from `JS` to `js_ast`. Create more of
a distinction between:
* `JS` the library.  Now named `js_ast`.
* `js` the const instance of a JSBuilder.
* `JS` the helper to inline javascript in the SDK patches
  and runtime libraries.

Ignore the lint in the js_ast directory to avoid additional diffs for the
eventual un-forking of the package.

Cleanup a few unused imports.

Issue #37218

Change-Id: I039c1048876d9d9ad424fbec3ad555d300845a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106160
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-06-14 22:48:40 +00:00
Nicholas Shahan 1e92103181 [dartdevc] Fix violations of avoid_relative_lib_imports lint
Issue: #37218
Change-Id: Id248e378d6fbe832952b8e61102da7f68536f81b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105861
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2019-06-13 17:30:17 +00:00
Nicholas Shahan aaf7d2023f [dartdevc] Fix violations of unawaited_futures lint
Issue: #37218
Change-Id: I736afd1a339be0573126ed2184b9a04e0ab73f8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105781
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-06-12 23:27:17 +00:00
Nicholas Shahan 8aa4414f1b [dartdevc] Ignore violation of empty_catches lint
* Only appears in a sourcemap test.

Issue: #37218
Change-Id: I0bb24db28c2d0041629de12c47273dfdc2b8b2f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105547
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-06-11 16:51:13 +00:00
Nicholas Shahan 80fb7891eb Cleanup violation of no_duplicate_case_values lint
Technically 'let' is an invalid identifier in ES6 strict mode.
http://www.ecma-international.org/ecma-262/6.0/#sec-identifiers-static-semantics-early-errors

We are never passing `strictMode = false` so either way it always returns true.

Change-Id: I7891202d76dce621ee314dc583c6a44f916ab5b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104382
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2019-06-07 21:59:06 +00:00
Vijay Menon 3b5a187726 [dartdevc] move ddc internal libraries under sdk
Note, this has the effect of including all DDC Dart sources with the
shipped SDK: we ship everything under sdk/lib.

This should enable https://github.com/dart-lang/build/issues/2262

Change-Id: If66bc7c620034e7f2acf7d2c3e9524a408417681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104383
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-04 13:47:29 +00:00
Nicholas Shahan c4a1ca903f [dartdevc] Cleanup violations of unrelated_type_equality_checks lint
These violations look like actual bugs and were not simply mechanical fixes.

Change-Id: I69ae67751e48829fc4733dcb327ba0aa52602c91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104063
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2019-05-30 21:35:25 +00:00
Nate Bosch 2bbb2f3c1f Disallow implicit casts
Explicit casts make it easier to confidently navigate the code base and
apply refactorings which tighten types. This change exposes a number of
places where types can be tightened, but only the most trivial were
applied. For most places I added the explicit cast that would have
happened anyway and so behavior shouldn't be changing.

- Add the configuration which disallows implicit casts in the analyzer.
- Add explicit casts in almost all instances.
- Where the implicit cast was due to a local variable type on the left,
  change it to a `var` so the type is not repeated.
- In a few places add argument types where they were already applied on
  the parent type, and the subclass was unnecessarily loosening argument
  types to dynamic.
- In a few places where a method was defined with an implicit dynamic
  return but had an obvious and consistent return type, annotate the
  method instead of casting after calls to that method.

Change-Id: I90e11b1cc08ce69967ea5705b507d5758a8f668f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103381
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-05-22 00:33:39 +00:00
Nicholas Shahan 2fd1021326 [dartdevc] Turn on lints and cleanup violations
Working towards turning on all lints from package:pedantic. This change includes
the lints that needed cleanup and don't change any behavior.

Applied cleanup:
* Don't explicitly initialize variables to null.
* DO use curly braces for all flow control structures.
* Use `.isEmpty` instead of `.length == 0`.
* Use `.isNotEmpty` instead of `.length > 0` or `! .isEmpty`.
* Use `=` to separate a named parameter from its default value.

The remaining lints from package:pedantic will require cleanup that is less
automatic and will be addressed in later changes.

Change-Id: Ie4c3ba685f8a559209dd14ac037203ecd16252c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103086
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-20 20:20:47 +00:00
Nate Bosch e9b5c9ce8b Ignore todos in DDC
These aren't useful to see cluttering up diagnostic lists - they can be
found easily enough in other ways.

Change-Id: I34b800c1145ae476822afddff558d62c4ffb9b2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103141
Reviewed-by: Mark Zhou <markzipan@google.com>
2019-05-20 17:39:42 +00:00
Nate Bosch 04e329b6ed Add override annotations across DDC
Previously 36% of overrides were annotated, including inconsistent
annotations within a single class.

- Add annotations on remaining overridden methods.
- Add linter section to `analysis_options.yaml` so that missing
  annotations are visible while editing.

Change-Id: Ief1a6d5b8da6f4b630a6cfc72a6ed67db346c081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103140
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-05-20 17:31:26 +00:00
Devon Carew 3e33c3d0fc Eliminate analysis warnings in pkg/ code.
Change-Id: I571581bf16502c1698932c03313777aa8a9ee081
Reviewed-on: https://dart-review.googlesource.com/63983
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-07-06 21:28:07 +00:00
Paul Berry a3218d0b72 Roll back change to pkg/dev_compiler/analysis_options.yaml
This should work around #32450 and fix the buildbots.

Change-Id: I21d187a34de86ef4e383a9ea7fc297eda1363780
Reviewed-on: https://dart-review.googlesource.com/45521
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-07 12:10:07 +00:00
Jenny Messerly dab7da78cd fix implicit casts in DDC
There are a few bug fixes here as well. Most notably, `.name.name`
instead of `.name` in DDK's analysis of virtual accessors. DDC/K's
handling of spread arguments in JS interop was also fairly broken
(it was generating a RestParameter instead of Spread). There's
also a lot of cleanup in js_ast as well, to make it a bit more
type safe.

Change-Id: Ia5333179e6dd0a62f20ce64a2b2b8bedf2ed7c49
Reviewed-on: https://dart-review.googlesource.com/44700
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-07 01:26:21 +00:00
danrubel c8784af933 rename .analysis_options --> analysis_options.yaml
See https://github.com/dart-lang/sdk/issues/28385

R=brianwilkerson@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2839383003 .
2017-04-30 18:33:10 -04:00
Renamed from pkg/dev_compiler/.analysis_options (Browse further)