From 92e021c9d7c7cd06dc41fbbf8f221fd1764f46f0 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Mon, 26 Apr 2021 10:43:11 +0200 Subject: [PATCH 01/90] Create LICENSE --- pkgs/lints/LICENSE | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkgs/lints/LICENSE diff --git a/pkgs/lints/LICENSE b/pkgs/lints/LICENSE new file mode 100644 index 00000000..a2178151 --- /dev/null +++ b/pkgs/lints/LICENSE @@ -0,0 +1,27 @@ +Copyright 2021, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From cd1348c31ee705e63bf04e247632adae079540d8 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Mon, 26 Apr 2021 10:30:14 -0700 Subject: [PATCH 02/90] simple package validation (dart-lang/lints#3) * simple package validation * => dart extensions * check for dirs * lib check --- pkgs/lints/.github/workflows/validate.yml | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/lints/.github/workflows/validate.yml diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml new file mode 100644 index 00000000..a3ea9f8a --- /dev/null +++ b/pkgs/lints/.github/workflows/validate.yml @@ -0,0 +1,29 @@ +name: validate + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Check for sources + run: | + filecount=`find lib -name '*.dart' | wc -l` + if [ $filecount -ne 0 ] || [ -d "bin" ] + then + echo 'Dart sources are not allowed in this package!' + exit 1 + fi From 7c619d0930a0f38765c9ad1269e468780de07b2b Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Tue, 27 Apr 2021 21:47:34 +0200 Subject: [PATCH 03/90] Add initial files (dart-lang/lints#1) --- pkgs/lints/.gitignore | 10 ++++++++++ pkgs/lints/CHANGELOG.md | 3 +++ pkgs/lints/README.md | 1 + pkgs/lints/pubspec.yaml | 11 +++++++++++ 4 files changed, 25 insertions(+) create mode 100644 pkgs/lints/.gitignore create mode 100644 pkgs/lints/CHANGELOG.md create mode 100644 pkgs/lints/README.md create mode 100644 pkgs/lints/pubspec.yaml diff --git a/pkgs/lints/.gitignore b/pkgs/lints/.gitignore new file mode 100644 index 00000000..ec2434a7 --- /dev/null +++ b/pkgs/lints/.gitignore @@ -0,0 +1,10 @@ +# Files and directories created by pub +.dart_tool/ +.packages + +# Omit commiting pubspec.lock for library packages: +# https://dart.dev/guides/libraries/private-files#pubspeclock +pubspec.lock + +# Directory created by dartdoc +doc/api/ diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md new file mode 100644 index 00000000..4b98463d --- /dev/null +++ b/pkgs/lints/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1 + +- Initial version diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md new file mode 100644 index 00000000..067fdcf3 --- /dev/null +++ b/pkgs/lints/README.md @@ -0,0 +1 @@ +This repo contains official Dart and Flutter lint rules. diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml new file mode 100644 index 00000000..4694db1f --- /dev/null +++ b/pkgs/lints/pubspec.yaml @@ -0,0 +1,11 @@ +name: lints +description: Official Dart and Flutter lint rules +version: 0.1.0 +homepage: https://dart.dev/guides/language/effective-dart + +environment: + sdk: '>=2.12.0 <3.0.0' + +# dependencies: +# dev_dependencies: +# NOTE: Code is not allowed in this package. Do not add dependencies. From a9ab173facc41faabba4b87603ce1db4ba43861c Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 27 Apr 2021 14:02:43 -0700 Subject: [PATCH 04/90] add build badge (dart-lang/lints#6) --- pkgs/lints/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 067fdcf3..98fa9f08 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1 +1,3 @@ This repo contains official Dart and Flutter lint rules. + +[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions) From ebead6980b3c7ea20b8e391bf832ed6b2eead5c7 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Tue, 27 Apr 2021 23:03:39 +0200 Subject: [PATCH 05/90] Add pub badge to readme (dart-lang/lints#7) --- pkgs/lints/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 98fa9f08..796fbd85 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,3 +1,5 @@ +[![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) + This repo contains official Dart and Flutter lint rules. [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions) From 291726012aace2731ad483ba6e4f589505c4ddb8 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 27 Apr 2021 16:52:09 -0700 Subject: [PATCH 06/90] add initial rulesets (dart-lang/lints#4) * initial rulesets * + include --- pkgs/lints/lib/core.yaml | 28 +++++++++++++++++++ pkgs/lints/lib/recommend.yaml | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 pkgs/lints/lib/core.yaml create mode 100644 pkgs/lints/lib/recommend.yaml diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml new file mode 100644 index 00000000..96ac12d8 --- /dev/null +++ b/pkgs/lints/lib/core.yaml @@ -0,0 +1,28 @@ +linter: + rules: + - avoid_empty_else + - avoid_relative_lib_imports + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names + - await_only_futures + - camel_case_extensions + - camel_case_types + - curly_braces_in_flow_control_structures + - empty_catches + - file_names + - hash_and_equals + - iterable_contains_unrelated_type + - list_remove_unrelated_type + - no_duplicate_case_values + - non_constant_identifier_names + - package_prefixed_library_names + - prefer_generic_function_type_aliases + - prefer_is_empty + - prefer_is_not_empty + - prefer_iterable_whereType + - prefer_typing_uninitialized_variables + - provide_deprecation_message + - unnecessary_overrides + - unrelated_type_equality_checks + - valid_regexps + - void_checks diff --git a/pkgs/lints/lib/recommend.yaml b/pkgs/lints/lib/recommend.yaml new file mode 100644 index 00000000..4b875a22 --- /dev/null +++ b/pkgs/lints/lib/recommend.yaml @@ -0,0 +1,52 @@ +include: package:lints/core.yaml + +linter: + rules: + - always_require_non_null_named_parameters + - annotate_overrides + - avoid_function_literals_in_foreach_calls + - avoid_init_to_null + - avoid_null_checks_in_equality_operators + - avoid_renaming_method_parameters + - avoid_return_types_on_setters + - avoid_returning_null_for_void + - avoid_single_cascade_in_expression_statements + - constant_identifier_names + - control_flow_in_finally + - empty_constructor_bodies + - empty_statements + - exhaustive_cases + - implementation_imports + - library_names + - library_prefixes + - null_closures + - overridden_fields + - package_names + - prefer_adjacent_string_concatenation + - prefer_collection_literals + - prefer_conditional_assignment + - prefer_contains + - prefer_equal_for_default_values + - prefer_final_fields + - prefer_for_elements_to_map_fromIterable + - prefer_function_declarations_over_variables + - prefer_if_null_operators + - prefer_initializing_formals + - prefer_inlined_adds + - prefer_is_not_operator + - prefer_null_aware_operators + - prefer_spread_collections + - prefer_void_to_null + - recursive_getters + - slash_for_doc_comments + - type_init_formals + - unnecessary_brace_in_string_interps + - unnecessary_const + - unnecessary_getters_setters + - unnecessary_new + - unnecessary_null_in_if_null_operators + - unnecessary_string_escapes + - unnecessary_string_interpolations + - unnecessary_this + - use_function_type_syntax_for_parameters + - use_rethrow_when_possible From b1ec4f0b709ad4de5daa486a2c95ae9385ec3c1c Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 27 Apr 2021 16:57:58 -0700 Subject: [PATCH 07/90] move build badge (dart-lang/lints#8) * move build badge * re-order --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 796fbd85..38b15123 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,5 +1,5 @@ [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) +[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions) This repo contains official Dart and Flutter lint rules. -[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions) From 76ddfb4c759744de180616a336e6983fb09c6598 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Mon, 3 May 2021 09:49:00 -0700 Subject: [PATCH 08/90] rename (dart-lang/lints#11) --- pkgs/lints/lib/{recommend.yaml => recommended.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkgs/lints/lib/{recommend.yaml => recommended.yaml} (100%) diff --git a/pkgs/lints/lib/recommend.yaml b/pkgs/lints/lib/recommended.yaml similarity index 100% rename from pkgs/lints/lib/recommend.yaml rename to pkgs/lints/lib/recommended.yaml From 95981332e328ddc40ebc613a6db432a068e8510a Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Thu, 6 May 2021 00:11:07 +0200 Subject: [PATCH 09/90] Update README.md (dart-lang/lints#13) Update the Github Actions link to filter to `main` branch --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 38b15123..aaae779d 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,5 +1,5 @@ [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) -[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions) +[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) This repo contains official Dart and Flutter lint rules. From 9ce04cf50e91a47fb1ad1ae5b49a9742b22a8b18 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 5 May 2021 15:11:24 -0700 Subject: [PATCH 10/90] bump to dev version (dart-lang/lints#14) * dev version * drop Flutter refs --- pkgs/lints/CHANGELOG.md | 2 +- pkgs/lints/README.md | 2 +- pkgs/lints/pubspec.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 4b98463d..4635b417 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.1 +## 1.0.0-dev.0 - Initial version diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index aaae779d..d0e83556 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,5 +1,5 @@ [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) -This repo contains official Dart and Flutter lint rules. +This repo contains official Dart lint rules. diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 4694db1f..ba3d5c09 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,6 +1,6 @@ name: lints -description: Official Dart and Flutter lint rules -version: 0.1.0 +description: Official Dart lint rules. +version: 1.0.0-dev.0 homepage: https://dart.dev/guides/language/effective-dart environment: From 735b8956e53c09bf2649eddf4e6901d151e364e5 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Tue, 11 May 2021 22:06:38 +0200 Subject: [PATCH 11/90] Update README.md (dart-lang/lints#18) --- pkgs/lints/README.md | 63 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index d0e83556..15cd96c3 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,5 +1,66 @@ [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) -This repo contains official Dart lint rules. +# Official Dart lint rules. +The Dart linter is a static analyzer for identifying possible problems in your +Dart source code. More than a hundred [linter rules][rules] are available, +checking anything from potential typing issues, coding style, and formatting. + +The current `package:lints` contains the official selections of lints that the +Dart team encourages using. + +Two sets of lints are available: + +* ***Core lints***: Lints that help identify critical issues that are likely to +lead to problems when running or consuming Dart code. All code should pass these +lints. + +* ***Recommended lints***: Lints that help identify additional issues that may +lead to problems when running or consuming Dart code, and lints that enforce +writing Dart using a single, idiomatic style and format. All code is encouraged +to pass these lints. The recommended lints include all the core lints. + +## Where these lints are used + +When creating new Dart project using the [`dart create`][dart create] command, +the lints from `package:lints` are enabled by default. + +When uploading a package to the [pub.dev] package repository, packages are +[awarded pub points][scoring] depending on whether they pass at least the 'core' +lints (note: the recommended lints automatically include all core lints). + +For documentation on the individual lints, see the [linter rules][rules] page on +dart.dev. + +## How to enable these lints + +For new apps created with `dart create`, the lints are enabled by default. + +For existing apps or packages, take these steps to enable these lints: + +1. Add a *dev* dependency on this package to your `pubspec.yaml` file: + +```yaml +dev_dependencies: + lints: ^1.0.0 +``` + +2. Create a new `analysis_options.yaml` file, next to the pubspec, that includes +the lints package: + +```yaml +include: package:lints/core.yaml +``` + +## Customizing the pre-defined lint sets + +You can customize the pre-defined lint sets, both to disable one or more of the +lints included, or to add additional lints. For details see [customizing static +analysis]. + +[dart create]: https://dart.dev/tools/dart-tool +[scoring]: https://pub.dev/help/scoring +[customizing static analysis]: https://dart.dev/guides/language/analysis-options +[rules]: https://dart.dev/tools/linter-rules +[pub.dev]: https://pub.dev From fa62baa14f705cecff8aad0e56677f2fc6a0efde Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Wed, 12 May 2021 16:27:42 +0200 Subject: [PATCH 12/90] Prep for publishing (dart-lang/lints#22) --- pkgs/lints/CHANGELOG.md | 4 ++++ pkgs/lints/pubspec.yaml | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 4635b417..06e4e0cd 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0 + +- Initial stable version + ## 1.0.0-dev.0 - Initial version diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index ba3d5c09..24c34f7f 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,7 +1,6 @@ name: lints -description: Official Dart lint rules. -version: 1.0.0-dev.0 -homepage: https://dart.dev/guides/language/effective-dart +description: Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. +version: 1.0.0 environment: sdk: '>=2.12.0 <3.0.0' From 1d311560a8bc5aa11eef59d49f453d9aa0862e16 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 12 May 2021 07:57:39 -0700 Subject: [PATCH 13/90] add instruction to call `pub get` (dart-lang/lints#21) --- pkgs/lints/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 15cd96c3..45b9139b 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -39,11 +39,10 @@ For new apps created with `dart create`, the lints are enabled by default. For existing apps or packages, take these steps to enable these lints: -1. Add a *dev* dependency on this package to your `pubspec.yaml` file: +1. In a terminal, located at the root of your package, run this command: -```yaml -dev_dependencies: - lints: ^1.0.0 +```terminal +dart pub add --dev lints ``` 2. Create a new `analysis_options.yaml` file, next to the pubspec, that includes From 133e80ee964aa0b6328b7fab972b7b9a58d42a79 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 12 May 2021 11:46:12 -0700 Subject: [PATCH 14/90] add pubspec entries tagged missing by pana (dart-lang/lints#31) * + entries * bump version --- pkgs/lints/pubspec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 24c34f7f..0398d8c4 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,6 +1,8 @@ name: lints description: Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. -version: 1.0.0 +homepage: https://github.com/dart-lang/lints +repository: https://github.com/dart-lang/lints +version: 1.0.1 environment: sdk: '>=2.12.0 <3.0.0' From 2113ad32c9350c82c47cb4432da39234de34ed93 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Wed, 12 May 2021 20:53:04 +0200 Subject: [PATCH 15/90] Update README.md (dart-lang/lints#33) --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 45b9139b..243e050d 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -49,7 +49,7 @@ dart pub add --dev lints the lints package: ```yaml -include: package:lints/core.yaml +include: package:lints/recommended.yaml ``` ## Customizing the pre-defined lint sets From a24bdb2a9862d940e3ba0ec0dd980e3a30ee412d Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 12 May 2021 12:12:26 -0700 Subject: [PATCH 16/90] + 1.0.1 (dart-lang/lints#34) --- pkgs/lints/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 06e4e0cd..32a17933 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1 + +- Documentation updates + ## 1.0.0 - Initial stable version From 4fee86b5b982bd23f3964425a916120de63813f5 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 12 May 2021 19:24:12 -0700 Subject: [PATCH 17/90] Update README.md (dart-lang/lints#27) Update README.md --- pkgs/lints/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 243e050d..7e0305c8 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -52,6 +52,12 @@ the lints package: include: package:lints/recommended.yaml ``` +or: + +```yaml +include: package:lints/core.yaml +``` + ## Customizing the pre-defined lint sets You can customize the pre-defined lint sets, both to disable one or more of the From d33a9607474bf89fd7d7c1854f7aa9c3fbf52cdf Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 13 May 2021 11:12:21 -0700 Subject: [PATCH 18/90] + example (dart-lang/lints#36) * + example * publish_to: none * docs --- pkgs/lints/example/README.md | 1 + pkgs/lints/example/analysis_options.yaml | 30 ++++++++++++++++++++++++ pkgs/lints/example/pubspec.yaml | 10 ++++++++ 3 files changed, 41 insertions(+) create mode 100644 pkgs/lints/example/README.md create mode 100644 pkgs/lints/example/analysis_options.yaml create mode 100644 pkgs/lints/example/pubspec.yaml diff --git a/pkgs/lints/example/README.md b/pkgs/lints/example/README.md new file mode 100644 index 00000000..63d13e1b --- /dev/null +++ b/pkgs/lints/example/README.md @@ -0,0 +1 @@ +An example project that uses Dart recommended lints. diff --git a/pkgs/lints/example/analysis_options.yaml b/pkgs/lints/example/analysis_options.yaml new file mode 100644 index 00000000..dee8927a --- /dev/null +++ b/pkgs/lints/example/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/pkgs/lints/example/pubspec.yaml b/pkgs/lints/example/pubspec.yaml new file mode 100644 index 00000000..71ddba9a --- /dev/null +++ b/pkgs/lints/example/pubspec.yaml @@ -0,0 +1,10 @@ +name: example +description: An example project that uses Dart recommended lints. +version: 0.1.0 +publish_to: none + +environment: + sdk: '>=2.12.0 <3.0.0' + +dev_dependencies: + lints: ^1.0.0 From b836ad5a1f74ef199f603355c128747f62740217 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Fri, 21 May 2021 14:36:57 -0700 Subject: [PATCH 19/90] add feedback notes (dart-lang/lints#43) * add feedback notes * typo --- pkgs/lints/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 7e0305c8..e4fe3611 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -64,8 +64,18 @@ You can customize the pre-defined lint sets, both to disable one or more of the lints included, or to add additional lints. For details see [customizing static analysis]. +## Submitting Feedback + +Feedback is welcome! If you want to propose an existing lint for inclusion here, +check to see if there is already an open [issue] and chime in. If there is not, +please start a conversation with a new issue. If you have questions about existing +lints or have an idea for a new one, please file an issue on the [linter repo]. + + [dart create]: https://dart.dev/tools/dart-tool [scoring]: https://pub.dev/help/scoring [customizing static analysis]: https://dart.dev/guides/language/analysis-options [rules]: https://dart.dev/tools/linter-rules [pub.dev]: https://pub.dev +[issue]: https://github.com/dart-lang/lints/issues +[linter repo]: https://github.com/dart-lang/linter From b165f7f234b40097045708433b1e041ea9654e5d Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 7 Jun 2021 13:51:15 -0700 Subject: [PATCH 20/90] Add notes regarding migrating from pedantic (dart-lang/lints#41) --- pkgs/lints/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index e4fe3611..d52bdfd1 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -64,6 +64,19 @@ You can customize the pre-defined lint sets, both to disable one or more of the lints included, or to add additional lints. For details see [customizing static analysis]. +## Migrating from `package:pedantic` + +In migrating from the pre-defined lint sets provided by the [`package:pedantic`], +you get static analysis coverage from 29 additional lints. There are, however, +6 lints which the pedantic package includes which are not included in the +pre-defined lint sets provided by the lints package: +`always_declare_return_types`, `prefer_single_quotes`, +`sort_child_properties_last` (included in [`package:flutter_lints`]), +`unawaited_futures`, `unsafe_html`, and +`use_full_hex_values_for_flutter_colors` (included in [`package:flutter_lints`]). +To keep any of these lints enabled, +add them to your [analysis options][customizing static analysis]. + ## Submitting Feedback Feedback is welcome! If you want to propose an existing lint for inclusion here, @@ -79,3 +92,5 @@ lints or have an idea for a new one, please file an issue on the [linter repo]. [pub.dev]: https://pub.dev [issue]: https://github.com/dart-lang/lints/issues [linter repo]: https://github.com/dart-lang/linter +[`package:pedantic`]: https://pub.dev/packages/pedantic +[`package:flutter_lints`]: https://pub.dev/packages/flutter_lints From 1c8b03024a826d84162ba60e97413fc85f10b8f8 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Fri, 30 Jul 2021 10:33:04 -0700 Subject: [PATCH 21/90] Tweak the README a bit and add a section on evolution process. (dart-lang/lints#46) * Tweak the README a bit and add a section on evolution process. * Fix typo. * "pre-defined" -> "predefined". --- pkgs/lints/README.md | 67 ++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index d52bdfd1..db0340fa 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,22 +1,20 @@ [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) -# Official Dart lint rules. +# Official Dart lint rules The Dart linter is a static analyzer for identifying possible problems in your Dart source code. More than a hundred [linter rules][rules] are available, checking anything from potential typing issues, coding style, and formatting. - -The current `package:lints` contains the official selections of lints that the -Dart team encourages using. +This package, `lints`, contains the lint settings recommended by the Dart team. Two sets of lints are available: -* ***Core lints***: Lints that help identify critical issues that are likely to +* **Core lints**: Lints that help identify critical issues that are likely to lead to problems when running or consuming Dart code. All code should pass these lints. -* ***Recommended lints***: Lints that help identify additional issues that may +* **Recommended lints**: Lints that help identify additional issues that may lead to problems when running or consuming Dart code, and lints that enforce writing Dart using a single, idiomatic style and format. All code is encouraged to pass these lints. The recommended lints include all the core lints. @@ -27,8 +25,7 @@ When creating new Dart project using the [`dart create`][dart create] command, the lints from `package:lints` are enabled by default. When uploading a package to the [pub.dev] package repository, packages are -[awarded pub points][scoring] depending on whether they pass at least the 'core' -lints (note: the recommended lints automatically include all core lints). +[awarded pub points][scoring] based on how many of the 'core' lints pass. For documentation on the individual lints, see the [linter rules][rules] page on dart.dev. @@ -39,37 +36,37 @@ For new apps created with `dart create`, the lints are enabled by default. For existing apps or packages, take these steps to enable these lints: -1. In a terminal, located at the root of your package, run this command: +1. In a terminal, located at the root of your package, run this command: -```terminal -dart pub add --dev lints -``` + ```terminal + dart pub add --dev lints + ``` -2. Create a new `analysis_options.yaml` file, next to the pubspec, that includes -the lints package: +2. Create a new `analysis_options.yaml` file, next to the pubspec, that + includes the lints package: -```yaml -include: package:lints/recommended.yaml -``` + ```yaml + include: package:lints/recommended.yaml + ``` -or: + or: -```yaml -include: package:lints/core.yaml -``` + ```yaml + include: package:lints/core.yaml + ``` -## Customizing the pre-defined lint sets +## Customizing the predefined lint sets -You can customize the pre-defined lint sets, both to disable one or more of the +You can customize the predefined lint sets, both to disable one or more of the lints included, or to add additional lints. For details see [customizing static analysis]. ## Migrating from `package:pedantic` -In migrating from the pre-defined lint sets provided by the [`package:pedantic`], -you get static analysis coverage from 29 additional lints. There are, however, +In migrating from the predefined lint sets provided by the [`package:pedantic`], +you get static analysis coverage from 29 additional lints. There are, however, 6 lints which the pedantic package includes which are not included in the -pre-defined lint sets provided by the lints package: +predefined lint sets provided by the lints package: `always_declare_return_types`, `prefer_single_quotes`, `sort_child_properties_last` (included in [`package:flutter_lints`]), `unawaited_futures`, `unsafe_html`, and @@ -77,13 +74,21 @@ pre-defined lint sets provided by the lints package: To keep any of these lints enabled, add them to your [analysis options][customizing static analysis]. -## Submitting Feedback +## Evolving the lint sets + +The Dart language changes and the ecosystem continues to develop new best +practices, so the lint sets must be periodically updated to reflect the best way +we know to write Dart code. The informal process we use is: + +1. Anyone can file an [issue] to discuss a potential change to a lint set. (A + change here means adding or removing a lint from one or both sets. If you + want to discuss implementing an entirely new lint, the place to suggest that + is at the [linter repo].) Feedback is welcome from any Dart user. -Feedback is welcome! If you want to propose an existing lint for inclusion here, -check to see if there is already an open [issue] and chime in. If there is not, -please start a conversation with a new issue. If you have questions about existing -lints or have an idea for a new one, please file an issue on the [linter repo]. +2. Periodically, a group of Dart and Flutter team members meet to review the + suggestions and decide what to adopt. +3. The lists are updated and a new version of the package is published. [dart create]: https://dart.dev/tools/dart-tool [scoring]: https://pub.dev/help/scoring From e93106e7b094d1829b119b9e99ee13f6478e45c5 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 19 Aug 2021 06:44:21 -0700 Subject: [PATCH 22/90] + issue templates (dart-lang/lints#49) * + issue templates * + lint proposal * + linter issue link outs * + flutter callout * drop flutter link --- pkgs/lints/.github/ISSUE_TEMPLATE/config.yml | 9 +++++++++ .../.github/ISSUE_TEMPLATE/lint-propoposal.md | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/lints/.github/ISSUE_TEMPLATE/config.yml create mode 100644 pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md diff --git a/pkgs/lints/.github/ISSUE_TEMPLATE/config.yml b/pkgs/lints/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..040ffa6b --- /dev/null +++ b/pkgs/lints/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +blank_issues_enabled: true +contact_links: + - name: Propose a new lint + url: https://github.com/dart-lang/linter/issues/new?assignees=&labels=enhancement%2C+lint+request&template=lint-request.md&title= + about: Request a new lint rule. + - name: Report an issue with a lint + url: https://github.com/dart-lang/linter/issues/new?assignees=&labels=&template=issue-report.md&title= + about: Create an issue report for an existing lint. + diff --git a/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md b/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md new file mode 100644 index 00000000..741636dd --- /dev/null +++ b/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md @@ -0,0 +1,14 @@ +--- +name: Lint proposal +about: Propose adding an existing lint rule to a defined rule set. +title: '' +labels: type-lint +assignees: '' + +--- + +**Describe the rule you'd like to see added and to what rule set** +Include as much detail as you can. + +**Additional context** +Add any other considerations or context here. From 9619bfea86892bbadb2c175afaaaaaa673f446c0 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 16 Sep 2021 09:19:02 -0700 Subject: [PATCH 23/90] Update README.md (dart-lang/lints#52) --- pkgs/lints/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index db0340fa..8cebaaad 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -68,10 +68,9 @@ you get static analysis coverage from 29 additional lints. There are, however, 6 lints which the pedantic package includes which are not included in the predefined lint sets provided by the lints package: `always_declare_return_types`, `prefer_single_quotes`, -`sort_child_properties_last` (included in [`package:flutter_lints`]), -`unawaited_futures`, `unsafe_html`, and -`use_full_hex_values_for_flutter_colors` (included in [`package:flutter_lints`]). -To keep any of these lints enabled, +`sort_child_properties_last`, `unawaited_futures`, `unsafe_html`, and +`use_full_hex_values_for_flutter_colors` (also included in +[`package:flutter_lints`]). To keep any of these lints enabled, add them to your [analysis options][customizing static analysis]. ## Evolving the lint sets From bd10aba983b0b2699a3c4b631b7a9bdd629e18b6 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Tue, 28 Sep 2021 20:19:20 +0200 Subject: [PATCH 24/90] Mention `dart:async` `unawaited` (dart-lang/lints#53) For people migrating from `pedantic`, point them to the new `unawaited` in `dart_async`. --- pkgs/lints/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 8cebaaad..2748bc64 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -73,6 +73,11 @@ predefined lint sets provided by the lints package: [`package:flutter_lints`]). To keep any of these lints enabled, add them to your [analysis options][customizing static analysis]. +Additionally, `package:pedantic` provides the `unawaited` method for use with +`unawaited_futures`. With SDK version 2.14 this method is available in the +`dart:async` package, and this is now the recommended way to use it. Be sure to +mark the minimum SDK version of your package as `2.14` if you do so. + ## Evolving the lint sets The Dart language changes and the ecosystem continues to develop new best From ec576f0734f3b1d5d5e4192fac38d47a406dac9e Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 12 Oct 2021 09:05:45 -0700 Subject: [PATCH 25/90] Update validate.yml --- pkgs/lints/.github/workflows/validate.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index a3ea9f8a..09461b05 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -11,6 +11,10 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + # Run weekly + schedule: + - cron: "0 0 * * 0" + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: From 4bc3e267adac4fc456f4d977cc6e9235058676b7 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 17 Mar 2022 14:15:14 -0700 Subject: [PATCH 26/90] Add lints for v2.0 (dart-lang/lints#72) --- pkgs/lints/CHANGELOG.md | 20 ++++++++++++++++---- pkgs/lints/lib/core.yaml | 2 ++ pkgs/lints/lib/recommended.yaml | 8 ++++++++ pkgs/lints/pubspec.yaml | 4 ++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 32a17933..9201fe60 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,19 @@ +## 2.0.0 + +- Added the following lints to core.yaml: + - `depend_on_referenced_packages` + - `null_check_on_nullable_type_parameter` +- Added the following lints to recommended.yaml: + - `library_private_types_in_public_api` + - `no_leading_underscores_for_library_prefixes` + - `no_leading_underscores_for_local_identifiers` + - `prefer_interpolation_to_compose_strings` + - `unnecessary_constructor_name` + - `unnecessary_late` + - `unnecessary_null_aware_assignments` + - `unnecessary_nullable_for_final_variable_declarations` +- Bumped the minimum required Dart SDK version to 2.17 + ## 1.0.1 - Documentation updates @@ -5,7 +21,3 @@ ## 1.0.0 - Initial stable version - -## 1.0.0-dev.0 - -- Initial version diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 96ac12d8..b5e8cd2e 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -8,6 +8,7 @@ linter: - camel_case_extensions - camel_case_types - curly_braces_in_flow_control_structures + - depend_on_referenced_packages - empty_catches - file_names - hash_and_equals @@ -15,6 +16,7 @@ linter: - list_remove_unrelated_type - no_duplicate_case_values - non_constant_identifier_names + - null_check_on_nullable_type_parameter - package_prefixed_library_names - prefer_generic_function_type_aliases - prefer_is_empty diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 4b875a22..13999d19 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -19,6 +19,9 @@ linter: - implementation_imports - library_names - library_prefixes + - library_private_types_in_public_api + - no_leading_underscores_for_library_prefixes + - no_leading_underscores_for_local_identifiers - null_closures - overridden_fields - package_names @@ -33,6 +36,7 @@ linter: - prefer_if_null_operators - prefer_initializing_formals - prefer_inlined_adds + - prefer_interpolation_to_compose_strings - prefer_is_not_operator - prefer_null_aware_operators - prefer_spread_collections @@ -42,9 +46,13 @@ linter: - type_init_formals - unnecessary_brace_in_string_interps - unnecessary_const + - unnecessary_constructor_name - unnecessary_getters_setters + - unnecessary_late - unnecessary_new + - unnecessary_null_aware_assignments - unnecessary_null_in_if_null_operators + - unnecessary_nullable_for_final_variable_declarations - unnecessary_string_escapes - unnecessary_string_interpolations - unnecessary_this diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 0398d8c4..3d192207 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -2,10 +2,10 @@ name: lints description: Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. homepage: https://github.com/dart-lang/lints repository: https://github.com/dart-lang/lints -version: 1.0.1 +version: 2.0.0 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.17.0-206.0.dev <3.0.0' # dependencies: # dev_dependencies: From 69eb53704a33760e62b07182e57bc11416e4df0d Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 20 Oct 2022 20:05:04 +0000 Subject: [PATCH 27/90] update lint files docs (dart-lang/lints#88) --- pkgs/lints/.github/dependabot.yaml | 8 ++++++++ pkgs/lints/.github/workflows/validate.yml | 2 +- pkgs/lints/CHANGELOG.md | 5 +++++ pkgs/lints/README.md | 3 ++- pkgs/lints/lib/core.yaml | 6 ++++++ pkgs/lints/lib/recommended.yaml | 9 +++++++++ pkgs/lints/pubspec.yaml | 11 ++++++----- 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 pkgs/lints/.github/dependabot.yaml diff --git a/pkgs/lints/.github/dependabot.yaml b/pkgs/lints/.github/dependabot.yaml new file mode 100644 index 00000000..21448193 --- /dev/null +++ b/pkgs/lints/.github/dependabot.yaml @@ -0,0 +1,8 @@ +# Dependabot configuration file. +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 09461b05..59847a7a 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b - name: Check for sources run: | diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 9201fe60..fd5cddc7 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.1 + +- Updated documentation for the `lib/core.yaml` and `lib/recommended.yaml` + analysis configurations. + ## 2.0.0 - Added the following lints to core.yaml: diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 2748bc64..2d9751a1 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,5 +1,6 @@ -[![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) +[![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) +[![package publisher](https://img.shields.io/pub/publisher/lints.svg)](https://pub.dev/packages/lints/publisher) # Official Dart lint rules diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index b5e8cd2e..ec6fff7c 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -1,3 +1,9 @@ +# This is a set of core lints used to identify critical issues. See +# https://github.com/dart-lang/lints for more information. +# +# For documentation about customizing static analysis for your project, see +# https://dart.dev/guides/language/analysis-options. + linter: rules: - avoid_empty_else diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 13999d19..75417738 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -1,3 +1,12 @@ +# This set of lints builds on top of `package:lints/core.yaml`; it includes +# lints that help identify additional issues that may lead to problems when +# running or consuming Dart code, as well as lints that enforce writing Dart +# using a single, idiomatic style. See https://github.com/dart-lang/lints for +# more information. +# +# For documentation about customizing static analysis for your project, see +# https://dart.dev/guides/language/analysis-options. + include: package:lints/core.yaml linter: diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 3d192207..13260db3 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,12 +1,13 @@ name: lints -description: Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. -homepage: https://github.com/dart-lang/lints +version: 2.0.1 +description: > + Official Dart lint rules. Defines the 'core' and 'recommended' set of lints + suggested by the Dart team. repository: https://github.com/dart-lang/lints -version: 2.0.0 environment: - sdk: '>=2.17.0-206.0.dev <3.0.0' + sdk: '>=2.17.0 <3.0.0' +# NOTE: Code is not allowed in this package. Do not add dependencies. # dependencies: # dev_dependencies: -# NOTE: Code is not allowed in this package. Do not add dependencies. From ae71463eab00e99856a442deac67bb9bb85dc769 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Oct 2022 13:12:35 -0700 Subject: [PATCH 28/90] Bump actions/checkout from 3.0.2 to 3.1.0 (dart-lang/lints#89) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.0.2 to 3.1.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/2541b1294d2704b0964813337f33b291d3f8596b...93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 59847a7a..fb16bf40 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - name: Check for sources run: | From 6ddd48bf4320c4967be6e81dec1a4c0ca0fb3671 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jan 2023 13:13:25 -0800 Subject: [PATCH 29/90] Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/lints#96) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8...755da8c3cf115ac066823e79a1e1788f8940201b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index fb16bf40..c93dee0d 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - name: Check for sources run: | From 5e681a4aa7d1bf67cff54b60b18b3a5121b5c953 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 08:35:51 -0800 Subject: [PATCH 30/90] Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/lints#98) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/755da8c3cf115ac066823e79a1e1788f8940201b...ac593985615ec2ede58e132d2e21d2b1cbd6127c) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index c93dee0d..b89093d2 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - name: Check for sources run: | From 9e6ce6cf99036abc57f3726429748a9f83895aa5 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Thu, 23 Mar 2023 17:53:53 +0100 Subject: [PATCH 31/90] Update README.md (dart-lang/lints#108) --- pkgs/lints/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 2d9751a1..83bc12fb 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -9,7 +9,7 @@ Dart source code. More than a hundred [linter rules][rules] are available, checking anything from potential typing issues, coding style, and formatting. This package, `lints`, contains the lint settings recommended by the Dart team. -Two sets of lints are available: +Two sets of Dart lints are available: * **Core lints**: Lints that help identify critical issues that are likely to lead to problems when running or consuming Dart code. All code should pass these @@ -20,6 +20,9 @@ lead to problems when running or consuming Dart code, and lints that enforce writing Dart using a single, idiomatic style and format. All code is encouraged to pass these lints. The recommended lints include all the core lints. +Finally, a third set [`flutter_lints`](https://pub.dev/packages/flutter_lints) +extends the recommended set with additional recommencded Flutter-specific lints. + ## Where these lints are used When creating new Dart project using the [`dart create`][dart create] command, From 43d0e5a4a258a7203853fccd738d3f2adddf8468 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Sat, 25 Mar 2023 11:49:35 -0500 Subject: [PATCH 32/90] Fix 'recommended' spelling in README (dart-lang/lints#109) --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 83bc12fb..e53035f1 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -21,7 +21,7 @@ writing Dart using a single, idiomatic style and format. All code is encouraged to pass these lints. The recommended lints include all the core lints. Finally, a third set [`flutter_lints`](https://pub.dev/packages/flutter_lints) -extends the recommended set with additional recommencded Flutter-specific lints. +extends the recommended set with additional recommended Flutter-specific lints. ## Where these lints are used From 5d8ad249409347e5f5bb476f7875ae7281072fa6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:15:51 -0700 Subject: [PATCH 33/90] Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/lints#110) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8f4b7f84864484a7bf31766abe9204da3cbe65b3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index b89093d2..19752be8 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - name: Check for sources run: | From 0e849aa0b1bf453d937e830c3f04eaa7aec23e0e Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 26 Apr 2023 12:04:53 -0700 Subject: [PATCH 34/90] Update lint-propoposal.md (dart-lang/lints#115) --- pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md b/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md index 741636dd..25571ac0 100644 --- a/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md +++ b/pkgs/lints/.github/ISSUE_TEMPLATE/lint-propoposal.md @@ -1,6 +1,6 @@ --- -name: Lint proposal -about: Propose adding an existing lint rule to a defined rule set. +name: Add an existing lint to the `core` or `recommended` rule set +about: Propose adding an existing lint rule to the `core` or `recommended` rule set. title: '' labels: type-lint assignees: '' From 21eddf7816c97564164905bdf09f8c45fad550f9 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 26 Apr 2023 13:58:36 -0700 Subject: [PATCH 35/90] 2.1.0 (dart-lang/lints#107) * 2.1.0 * constraint fix * ^^^ * bump SDK constraing --- pkgs/lints/CHANGELOG.md | 7 +++++++ pkgs/lints/lib/recommended.yaml | 1 - pkgs/lints/pubspec.yaml | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index fd5cddc7..6d831354 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.1.0 + +- Updated SDK lower-bound to 3.0 +- Removed `always_require_non_null_named_parameters` from `recommended.yaml` + as it is only relevant in Dart pre 2.12 and with Dart 3.0, libraries can + no longer be opted back that far. + ## 2.0.1 - Updated documentation for the `lib/core.yaml` and `lib/recommended.yaml` diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 75417738..77402e56 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -11,7 +11,6 @@ include: package:lints/core.yaml linter: rules: - - always_require_non_null_named_parameters - annotate_overrides - avoid_function_literals_in_foreach_calls - avoid_init_to_null diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 13260db3..f6df7d7a 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,12 +1,12 @@ name: lints -version: 2.0.1 +version: 2.1.0 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. repository: https://github.com/dart-lang/lints environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ^3.0.0-417 # NOTE: Code is not allowed in this package. Do not add dependencies. # dependencies: From ace519bce9d76263ebcf2084ca9fbd0bb6f3a16e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:21:46 -0700 Subject: [PATCH 36/90] Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/lints#116) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 3.5.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/8f4b7f84864484a7bf31766abe9204da3cbe65b3...8e5e7e5ab8b370d6c329ec480221332ada57f0ab) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 19752be8..cc216938 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - name: Check for sources run: | From b4910bd234a4f3a73def06ee72cb25091a5fb16f Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 15 May 2023 11:17:07 -0700 Subject: [PATCH 37/90] blast_repo fixes (dart-lang/lints#119) dependabot --- pkgs/lints/.github/dependabot.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/.github/dependabot.yaml b/pkgs/lints/.github/dependabot.yaml index 21448193..439e796b 100644 --- a/pkgs/lints/.github/dependabot.yaml +++ b/pkgs/lints/.github/dependabot.yaml @@ -2,7 +2,9 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "monthly" + interval: monthly + labels: + - autosubmit From 4234bca57982b3eaa56777376422e130126a8007 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 15 May 2023 11:17:15 -0700 Subject: [PATCH 38/90] blast_repo fixes (dart-lang/lints#120) auto-publish --- pkgs/lints/.github/workflows/publish.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pkgs/lints/.github/workflows/publish.yaml diff --git a/pkgs/lints/.github/workflows/publish.yaml b/pkgs/lints/.github/workflows/publish.yaml new file mode 100644 index 00000000..e8e5a365 --- /dev/null +++ b/pkgs/lints/.github/workflows/publish.yaml @@ -0,0 +1,14 @@ +# A CI configuration to auto-publish pub packages. + +name: Publish + +on: + pull_request: + branches: [ main ] + push: + tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] + +jobs: + publish: + if: ${{ github.repository_owner == 'dart-lang' }} + uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main From 9f0668b4c79356c03dc407333a898b51aef16eb7 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Wed, 24 May 2023 16:17:46 -0500 Subject: [PATCH 39/90] Update example for latest lints version (dart-lang/lints#123) --- pkgs/lints/example/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/lints/example/pubspec.yaml b/pkgs/lints/example/pubspec.yaml index 71ddba9a..7f3ec2b8 100644 --- a/pkgs/lints/example/pubspec.yaml +++ b/pkgs/lints/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.1.0 publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: ^3.0.0 dev_dependencies: - lints: ^1.0.0 + lints: ^2.1.0 From f1765d7fa5dc7dfc874ef479d16bafa1452e963e Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Fri, 26 May 2023 11:02:55 -0500 Subject: [PATCH 40/90] Remove pedantic from README (dart-lang/lints#124) --- pkgs/lints/README.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index e53035f1..801f8f52 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -65,23 +65,6 @@ You can customize the predefined lint sets, both to disable one or more of the lints included, or to add additional lints. For details see [customizing static analysis]. -## Migrating from `package:pedantic` - -In migrating from the predefined lint sets provided by the [`package:pedantic`], -you get static analysis coverage from 29 additional lints. There are, however, -6 lints which the pedantic package includes which are not included in the -predefined lint sets provided by the lints package: -`always_declare_return_types`, `prefer_single_quotes`, -`sort_child_properties_last`, `unawaited_futures`, `unsafe_html`, and -`use_full_hex_values_for_flutter_colors` (also included in -[`package:flutter_lints`]). To keep any of these lints enabled, -add them to your [analysis options][customizing static analysis]. - -Additionally, `package:pedantic` provides the `unawaited` method for use with -`unawaited_futures`. With SDK version 2.14 this method is available in the -`dart:async` package, and this is now the recommended way to use it. Be sure to -mark the minimum SDK version of your package as `2.14` if you do so. - ## Evolving the lint sets The Dart language changes and the ecosystem continues to develop new best From c445e0bace9095bd33eb935804da43d07e0cdd5c Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 30 May 2023 11:56:29 -0500 Subject: [PATCH 41/90] Add topics to the pubspec file (dart-lang/lints#122) --- pkgs/lints/CHANGELOG.md | 4 ++++ pkgs/lints/pubspec.yaml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 6d831354..20ed83cc 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.1-dev + +- Added the `analysis` and `lints` topics to the pubspec file. + ## 2.1.0 - Updated SDK lower-bound to 3.0 diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index f6df7d7a..0a991401 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,10 +1,14 @@ name: lints -version: 2.1.0 +version: 2.1.1-dev description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. repository: https://github.com/dart-lang/lints +topics: + - analysis + - lints + environment: sdk: ^3.0.0-417 From 9202d6b6511c7132b44f0b28874ed479ebcb1151 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 2 Jun 2023 10:40:56 -0700 Subject: [PATCH 42/90] mv analysis_options file (dart-lang/lints#129) --- pkgs/lints/.github/workflows/validate.yml | 19 +- pkgs/lints/CHANGELOG.md | 5 +- pkgs/lints/README.md | 131 +++- pkgs/lints/pubspec.yaml | 13 +- pkgs/lints/tool/README.md | 25 + pkgs/lints/tool/analysis_options.yaml | 1 + pkgs/lints/tool/gen_docs.dart | 108 +++ pkgs/lints/tool/rules.json | 910 ++++++++++++++++++++++ pkgs/lints/tool/validate_lib.dart | 26 + 9 files changed, 1206 insertions(+), 32 deletions(-) create mode 100644 pkgs/lints/tool/README.md create mode 100644 pkgs/lints/tool/analysis_options.yaml create mode 100644 pkgs/lints/tool/gen_docs.dart create mode 100644 pkgs/lints/tool/rules.json create mode 100644 pkgs/lints/tool/validate_lib.dart diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index cc216938..f328fcb6 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -7,27 +7,20 @@ on: branches: [ main ] pull_request: branches: [ main ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - # Run weekly schedule: - cron: "0 0 * * 0" -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f - - name: Check for sources - run: | - filecount=`find lib -name '*.dart' | wc -l` - if [ $filecount -ne 0 ] || [ -d "bin" ] - then - echo 'Dart sources are not allowed in this package!' - exit 1 - fi + - run: dart pub get + - run: dart format --output=none --set-exit-if-changed . + - run: dart analyze --fatal-infos + - run: dart tool/validate_lib.dart + - run: dart tool/gen_docs.dart --verify diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 20ed83cc..17cb7c36 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,10 +1,11 @@ -## 2.1.1-dev +## 2.1.1-wip - Added the `analysis` and `lints` topics to the pubspec file. +- Update the package's readme to include the lint rules that `package:lints/core.yaml` and `package:lints/recommended.yaml` include. ## 2.1.0 -- Updated SDK lower-bound to 3.0 +- Updated the SDK lower-bound to 3.0. - Removed `always_require_non_null_named_parameters` from `recommended.yaml` as it is only relevant in Dart pre 2.12 and with Dart 3.0, libraries can no longer be opted back that far. diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 801f8f52..c0d1a000 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -7,9 +7,12 @@ The Dart linter is a static analyzer for identifying possible problems in your Dart source code. More than a hundred [linter rules][rules] are available, checking anything from potential typing issues, coding style, and formatting. -This package, `lints`, contains the lint settings recommended by the Dart team. +This package - `package:lints` - contains the lint settings recommended by the +Dart team. -Two sets of Dart lints are available: +## Lint sets + +This package includes two sets of lints: * **Core lints**: Lints that help identify critical issues that are likely to lead to problems when running or consuming Dart code. All code should pass these @@ -20,8 +23,9 @@ lead to problems when running or consuming Dart code, and lints that enforce writing Dart using a single, idiomatic style and format. All code is encouraged to pass these lints. The recommended lints include all the core lints. -Finally, a third set [`flutter_lints`](https://pub.dev/packages/flutter_lints) -extends the recommended set with additional recommended Flutter-specific lints. +Additionally, a third lint set - +[`package:flutter_lints`](https://pub.dev/packages/flutter_lints) - extends the +recommended set with additional recommended Flutter-specific lints. Documentation on that can be found at [github.com/flutter/packages](https://github.com/flutter/packages/tree/main/packages/flutter_lints). ## Where these lints are used @@ -31,14 +35,11 @@ the lints from `package:lints` are enabled by default. When uploading a package to the [pub.dev] package repository, packages are [awarded pub points][scoring] based on how many of the 'core' lints pass. -For documentation on the individual lints, see the [linter rules][rules] page on -dart.dev. - -## How to enable these lints +## Enabling the lints -For new apps created with `dart create`, the lints are enabled by default. +For new apps created with `dart create` the recommended set of lints are enabled by default. -For existing apps or packages, take these steps to enable these lints: +For existing apps or packages, you can enable these lints via: 1. In a terminal, located at the root of your package, run this command: @@ -61,9 +62,8 @@ For existing apps or packages, take these steps to enable these lints: ## Customizing the predefined lint sets -You can customize the predefined lint sets, both to disable one or more of the -lints included, or to add additional lints. For details see [customizing static -analysis]. +For details on customizing static analysis above and beyond the predefined +lint sets, see [customizing static analysis]. ## Evolving the lint sets @@ -81,6 +81,111 @@ we know to write Dart code. The informal process we use is: 3. The lists are updated and a new version of the package is published. +## Lint set contents + +### Core lints + +To use these lints create an `analysis_options.yaml` file with: +`include: package:lints/core.yaml`. + + +| Lint Rules | Description | +| :--------- | :---------- | +| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | +| [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | +| [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | +| [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | +| [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | +| [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | +| [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | +| [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | +| [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | +| [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | +| [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | +| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | +| [`iterable_contains_unrelated_type`](https://dart.dev/lints/iterable_contains_unrelated_type) | Invocation of Iterable.contains with references of unrelated types. | +| [`list_remove_unrelated_type`](https://dart.dev/lints/list_remove_unrelated_type) | Invocation of `remove` with references of unrelated types. | +| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | +| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | +| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | +| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | +| [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | +| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | +| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | +| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | +| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | +| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | +| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | +| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | +| [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | +| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | + + +### Recommended lints + +To use these lints create an `analysis_options.yaml` file with: +`include: package:lints/recommended.yaml`. + + +| Lint Rules | Description | +| :--------- | :---------- | +| [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | +| [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | +| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | +| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | +| [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | +| [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | +| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | +| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | +| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | +| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | +| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | +| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | +| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | +| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | +| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | +| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | +| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | +| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | +| [`no_leading_underscores_for_local_identifiers`](https://dart.dev/lints/no_leading_underscores_for_local_identifiers) | Avoid leading underscores for local identifiers. | +| [`null_closures`](https://dart.dev/lints/null_closures) | Do not pass `null` as an argument where a closure is expected. | +| [`overridden_fields`](https://dart.dev/lints/overridden_fields) | Don't override fields. | +| [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | +| [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | +| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | +| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | +| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | +| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | +| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | +| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | +| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | +| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | +| [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | +| [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | +| [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | +| [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | +| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | +| [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | +| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | +| [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | +| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | +| [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | +| [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | +| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | +| [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | +| [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | +| [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | +| [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | +| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | +| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | +| [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | +| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | +| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | +| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | +| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | +| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | + + [dart create]: https://dart.dev/tools/dart-tool [scoring]: https://pub.dev/help/scoring [customizing static analysis]: https://dart.dev/guides/language/analysis-options diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 0a991401..7ead4e36 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 2.1.1-dev +version: 2.1.1-wip description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. @@ -10,8 +10,13 @@ topics: - lints environment: - sdk: ^3.0.0-417 + sdk: ^3.0.0 -# NOTE: Code is not allowed in this package. Do not add dependencies. +# NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: -# dev_dependencies: + +dev_dependencies: + collection: ^1.17.0 + http: ^1.0.0 + path: ^1.8.0 + yaml: ^3.1.0 diff --git a/pkgs/lints/tool/README.md b/pkgs/lints/tool/README.md new file mode 100644 index 00000000..2a95cc7a --- /dev/null +++ b/pkgs/lints/tool/README.md @@ -0,0 +1,25 @@ + +## `tool/validate_lib.dart` + +This tool ensures that we don't commit `.dart` source files into the lib/ +directory; it's automatically run by the CI. To run manually: + +``` +dart tool/validate_lib.dart +``` + +## `tool/gen_docs.dart` + +This tool regenerates the lists of core and recommended lints into the package's +README.md file. To use it, run: + +``` +dart tool/gen_docs.dart +``` + +It can also validate that the readme file is up-to-date. It's automatically +run by the CI; to run it manually: + +``` +dart tool/gen_docs.dart --verify +``` diff --git a/pkgs/lints/tool/analysis_options.yaml b/pkgs/lints/tool/analysis_options.yaml new file mode 100644 index 00000000..505a0b7f --- /dev/null +++ b/pkgs/lints/tool/analysis_options.yaml @@ -0,0 +1 @@ +include: ../lib/recommended.yaml diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart new file mode 100644 index 00000000..2a554c8a --- /dev/null +++ b/pkgs/lints/tool/gen_docs.dart @@ -0,0 +1,108 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:path/path.dart' as p; +import 'package:yaml/yaml.dart' as yaml; +import 'package:http/http.dart' as http; + +void main(List args) async { + final justVerify = args.isNotEmpty; + final lintRules = >{}; + + final rulesJsonFile = File('tool/rules.json'); + final rulesUrl = + 'https://dart-lang.github.io/linter/lints/machine/rules.json'; + if (!justVerify) { + rulesJsonFile.writeAsStringSync((await http.get(Uri.parse(rulesUrl))).body); + } + final rulesJson = (jsonDecode(rulesJsonFile.readAsStringSync()) as List) + .cast>(); + + final readmeFile = File('README.md'); + final readmeContent = readmeFile.readAsStringSync(); + + if (justVerify) { + print('Validating that ${readmeFile.path} is up-to-date ...'); + } else { + print('Regenerating ${readmeFile.path} ...'); + } + + for (var file in ['lib/core.yaml', 'lib/recommended.yaml']) { + var name = p.basenameWithoutExtension(file); + lintRules[name] = _parseRules(File(file)); + } + + var newContent = readmeContent; + + for (var ruleSetName in lintRules.keys) { + final comment = '\n'; + + newContent = newContent.replaceRange( + newContent.indexOf(comment) + comment.length, + newContent.lastIndexOf(comment), + _createRuleTable(lintRules[ruleSetName]!, rulesJson), + ); + } + + if (justVerify) { + if (newContent != readmeContent) { + print('${readmeFile.path} is not up-to-date (lint tables need to be ' + 'regenerated).'); + print(''); + print("Run 'dart tools/gen_docs.dart' to re-generate."); + exit(1); + } else { + print('${readmeFile.path} is up-to-date.'); + } + } else { + // Re-save rules.json. + const retainKeys = {'name', 'description'}; + for (var rule in rulesJson) { + rule.removeWhere((key, value) => !retainKeys.contains(key)); + } + rulesJsonFile + .writeAsStringSync(JsonEncoder.withIndent(' ').convert(rulesJson)); + + // Write out the readme file. + readmeFile.writeAsStringSync(newContent); + print('Wrote ${readmeFile.path}.'); + } +} + +List _parseRules(File yamlFile) { + var yamlData = yaml.loadYaml(yamlFile.readAsStringSync()) as Map; + return (yamlData['linter']['rules'] as List).toList().cast(); +} + +String _createRuleTable( + List rules, List> lintMeta) { + rules.sort(); + + final lines = [ + '| Lint Rules | Description |', + '| :--------- | :---------- |', + ...rules.map((rule) { + final ruleMeta = + lintMeta.firstWhereOrNull((meta) => meta['name'] == rule); + + if (ruleMeta == null) { + print('rules.json data for rule \'$rule\' not found.'); + print( + 'Update lib/rules.json from ' + 'https://github.com/dart-lang/linter/blob/gh-pages/lints/machine/rules.json.', + ); + exit(1); + } + final description = ruleMeta['description'] as String?; + + return '| [`$rule`](https://dart.dev/lints/$rule) | $description |'; + }), + ]; + + return '${lines.join('\n')}\n'; +} diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json new file mode 100644 index 00000000..b70a7350 --- /dev/null +++ b/pkgs/lints/tool/rules.json @@ -0,0 +1,910 @@ +[ + { + "name": "always_use_package_imports", + "description": "Avoid relative imports for files in `lib/`." + }, + { + "name": "avoid_dynamic_calls", + "description": "Avoid method calls or property accesses on a \"dynamic\" target." + }, + { + "name": "avoid_empty_else", + "description": "Avoid empty else statements." + }, + { + "name": "avoid_print", + "description": "Avoid `print` calls in production code." + }, + { + "name": "avoid_relative_lib_imports", + "description": "Avoid relative imports for files in `lib/`." + }, + { + "name": "avoid_returning_null_for_future", + "description": "Avoid returning null for Future." + }, + { + "name": "avoid_slow_async_io", + "description": "Avoid slow async `dart:io` methods." + }, + { + "name": "avoid_type_to_string", + "description": "Avoid .toString() in production code since results may be minified." + }, + { + "name": "avoid_types_as_parameter_names", + "description": "Avoid types as parameter names." + }, + { + "name": "avoid_web_libraries_in_flutter", + "description": "Avoid using web-only libraries outside Flutter web plugin packages." + }, + { + "name": "cancel_subscriptions", + "description": "Cancel instances of dart.async.StreamSubscription." + }, + { + "name": "close_sinks", + "description": "Close instances of `dart.core.Sink`." + }, + { + "name": "collection_methods_unrelated_type", + "description": "Invocation of various collection methods with arguments of unrelated types." + }, + { + "name": "comment_references", + "description": "Only reference in scope identifiers in doc comments." + }, + { + "name": "control_flow_in_finally", + "description": "Avoid control flow in finally blocks." + }, + { + "name": "deprecated_member_use_from_same_package", + "description": "Avoid using deprecated elements from within the package in which they are declared." + }, + { + "name": "diagnostic_describe_all_properties", + "description": "DO reference all public properties in debug methods." + }, + { + "name": "discarded_futures", + "description": "Don't invoke asynchronous functions in non-async blocks." + }, + { + "name": "empty_statements", + "description": "Avoid empty statements." + }, + { + "name": "hash_and_equals", + "description": "Always override `hashCode` if overriding `==`." + }, + { + "name": "implicit_reopen", + "description": "Don't implicitly reopen classes." + }, + { + "name": "invalid_case_patterns", + "description": "Use case expressions that are valid in Dart 3.0." + }, + { + "name": "invariant_booleans", + "description": "Conditions should not unconditionally evaluate to `true` or to `false`." + }, + { + "name": "iterable_contains_unrelated_type", + "description": "Invocation of Iterable.contains with references of unrelated types." + }, + { + "name": "list_remove_unrelated_type", + "description": "Invocation of `remove` with references of unrelated types." + }, + { + "name": "literal_only_boolean_expressions", + "description": "Boolean expression composed only with literals." + }, + { + "name": "no_adjacent_strings_in_list", + "description": "Don't use adjacent strings in list." + }, + { + "name": "no_duplicate_case_values", + "description": "Don't use more than one case with same value." + }, + { + "name": "no_logic_in_create_state", + "description": "Don't put any logic in createState." + }, + { + "name": "no_self_assignments", + "description": "Don't assign a variable to itself." + }, + { + "name": "no_wildcard_variable_uses", + "description": "Don't use wildcard parameters or variables." + }, + { + "name": "prefer_relative_imports", + "description": "Prefer relative imports for files in `lib/`." + }, + { + "name": "prefer_void_to_null", + "description": "Don't use the Null type, unless you are positive that you don't want void." + }, + { + "name": "test_types_in_equals", + "description": "Test type arguments in operator ==(Object other)." + }, + { + "name": "throw_in_finally", + "description": "Avoid `throw` in finally block." + }, + { + "name": "unnecessary_statements", + "description": "Avoid using unnecessary statements." + }, + { + "name": "unrelated_type_equality_checks", + "description": "Equality operator `==` invocation with references of unrelated types." + }, + { + "name": "unsafe_html", + "description": "Avoid unsafe HTML APIs." + }, + { + "name": "use_build_context_synchronously", + "description": "Do not use BuildContexts across async gaps." + }, + { + "name": "use_key_in_widget_constructors", + "description": "Use key in widget constructors." + }, + { + "name": "valid_regexps", + "description": "Use valid regular expression syntax." + }, + { + "name": "depend_on_referenced_packages", + "description": "Depend on referenced packages." + }, + { + "name": "package_names", + "description": "Use `lowercase_with_underscores` for package names." + }, + { + "name": "secure_pubspec_urls", + "description": "Use secure urls in `pubspec.yaml`." + }, + { + "name": "sort_pub_dependencies", + "description": "Sort pub dependencies alphabetically." + }, + { + "name": "always_declare_return_types", + "description": "Declare method return types." + }, + { + "name": "always_put_control_body_on_new_line", + "description": "Separate the control structure expression from its statement." + }, + { + "name": "always_put_required_named_parameters_first", + "description": "Put required named parameters first." + }, + { + "name": "always_require_non_null_named_parameters", + "description": "Specify `@required` on named parameters without defaults." + }, + { + "name": "always_specify_types", + "description": "Specify type annotations." + }, + { + "name": "annotate_overrides", + "description": "Annotate overridden members." + }, + { + "name": "avoid_annotating_with_dynamic", + "description": "Avoid annotating with dynamic when not required." + }, + { + "name": "avoid_as", + "description": "Avoid using `as`." + }, + { + "name": "avoid_bool_literals_in_conditional_expressions", + "description": "Avoid bool literals in conditional expressions." + }, + { + "name": "avoid_catches_without_on_clauses", + "description": "Avoid catches without on clauses." + }, + { + "name": "avoid_catching_errors", + "description": "Don't explicitly catch Error or types that implement it." + }, + { + "name": "avoid_classes_with_only_static_members", + "description": "Avoid defining a class that contains only static members." + }, + { + "name": "avoid_double_and_int_checks", + "description": "Avoid double and int checks." + }, + { + "name": "avoid_equals_and_hash_code_on_mutable_classes", + "description": "Avoid overloading operator == and hashCode on classes not marked `@immutable`." + }, + { + "name": "avoid_escaping_inner_quotes", + "description": "Avoid escaping inner quotes by converting surrounding quotes." + }, + { + "name": "avoid_field_initializers_in_const_classes", + "description": "Avoid field initializers in const classes." + }, + { + "name": "avoid_final_parameters", + "description": "Avoid final for parameter declarations." + }, + { + "name": "avoid_function_literals_in_foreach_calls", + "description": "Avoid using `forEach` with a function literal." + }, + { + "name": "avoid_implementing_value_types", + "description": "Don't implement classes that override `==`." + }, + { + "name": "avoid_init_to_null", + "description": "Don't explicitly initialize variables to null." + }, + { + "name": "avoid_js_rounded_ints", + "description": "Avoid JavaScript rounded ints." + }, + { + "name": "avoid_multiple_declarations_per_line", + "description": "Don't declare multiple variables on a single line." + }, + { + "name": "avoid_null_checks_in_equality_operators", + "description": "Don't check for null in custom == operators." + }, + { + "name": "avoid_positional_boolean_parameters", + "description": "Avoid positional boolean parameters." + }, + { + "name": "avoid_private_typedef_functions", + "description": "Avoid private typedef functions." + }, + { + "name": "avoid_redundant_argument_values", + "description": "Avoid redundant argument values." + }, + { + "name": "avoid_renaming_method_parameters", + "description": "Don't rename parameters of overridden methods." + }, + { + "name": "avoid_return_types_on_setters", + "description": "Avoid return types on setters." + }, + { + "name": "avoid_returning_null", + "description": "Avoid returning null from members whose return type is bool, double, int, or num." + }, + { + "name": "avoid_returning_null_for_void", + "description": "Avoid returning null for void." + }, + { + "name": "avoid_returning_this", + "description": "Avoid returning this from methods just to enable a fluent interface." + }, + { + "name": "avoid_setters_without_getters", + "description": "Avoid setters without getters." + }, + { + "name": "avoid_shadowing_type_parameters", + "description": "Avoid shadowing type parameters." + }, + { + "name": "avoid_single_cascade_in_expression_statements", + "description": "Avoid single cascade in expression statements." + }, + { + "name": "avoid_types_on_closure_parameters", + "description": "Avoid annotating types for function expression parameters." + }, + { + "name": "avoid_unnecessary_containers", + "description": "Avoid unnecessary containers." + }, + { + "name": "avoid_unused_constructor_parameters", + "description": "Avoid defining unused parameters in constructors." + }, + { + "name": "avoid_void_async", + "description": "Avoid async functions that return void." + }, + { + "name": "await_only_futures", + "description": "Await only futures." + }, + { + "name": "camel_case_extensions", + "description": "Name extensions using UpperCamelCase." + }, + { + "name": "camel_case_types", + "description": "Name types using UpperCamelCase." + }, + { + "name": "cascade_invocations", + "description": "Cascade consecutive method invocations on the same reference." + }, + { + "name": "cast_nullable_to_non_nullable", + "description": "Don't cast a nullable value to a non nullable type." + }, + { + "name": "combinators_ordering", + "description": "Sort combinator names alphabetically." + }, + { + "name": "conditional_uri_does_not_exist", + "description": "Missing conditional import." + }, + { + "name": "constant_identifier_names", + "description": "Prefer using lowerCamelCase for constant names." + }, + { + "name": "curly_braces_in_flow_control_structures", + "description": "DO use curly braces for all flow control structures." + }, + { + "name": "dangling_library_doc_comments", + "description": "Attach library doc comments to library directives." + }, + { + "name": "deprecated_consistency", + "description": "Missing deprecated annotation." + }, + { + "name": "directives_ordering", + "description": "Adhere to Effective Dart Guide directives sorting conventions." + }, + { + "name": "do_not_use_environment", + "description": "Do not use environment declared variables." + }, + { + "name": "empty_catches", + "description": "Avoid empty catch blocks." + }, + { + "name": "empty_constructor_bodies", + "description": "Use `;` instead of `{}` for empty constructor bodies." + }, + { + "name": "enable_null_safety", + "description": "Do use sound null safety." + }, + { + "name": "eol_at_end_of_file", + "description": "Put a single newline at end of file." + }, + { + "name": "exhaustive_cases", + "description": "Define case clauses for all constants in enum-like classes." + }, + { + "name": "file_names", + "description": "Name source files using `lowercase_with_underscores`." + }, + { + "name": "flutter_style_todos", + "description": "Use Flutter TODO format: // TODO(username): message, https://URL-to-issue." + }, + { + "name": "implementation_imports", + "description": "Don't import implementation files from another package." + }, + { + "name": "implicit_call_tearoffs", + "description": "Explicitly tear-off `call` methods when using an object as a Function." + }, + { + "name": "join_return_with_assignment", + "description": "Join return statement with assignment when possible." + }, + { + "name": "leading_newlines_in_multiline_strings", + "description": "Start multiline strings with a newline." + }, + { + "name": "library_annotations", + "description": "Attach library annotations to library directives." + }, + { + "name": "library_names", + "description": "Name libraries using `lowercase_with_underscores`." + }, + { + "name": "library_prefixes", + "description": "Use `lowercase_with_underscores` when specifying a library prefix." + }, + { + "name": "library_private_types_in_public_api", + "description": "Avoid using private types in public APIs." + }, + { + "name": "lines_longer_than_80_chars", + "description": "Avoid lines longer than 80 characters." + }, + { + "name": "matching_super_parameters", + "description": "Use matching super parameter names." + }, + { + "name": "missing_whitespace_between_adjacent_strings", + "description": "Missing whitespace between adjacent strings." + }, + { + "name": "no_default_cases", + "description": "No default cases." + }, + { + "name": "no_leading_underscores_for_library_prefixes", + "description": "Avoid leading underscores for library prefixes." + }, + { + "name": "no_leading_underscores_for_local_identifiers", + "description": "Avoid leading underscores for local identifiers." + }, + { + "name": "no_literal_bool_comparisons", + "description": "Don't compare booleans to boolean literals." + }, + { + "name": "no_runtimeType_toString", + "description": "Avoid calling toString() on runtimeType." + }, + { + "name": "non_constant_identifier_names", + "description": "Name non-constant identifiers using lowerCamelCase." + }, + { + "name": "noop_primitive_operations", + "description": "Noop primitive operations." + }, + { + "name": "null_check_on_nullable_type_parameter", + "description": "Don't use null check on a potentially nullable type parameter." + }, + { + "name": "null_closures", + "description": "Do not pass `null` as an argument where a closure is expected." + }, + { + "name": "omit_local_variable_types", + "description": "Omit type annotations for local variables." + }, + { + "name": "one_member_abstracts", + "description": "Avoid defining a one-member abstract class when a simple function will do." + }, + { + "name": "only_throw_errors", + "description": "Only throw instances of classes extending either Exception or Error." + }, + { + "name": "overridden_fields", + "description": "Don't override fields." + }, + { + "name": "package_api_docs", + "description": "Provide doc comments for all public APIs." + }, + { + "name": "package_prefixed_library_names", + "description": "Prefix library names with the package name and a dot-separated path." + }, + { + "name": "parameter_assignments", + "description": "Don't reassign references to parameters of functions or methods." + }, + { + "name": "prefer_adjacent_string_concatenation", + "description": "Use adjacent strings to concatenate string literals." + }, + { + "name": "prefer_asserts_in_initializer_lists", + "description": "Prefer putting asserts in initializer lists." + }, + { + "name": "prefer_asserts_with_message", + "description": "Prefer asserts with message." + }, + { + "name": "prefer_bool_in_asserts", + "description": "Prefer using a boolean as the assert condition." + }, + { + "name": "prefer_collection_literals", + "description": "Use collection literals when possible." + }, + { + "name": "prefer_conditional_assignment", + "description": "Prefer using `??=` over testing for null." + }, + { + "name": "prefer_const_constructors", + "description": "Prefer const with constant constructors." + }, + { + "name": "prefer_const_constructors_in_immutables", + "description": "Prefer declaring const constructors on `@immutable` classes." + }, + { + "name": "prefer_const_declarations", + "description": "Prefer const over final for declarations." + }, + { + "name": "prefer_const_literals_to_create_immutables", + "description": "Prefer const literals as parameters of constructors on @immutable classes." + }, + { + "name": "prefer_constructors_over_static_methods", + "description": "Prefer defining constructors instead of static methods to create instances." + }, + { + "name": "prefer_contains", + "description": "Use contains for `List` and `String` instances." + }, + { + "name": "prefer_double_quotes", + "description": "Prefer double quotes where they won't require escape sequences." + }, + { + "name": "prefer_equal_for_default_values", + "description": "Use `=` to separate a named parameter from its default value." + }, + { + "name": "prefer_expression_function_bodies", + "description": "Use => for short members whose body is a single return statement." + }, + { + "name": "prefer_final_fields", + "description": "Private field could be final." + }, + { + "name": "prefer_final_in_for_each", + "description": "Prefer final in for-each loop variable if reference is not reassigned." + }, + { + "name": "prefer_final_locals", + "description": "Prefer final for variable declarations if they are not reassigned." + }, + { + "name": "prefer_final_parameters", + "description": "Prefer final for parameter declarations if they are not reassigned." + }, + { + "name": "prefer_for_elements_to_map_fromIterable", + "description": "Prefer 'for' elements when building maps from iterables." + }, + { + "name": "prefer_foreach", + "description": "Use `forEach` to only apply a function to all the elements." + }, + { + "name": "prefer_function_declarations_over_variables", + "description": "Use a function declaration to bind a function to a name." + }, + { + "name": "prefer_generic_function_type_aliases", + "description": "Prefer generic function type aliases." + }, + { + "name": "prefer_if_elements_to_conditional_expressions", + "description": "Prefer if elements to conditional expressions where possible." + }, + { + "name": "prefer_if_null_operators", + "description": "Prefer using if null operators." + }, + { + "name": "prefer_initializing_formals", + "description": "Use initializing formals when possible." + }, + { + "name": "prefer_inlined_adds", + "description": "Inline list item declarations where possible." + }, + { + "name": "prefer_int_literals", + "description": "Prefer int literals over double literals." + }, + { + "name": "prefer_interpolation_to_compose_strings", + "description": "Use interpolation to compose strings and values." + }, + { + "name": "prefer_is_empty", + "description": "Use `isEmpty` for Iterables and Maps." + }, + { + "name": "prefer_is_not_empty", + "description": "Use `isNotEmpty` for Iterables and Maps." + }, + { + "name": "prefer_is_not_operator", + "description": "Prefer is! operator." + }, + { + "name": "prefer_iterable_whereType", + "description": "Prefer to use whereType on iterable." + }, + { + "name": "prefer_mixin", + "description": "Prefer using mixins." + }, + { + "name": "prefer_null_aware_method_calls", + "description": "Prefer null aware method calls." + }, + { + "name": "prefer_null_aware_operators", + "description": "Prefer using null aware operators." + }, + { + "name": "prefer_single_quotes", + "description": "Only use double quotes for strings containing single quotes." + }, + { + "name": "prefer_spread_collections", + "description": "Use spread collections when possible." + }, + { + "name": "prefer_typing_uninitialized_variables", + "description": "Prefer typing uninitialized variables and fields." + }, + { + "name": "provide_deprecation_message", + "description": "Provide a deprecation message, via @Deprecated(\"message\")." + }, + { + "name": "public_member_api_docs", + "description": "Document all public members." + }, + { + "name": "recursive_getters", + "description": "Property getter recursively returns itself." + }, + { + "name": "require_trailing_commas", + "description": "Use trailing commas for all function calls and declarations." + }, + { + "name": "sized_box_for_whitespace", + "description": "SizedBox for whitespace." + }, + { + "name": "sized_box_shrink_expand", + "description": "Use SizedBox shrink and expand named constructors." + }, + { + "name": "slash_for_doc_comments", + "description": "Prefer using /// for doc comments." + }, + { + "name": "sort_child_properties_last", + "description": "Sort child properties last in widget instance creations." + }, + { + "name": "sort_constructors_first", + "description": "Sort constructor declarations before other members." + }, + { + "name": "sort_unnamed_constructors_first", + "description": "Sort unnamed constructor declarations first." + }, + { + "name": "super_goes_last", + "description": "Place the `super` call last in a constructor initialization list." + }, + { + "name": "tighten_type_of_initializing_formals", + "description": "Tighten type of initializing formal." + }, + { + "name": "type_annotate_public_apis", + "description": "Type annotate public APIs." + }, + { + "name": "type_init_formals", + "description": "Don't type annotate initializing formals." + }, + { + "name": "type_literal_in_constant_pattern", + "description": "Don't use constant patterns with type literals." + }, + { + "name": "unawaited_futures", + "description": "`Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `dart:async`." + }, + { + "name": "unnecessary_await_in_return", + "description": "Unnecessary await keyword in return." + }, + { + "name": "unnecessary_brace_in_string_interps", + "description": "Avoid using braces in interpolation when not needed." + }, + { + "name": "unnecessary_breaks", + "description": "Don't use explicit `break`s when a break is implied." + }, + { + "name": "unnecessary_const", + "description": "Avoid const keyword." + }, + { + "name": "unnecessary_constructor_name", + "description": "Unnecessary `.new` constructor name." + }, + { + "name": "unnecessary_final", + "description": "Don't use `final` for local variables." + }, + { + "name": "unnecessary_getters_setters", + "description": "Avoid wrapping fields in getters and setters just to be \"safe\"." + }, + { + "name": "unnecessary_lambdas", + "description": "Don't create a lambda when a tear-off will do." + }, + { + "name": "unnecessary_late", + "description": "Don't specify the `late` modifier when it is not needed." + }, + { + "name": "unnecessary_library_directive", + "description": "Avoid library directives unless they have documentation comments or annotations." + }, + { + "name": "unnecessary_new", + "description": "Unnecessary new keyword." + }, + { + "name": "unnecessary_null_aware_assignments", + "description": "Avoid null in null-aware assignment." + }, + { + "name": "unnecessary_null_aware_operator_on_extension_on_nullable", + "description": "Unnecessary null aware operator on extension on a nullable type." + }, + { + "name": "unnecessary_null_checks", + "description": "Unnecessary null checks." + }, + { + "name": "unnecessary_null_in_if_null_operators", + "description": "Avoid using `null` in `if null` operators." + }, + { + "name": "unnecessary_nullable_for_final_variable_declarations", + "description": "Use a non-nullable type for a final variable initialized with a non-nullable value." + }, + { + "name": "unnecessary_overrides", + "description": "Don't override a method to do a super method invocation with the same parameters." + }, + { + "name": "unnecessary_parenthesis", + "description": "Unnecessary parentheses can be removed." + }, + { + "name": "unnecessary_raw_strings", + "description": "Unnecessary raw string." + }, + { + "name": "unnecessary_string_escapes", + "description": "Remove unnecessary backslashes in strings." + }, + { + "name": "unnecessary_string_interpolations", + "description": "Unnecessary string interpolation." + }, + { + "name": "unnecessary_this", + "description": "Don't access members with `this` unless avoiding shadowing." + }, + { + "name": "unnecessary_to_list_in_spreads", + "description": "Unnecessary toList() in spreads." + }, + { + "name": "unreachable_from_main", + "description": "Unreachable top-level members in executable libraries." + }, + { + "name": "use_colored_box", + "description": "Use `ColoredBox`." + }, + { + "name": "use_decorated_box", + "description": "Use `DecoratedBox`." + }, + { + "name": "use_enums", + "description": "Use enums rather than classes that behave like enums." + }, + { + "name": "use_full_hex_values_for_flutter_colors", + "description": "Prefer an 8-digit hexadecimal integer(0xFFFFFFFF) to instantiate Color." + }, + { + "name": "use_function_type_syntax_for_parameters", + "description": "Use generic function type syntax for parameters." + }, + { + "name": "use_if_null_to_convert_nulls_to_bools", + "description": "Use if-null operators to convert nulls to bools." + }, + { + "name": "use_is_even_rather_than_modulo", + "description": "Prefer intValue.isOdd/isEven instead of checking the result of % 2." + }, + { + "name": "use_late_for_private_fields_and_variables", + "description": "Use late for private members with a non-nullable type." + }, + { + "name": "use_named_constants", + "description": "Use predefined named constants." + }, + { + "name": "use_raw_strings", + "description": "Use raw string to avoid escapes." + }, + { + "name": "use_rethrow_when_possible", + "description": "Use rethrow to rethrow a caught exception." + }, + { + "name": "use_setters_to_change_properties", + "description": "Use a setter for operations that conceptually change a property." + }, + { + "name": "use_string_buffers", + "description": "Use string buffers to compose strings." + }, + { + "name": "use_string_in_part_of_directives", + "description": "Use string in part of directives." + }, + { + "name": "use_super_parameters", + "description": "Use super-initializer parameters where possible." + }, + { + "name": "use_test_throws_matchers", + "description": "Use throwsA matcher instead of fail()." + }, + { + "name": "use_to_and_as_if_applicable", + "description": "Start the name of the method with to/_to or as/_as if applicable." + }, + { + "name": "void_checks", + "description": "Don't assign to void." + } +] \ No newline at end of file diff --git a/pkgs/lints/tool/validate_lib.dart b/pkgs/lints/tool/validate_lib.dart new file mode 100644 index 00000000..38b1ce80 --- /dev/null +++ b/pkgs/lints/tool/validate_lib.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:path/path.dart' as p; + +void main(List args) { + print('Validating that there are no .dart source files in lib/ ...'); + + final dartSourceFiles = Directory('lib') + .listSync(recursive: true) + .whereType() + .where((file) => p.extension(file.path) == '.dart') + .toList(); + + if (dartSourceFiles.isEmpty) { + print('No Dart files found.'); + } else { + for (var file in dartSourceFiles) { + print(' error: found ${file.path}'); + } + exit(1); + } +} From b8de47a96cdff473e3f6cd8dbcf3221aaace4324 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 2 Jun 2023 14:07:41 -0700 Subject: [PATCH 43/90] update the readme to clarify the package's goals (dart-lang/lints#130) * update the readme to clarify the package's goals * Update README.md Co-authored-by: Parker Lougheed * add a link to the topics documentation --------- Co-authored-by: Parker Lougheed --- pkgs/lints/CHANGELOG.md | 5 +++-- pkgs/lints/README.md | 25 ++++++++++++++++++------- pkgs/lints/pubspec.yaml | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 17cb7c36..b1c323af 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,7 +1,8 @@ -## 2.1.1-wip +## 2.1.1 - Added the `analysis` and `lints` topics to the pubspec file. -- Update the package's readme to include the lint rules that `package:lints/core.yaml` and `package:lints/recommended.yaml` include. +- Update the package's readme to include the list of lint rules that + `package:lints/core.yaml` and `package:lints/recommended.yaml` include. ## 2.1.0 diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index c0d1a000..d661b923 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -25,7 +25,17 @@ to pass these lints. The recommended lints include all the core lints. Additionally, a third lint set - [`package:flutter_lints`](https://pub.dev/packages/flutter_lints) - extends the -recommended set with additional recommended Flutter-specific lints. Documentation on that can be found at [github.com/flutter/packages](https://github.com/flutter/packages/tree/main/packages/flutter_lints). +recommended set with additional recommended Flutter-specific lints. + +The Dart team will likely not provide recommendations past the `core` and +`recommended` sets (e.g., a `strict` rule set). However, there are many such rule +sets in the ecosystem (available at [pub.dev](https://pub.dev/)). + +Rule set authors: consider adding the `lints` topic to your pubspec to allow +easier discovery (e.g., +[pub.dev/packages?q=topic:lints](https://pub.dev/packages?q=topic%3Alints)). +For more information about topics, see +[dart.dev/tools/pub/pubspec#topics](https://dart.dev/tools/pub/pubspec#topics). ## Where these lints are used @@ -37,7 +47,8 @@ When uploading a package to the [pub.dev] package repository, packages are ## Enabling the lints -For new apps created with `dart create` the recommended set of lints are enabled by default. +For new apps created with `dart create` the `recommended` set of lints are enabled +by default. For existing apps or packages, you can enable these lints via: @@ -69,12 +80,12 @@ lint sets, see [customizing static analysis]. The Dart language changes and the ecosystem continues to develop new best practices, so the lint sets must be periodically updated to reflect the best way -we know to write Dart code. The informal process we use is: +we know to write Dart code. The process we use is: -1. Anyone can file an [issue] to discuss a potential change to a lint set. (A - change here means adding or removing a lint from one or both sets. If you - want to discuss implementing an entirely new lint, the place to suggest that - is at the [linter repo].) Feedback is welcome from any Dart user. +1. Anyone can file an [issue] to discuss a potential change to a lint set + (i.e., adding or removing a lint from one or both sets; if you're proposing + an entirely new lint, the place to suggest that is at the [linter repo]). + Feedback is welcome from any Dart user. 2. Periodically, a group of Dart and Flutter team members meet to review the suggestions and decide what to adopt. diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 7ead4e36..1f79b0fe 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 2.1.1-wip +version: 2.1.1 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. From e59a008d19aedf3efe3dab862089009bd9ab1e36 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 6 Jun 2023 09:05:20 -0700 Subject: [PATCH 44/90] add 'has quick-fix' checkboxes to the package's readme (dart-lang/lints#131) --- pkgs/lints/CHANGELOG.md | 4 + pkgs/lints/README.md | 174 ++++----- pkgs/lints/pubspec.yaml | 2 +- pkgs/lints/tool/gen_docs.dart | 16 +- pkgs/lints/tool/rules.json | 681 ++++++++++++++++++++++------------ 5 files changed, 554 insertions(+), 323 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index b1c323af..9d8d3eef 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.2-wip + +- Add 'has quick-fix' checkboxes to the package's readme. + ## 2.1.1 - Added the `analysis` and `lints` topics to the pubspec file. diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index d661b923..0edf5cd4 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -100,36 +100,36 @@ To use these lints create an `analysis_options.yaml` file with: `include: package:lints/core.yaml`. -| Lint Rules | Description | -| :--------- | :---------- | -| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | -| [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | -| [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | -| [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | -| [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | -| [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | -| [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | -| [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | -| [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | -| [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | -| [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | -| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | -| [`iterable_contains_unrelated_type`](https://dart.dev/lints/iterable_contains_unrelated_type) | Invocation of Iterable.contains with references of unrelated types. | -| [`list_remove_unrelated_type`](https://dart.dev/lints/list_remove_unrelated_type) | Invocation of `remove` with references of unrelated types. | -| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | -| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | -| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | -| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | -| [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | -| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | -| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | -| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | -| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | -| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | -| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | -| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | -| [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | -| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | +| Lint Rules | Description | Fix | +| :--------- | :---------- | --- | +| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | ✅ | +| [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | ✅ | +| [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | | +| [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | ✅ | +| [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | ✅ | +| [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | | +| [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | | +| [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | ✅ | +| [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | | +| [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | ✅ | +| [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | +| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | +| [`iterable_contains_unrelated_type`](https://dart.dev/lints/iterable_contains_unrelated_type) | Invocation of Iterable.contains with references of unrelated types. | | +| [`list_remove_unrelated_type`](https://dart.dev/lints/list_remove_unrelated_type) | Invocation of `remove` with references of unrelated types. | | +| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | +| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | +| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | +| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | +| [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | ✅ | +| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | ✅ | +| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | ✅ | +| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | ✅ | +| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | ✅ | +| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | +| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | +| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | +| [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | | +| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | | ### Recommended lints @@ -138,63 +138,63 @@ To use these lints create an `analysis_options.yaml` file with: `include: package:lints/recommended.yaml`. -| Lint Rules | Description | -| :--------- | :---------- | -| [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | -| [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | -| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | -| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | -| [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | -| [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | -| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | -| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | -| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | -| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | -| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | -| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | -| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | -| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | -| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | -| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | -| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | -| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | -| [`no_leading_underscores_for_local_identifiers`](https://dart.dev/lints/no_leading_underscores_for_local_identifiers) | Avoid leading underscores for local identifiers. | -| [`null_closures`](https://dart.dev/lints/null_closures) | Do not pass `null` as an argument where a closure is expected. | -| [`overridden_fields`](https://dart.dev/lints/overridden_fields) | Don't override fields. | -| [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | -| [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | -| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | -| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | -| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | -| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | -| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | -| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | -| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | -| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | -| [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | -| [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | -| [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | -| [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | -| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | -| [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | -| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | -| [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | -| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | -| [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | -| [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | -| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | -| [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | -| [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | -| [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | -| [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | -| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | -| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | -| [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | -| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | -| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | -| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | -| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | -| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | +| Lint Rules | Description | Fix | +| :--------- | :---------- | --- | +| [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | +| [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | +| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | ✅ | +| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | ✅ | +| [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | ✅ | +| [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | ✅ | +| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | ✅ | +| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | ✅ | +| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | ✅ | +| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | | +| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | ✅ | +| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | +| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | +| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | +| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | | +| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | +| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | +| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | +| [`no_leading_underscores_for_local_identifiers`](https://dart.dev/lints/no_leading_underscores_for_local_identifiers) | Avoid leading underscores for local identifiers. | ✅ | +| [`null_closures`](https://dart.dev/lints/null_closures) | Do not pass `null` as an argument where a closure is expected. | ✅ | +| [`overridden_fields`](https://dart.dev/lints/overridden_fields) | Don't override fields. | | +| [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | | +| [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | ✅ | +| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | ✅ | +| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | ✅ | +| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | ✅ | +| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | | +| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | ✅ | +| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | ✅ | +| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | ✅ | +| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | ✅ | +| [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | ✅ | +| [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | ✅ | +| [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | ✅ | +| [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | ✅ | +| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | ✅ | +| [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | ✅ | +| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | ✅ | +| [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | | +| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | ✅ | +| [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | ✅ | +| [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | ✅ | +| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | ✅ | +| [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | ✅ | +| [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | ✅ | +| [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | ✅ | +| [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | ✅ | +| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | ✅ | +| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | ✅ | +| [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | ✅ | +| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | ✅ | +| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | ✅ | +| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | ✅ | +| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | +| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | [dart create]: https://dart.dev/tools/dart-tool diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 1f79b0fe..121dbd67 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 2.1.1 +version: 2.1.2-wip description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index 2a554c8a..5d25efc7 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -61,7 +61,7 @@ void main(List args) async { } } else { // Re-save rules.json. - const retainKeys = {'name', 'description'}; + const retainKeys = {'name', 'description', 'fixStatus'}; for (var rule in rulesJson) { rule.removeWhere((key, value) => !retainKeys.contains(key)); } @@ -84,23 +84,23 @@ String _createRuleTable( rules.sort(); final lines = [ - '| Lint Rules | Description |', - '| :--------- | :---------- |', + '| Lint Rules | Description | Fix |', + '| :--------- | :---------- | --- |', ...rules.map((rule) { final ruleMeta = lintMeta.firstWhereOrNull((meta) => meta['name'] == rule); if (ruleMeta == null) { print('rules.json data for rule \'$rule\' not found.'); - print( - 'Update lib/rules.json from ' - 'https://github.com/dart-lang/linter/blob/gh-pages/lints/machine/rules.json.', - ); + print('Update lib/rules.json from ' + 'https://dart-lang.github.io/linter/lints/machine/rules.json.'); exit(1); } final description = ruleMeta['description'] as String?; + final hasFix = ruleMeta['fixStatus'] == 'hasFix'; + final fixDesc = hasFix ? '✅' : ''; - return '| [`$rule`](https://dart.dev/lints/$rule) | $description |'; + return '| [`$rule`](https://dart.dev/lints/$rule) | $description | $fixDesc |'; }), ]; diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index b70a7350..c96bd46d 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -1,910 +1,1137 @@ [ { "name": "always_use_package_imports", - "description": "Avoid relative imports for files in `lib/`." + "description": "Avoid relative imports for files in `lib/`.", + "fixStatus": "hasFix" }, { "name": "avoid_dynamic_calls", - "description": "Avoid method calls or property accesses on a \"dynamic\" target." + "description": "Avoid method calls or property accesses on a \"dynamic\" target.", + "fixStatus": "noFix" }, { "name": "avoid_empty_else", - "description": "Avoid empty else statements." + "description": "Avoid empty else statements.", + "fixStatus": "hasFix" }, { "name": "avoid_print", - "description": "Avoid `print` calls in production code." + "description": "Avoid `print` calls in production code.", + "fixStatus": "hasFix" }, { "name": "avoid_relative_lib_imports", - "description": "Avoid relative imports for files in `lib/`." + "description": "Avoid relative imports for files in `lib/`.", + "fixStatus": "hasFix" }, { "name": "avoid_returning_null_for_future", - "description": "Avoid returning null for Future." + "description": "Avoid returning null for Future.", + "fixStatus": "hasFix" }, { "name": "avoid_slow_async_io", - "description": "Avoid slow async `dart:io` methods." + "description": "Avoid slow async `dart:io` methods.", + "fixStatus": "needsFix" }, { "name": "avoid_type_to_string", - "description": "Avoid .toString() in production code since results may be minified." + "description": "Avoid .toString() in production code since results may be minified.", + "fixStatus": "noFix" }, { "name": "avoid_types_as_parameter_names", - "description": "Avoid types as parameter names." + "description": "Avoid types as parameter names.", + "fixStatus": "hasFix" }, { "name": "avoid_web_libraries_in_flutter", - "description": "Avoid using web-only libraries outside Flutter web plugin packages." + "description": "Avoid using web-only libraries outside Flutter web plugin packages.", + "fixStatus": "noFix" }, { "name": "cancel_subscriptions", - "description": "Cancel instances of dart.async.StreamSubscription." + "description": "Cancel instances of dart.async.StreamSubscription.", + "fixStatus": "noFix" }, { "name": "close_sinks", - "description": "Close instances of `dart.core.Sink`." + "description": "Close instances of `dart.core.Sink`.", + "fixStatus": "noFix" }, { "name": "collection_methods_unrelated_type", - "description": "Invocation of various collection methods with arguments of unrelated types." + "description": "Invocation of various collection methods with arguments of unrelated types.", + "fixStatus": "noFix" }, { "name": "comment_references", - "description": "Only reference in scope identifiers in doc comments." + "description": "Only reference in scope identifiers in doc comments.", + "fixStatus": "noFix" }, { "name": "control_flow_in_finally", - "description": "Avoid control flow in finally blocks." + "description": "Avoid control flow in finally blocks.", + "fixStatus": "noFix" }, { "name": "deprecated_member_use_from_same_package", - "description": "Avoid using deprecated elements from within the package in which they are declared." + "description": "Avoid using deprecated elements from within the package in which they are declared.", + "fixStatus": "needsFix" }, { "name": "diagnostic_describe_all_properties", - "description": "DO reference all public properties in debug methods." + "description": "DO reference all public properties in debug methods.", + "fixStatus": "hasFix" }, { "name": "discarded_futures", - "description": "Don't invoke asynchronous functions in non-async blocks." + "description": "Don't invoke asynchronous functions in non-async blocks.", + "fixStatus": "hasFix" }, { "name": "empty_statements", - "description": "Avoid empty statements." + "description": "Avoid empty statements.", + "fixStatus": "hasFix" }, { "name": "hash_and_equals", - "description": "Always override `hashCode` if overriding `==`." + "description": "Always override `hashCode` if overriding `==`.", + "fixStatus": "hasFix" }, { "name": "implicit_reopen", - "description": "Don't implicitly reopen classes." + "description": "Don't implicitly reopen classes.", + "fixStatus": "hasFix" }, { "name": "invalid_case_patterns", - "description": "Use case expressions that are valid in Dart 3.0." + "description": "Use case expressions that are valid in Dart 3.0.", + "fixStatus": "hasFix" }, { "name": "invariant_booleans", - "description": "Conditions should not unconditionally evaluate to `true` or to `false`." + "description": "Conditions should not unconditionally evaluate to `true` or to `false`.", + "fixStatus": "noFix" }, { "name": "iterable_contains_unrelated_type", - "description": "Invocation of Iterable.contains with references of unrelated types." + "description": "Invocation of Iterable.contains with references of unrelated types.", + "fixStatus": "noFix" }, { "name": "list_remove_unrelated_type", - "description": "Invocation of `remove` with references of unrelated types." + "description": "Invocation of `remove` with references of unrelated types.", + "fixStatus": "noFix" }, { "name": "literal_only_boolean_expressions", - "description": "Boolean expression composed only with literals." + "description": "Boolean expression composed only with literals.", + "fixStatus": "noFix" }, { "name": "no_adjacent_strings_in_list", - "description": "Don't use adjacent strings in list." + "description": "Don't use adjacent strings in list.", + "fixStatus": "needsFix" }, { "name": "no_duplicate_case_values", - "description": "Don't use more than one case with same value." + "description": "Don't use more than one case with same value.", + "fixStatus": "hasFix" }, { "name": "no_logic_in_create_state", - "description": "Don't put any logic in createState." + "description": "Don't put any logic in createState.", + "fixStatus": "noFix" }, { "name": "no_self_assignments", - "description": "Don't assign a variable to itself." + "description": "Don't assign a variable to itself.", + "fixStatus": "needsEvaluation" }, { "name": "no_wildcard_variable_uses", - "description": "Don't use wildcard parameters or variables." + "description": "Don't use wildcard parameters or variables.", + "fixStatus": "unregistered" }, { "name": "prefer_relative_imports", - "description": "Prefer relative imports for files in `lib/`." + "description": "Prefer relative imports for files in `lib/`.", + "fixStatus": "hasFix" }, { "name": "prefer_void_to_null", - "description": "Don't use the Null type, unless you are positive that you don't want void." + "description": "Don't use the Null type, unless you are positive that you don't want void.", + "fixStatus": "hasFix" }, { "name": "test_types_in_equals", - "description": "Test type arguments in operator ==(Object other)." + "description": "Test type arguments in operator ==(Object other).", + "fixStatus": "noFix" }, { "name": "throw_in_finally", - "description": "Avoid `throw` in finally block." + "description": "Avoid `throw` in finally block.", + "fixStatus": "noFix" }, { "name": "unnecessary_statements", - "description": "Avoid using unnecessary statements." + "description": "Avoid using unnecessary statements.", + "fixStatus": "noFix" }, { "name": "unrelated_type_equality_checks", - "description": "Equality operator `==` invocation with references of unrelated types." + "description": "Equality operator `==` invocation with references of unrelated types.", + "fixStatus": "noFix" }, { "name": "unsafe_html", - "description": "Avoid unsafe HTML APIs." + "description": "Avoid unsafe HTML APIs.", + "fixStatus": "unregistered" }, { "name": "use_build_context_synchronously", - "description": "Do not use BuildContexts across async gaps." + "description": "Do not use BuildContexts across async gaps.", + "fixStatus": "noFix" }, { "name": "use_key_in_widget_constructors", - "description": "Use key in widget constructors." + "description": "Use key in widget constructors.", + "fixStatus": "hasFix" }, { "name": "valid_regexps", - "description": "Use valid regular expression syntax." + "description": "Use valid regular expression syntax.", + "fixStatus": "noFix" }, { "name": "depend_on_referenced_packages", - "description": "Depend on referenced packages." + "description": "Depend on referenced packages.", + "fixStatus": "needsFix" }, { "name": "package_names", - "description": "Use `lowercase_with_underscores` for package names." + "description": "Use `lowercase_with_underscores` for package names.", + "fixStatus": "noFix" }, { "name": "secure_pubspec_urls", - "description": "Use secure urls in `pubspec.yaml`." + "description": "Use secure urls in `pubspec.yaml`.", + "fixStatus": "noFix" }, { "name": "sort_pub_dependencies", - "description": "Sort pub dependencies alphabetically." + "description": "Sort pub dependencies alphabetically.", + "fixStatus": "needsFix" }, { "name": "always_declare_return_types", - "description": "Declare method return types." + "description": "Declare method return types.", + "fixStatus": "hasFix" }, { "name": "always_put_control_body_on_new_line", - "description": "Separate the control structure expression from its statement." + "description": "Separate the control structure expression from its statement.", + "fixStatus": "hasFix" }, { "name": "always_put_required_named_parameters_first", - "description": "Put required named parameters first." + "description": "Put required named parameters first.", + "fixStatus": "hasFix" }, { "name": "always_require_non_null_named_parameters", - "description": "Specify `@required` on named parameters without defaults." + "description": "Specify `@required` on named parameters without defaults.", + "fixStatus": "hasFix" }, { "name": "always_specify_types", - "description": "Specify type annotations." + "description": "Specify type annotations.", + "fixStatus": "hasFix" }, { "name": "annotate_overrides", - "description": "Annotate overridden members." + "description": "Annotate overridden members.", + "fixStatus": "hasFix" }, { "name": "avoid_annotating_with_dynamic", - "description": "Avoid annotating with dynamic when not required." + "description": "Avoid annotating with dynamic when not required.", + "fixStatus": "hasFix" }, { "name": "avoid_as", - "description": "Avoid using `as`." + "description": "Avoid using `as`.", + "fixStatus": "noFix" }, { "name": "avoid_bool_literals_in_conditional_expressions", - "description": "Avoid bool literals in conditional expressions." + "description": "Avoid bool literals in conditional expressions.", + "fixStatus": "needsFix" }, { "name": "avoid_catches_without_on_clauses", - "description": "Avoid catches without on clauses." + "description": "Avoid catches without on clauses.", + "fixStatus": "noFix" }, { "name": "avoid_catching_errors", - "description": "Don't explicitly catch Error or types that implement it." + "description": "Don't explicitly catch Error or types that implement it.", + "fixStatus": "unregistered" }, { "name": "avoid_classes_with_only_static_members", - "description": "Avoid defining a class that contains only static members." + "description": "Avoid defining a class that contains only static members.", + "fixStatus": "noFix" }, { "name": "avoid_double_and_int_checks", - "description": "Avoid double and int checks." + "description": "Avoid double and int checks.", + "fixStatus": "needsFix" }, { "name": "avoid_equals_and_hash_code_on_mutable_classes", - "description": "Avoid overloading operator == and hashCode on classes not marked `@immutable`." + "description": "Avoid overloading operator == and hashCode on classes not marked `@immutable`.", + "fixStatus": "noFix" }, { "name": "avoid_escaping_inner_quotes", - "description": "Avoid escaping inner quotes by converting surrounding quotes." + "description": "Avoid escaping inner quotes by converting surrounding quotes.", + "fixStatus": "hasFix" }, { "name": "avoid_field_initializers_in_const_classes", - "description": "Avoid field initializers in const classes." + "description": "Avoid field initializers in const classes.", + "fixStatus": "noFix" }, { "name": "avoid_final_parameters", - "description": "Avoid final for parameter declarations." + "description": "Avoid final for parameter declarations.", + "fixStatus": "needsFix" }, { "name": "avoid_function_literals_in_foreach_calls", - "description": "Avoid using `forEach` with a function literal." + "description": "Avoid using `forEach` with a function literal.", + "fixStatus": "hasFix" }, { "name": "avoid_implementing_value_types", - "description": "Don't implement classes that override `==`." + "description": "Don't implement classes that override `==`.", + "fixStatus": "noFix" }, { "name": "avoid_init_to_null", - "description": "Don't explicitly initialize variables to null." + "description": "Don't explicitly initialize variables to null.", + "fixStatus": "hasFix" }, { "name": "avoid_js_rounded_ints", - "description": "Avoid JavaScript rounded ints." + "description": "Avoid JavaScript rounded ints.", + "fixStatus": "noFix" }, { "name": "avoid_multiple_declarations_per_line", - "description": "Don't declare multiple variables on a single line." + "description": "Don't declare multiple variables on a single line.", + "fixStatus": "hasFix" }, { "name": "avoid_null_checks_in_equality_operators", - "description": "Don't check for null in custom == operators." + "description": "Don't check for null in custom == operators.", + "fixStatus": "hasFix" }, { "name": "avoid_positional_boolean_parameters", - "description": "Avoid positional boolean parameters." + "description": "Avoid positional boolean parameters.", + "fixStatus": "noFix" }, { "name": "avoid_private_typedef_functions", - "description": "Avoid private typedef functions." + "description": "Avoid private typedef functions.", + "fixStatus": "hasFix" }, { "name": "avoid_redundant_argument_values", - "description": "Avoid redundant argument values." + "description": "Avoid redundant argument values.", + "fixStatus": "hasFix" }, { "name": "avoid_renaming_method_parameters", - "description": "Don't rename parameters of overridden methods." + "description": "Don't rename parameters of overridden methods.", + "fixStatus": "hasFix" }, { "name": "avoid_return_types_on_setters", - "description": "Avoid return types on setters." + "description": "Avoid return types on setters.", + "fixStatus": "hasFix" }, { "name": "avoid_returning_null", - "description": "Avoid returning null from members whose return type is bool, double, int, or num." + "description": "Avoid returning null from members whose return type is bool, double, int, or num.", + "fixStatus": "noFix" }, { "name": "avoid_returning_null_for_void", - "description": "Avoid returning null for void." + "description": "Avoid returning null for void.", + "fixStatus": "hasFix" }, { "name": "avoid_returning_this", - "description": "Avoid returning this from methods just to enable a fluent interface." + "description": "Avoid returning this from methods just to enable a fluent interface.", + "fixStatus": "noFix" }, { "name": "avoid_setters_without_getters", - "description": "Avoid setters without getters." + "description": "Avoid setters without getters.", + "fixStatus": "needsFix" }, { "name": "avoid_shadowing_type_parameters", - "description": "Avoid shadowing type parameters." + "description": "Avoid shadowing type parameters.", + "fixStatus": "noFix" }, { "name": "avoid_single_cascade_in_expression_statements", - "description": "Avoid single cascade in expression statements." + "description": "Avoid single cascade in expression statements.", + "fixStatus": "hasFix" }, { "name": "avoid_types_on_closure_parameters", - "description": "Avoid annotating types for function expression parameters." + "description": "Avoid annotating types for function expression parameters.", + "fixStatus": "hasFix" }, { "name": "avoid_unnecessary_containers", - "description": "Avoid unnecessary containers." + "description": "Avoid unnecessary containers.", + "fixStatus": "hasFix" }, { "name": "avoid_unused_constructor_parameters", - "description": "Avoid defining unused parameters in constructors." + "description": "Avoid defining unused parameters in constructors.", + "fixStatus": "hasFix" }, { "name": "avoid_void_async", - "description": "Avoid async functions that return void." + "description": "Avoid async functions that return void.", + "fixStatus": "hasFix" }, { "name": "await_only_futures", - "description": "Await only futures." + "description": "Await only futures.", + "fixStatus": "hasFix" }, { "name": "camel_case_extensions", - "description": "Name extensions using UpperCamelCase." + "description": "Name extensions using UpperCamelCase.", + "fixStatus": "noFix" }, { "name": "camel_case_types", - "description": "Name types using UpperCamelCase." + "description": "Name types using UpperCamelCase.", + "fixStatus": "noFix" }, { "name": "cascade_invocations", - "description": "Cascade consecutive method invocations on the same reference." + "description": "Cascade consecutive method invocations on the same reference.", + "fixStatus": "hasFix" }, { "name": "cast_nullable_to_non_nullable", - "description": "Don't cast a nullable value to a non nullable type." + "description": "Don't cast a nullable value to a non nullable type.", + "fixStatus": "hasFix" }, { "name": "combinators_ordering", - "description": "Sort combinator names alphabetically." + "description": "Sort combinator names alphabetically.", + "fixStatus": "hasFix" }, { "name": "conditional_uri_does_not_exist", - "description": "Missing conditional import." + "description": "Missing conditional import.", + "fixStatus": "noFix" }, { "name": "constant_identifier_names", - "description": "Prefer using lowerCamelCase for constant names." + "description": "Prefer using lowerCamelCase for constant names.", + "fixStatus": "hasFix" }, { "name": "curly_braces_in_flow_control_structures", - "description": "DO use curly braces for all flow control structures." + "description": "DO use curly braces for all flow control structures.", + "fixStatus": "hasFix" }, { "name": "dangling_library_doc_comments", - "description": "Attach library doc comments to library directives." + "description": "Attach library doc comments to library directives.", + "fixStatus": "hasFix" }, { "name": "deprecated_consistency", - "description": "Missing deprecated annotation." + "description": "Missing deprecated annotation.", + "fixStatus": "needsFix" }, { "name": "directives_ordering", - "description": "Adhere to Effective Dart Guide directives sorting conventions." + "description": "Adhere to Effective Dart Guide directives sorting conventions.", + "fixStatus": "hasFix" }, { "name": "do_not_use_environment", - "description": "Do not use environment declared variables." + "description": "Do not use environment declared variables.", + "fixStatus": "noFix" }, { "name": "empty_catches", - "description": "Avoid empty catch blocks." + "description": "Avoid empty catch blocks.", + "fixStatus": "hasFix" }, { "name": "empty_constructor_bodies", - "description": "Use `;` instead of `{}` for empty constructor bodies." + "description": "Use `;` instead of `{}` for empty constructor bodies.", + "fixStatus": "hasFix" }, { "name": "enable_null_safety", - "description": "Do use sound null safety." + "description": "Do use sound null safety.", + "fixStatus": "noFix" }, { "name": "eol_at_end_of_file", - "description": "Put a single newline at end of file." + "description": "Put a single newline at end of file.", + "fixStatus": "hasFix" }, { "name": "exhaustive_cases", - "description": "Define case clauses for all constants in enum-like classes." + "description": "Define case clauses for all constants in enum-like classes.", + "fixStatus": "hasFix" }, { "name": "file_names", - "description": "Name source files using `lowercase_with_underscores`." + "description": "Name source files using `lowercase_with_underscores`.", + "fixStatus": "noFix" }, { "name": "flutter_style_todos", - "description": "Use Flutter TODO format: // TODO(username): message, https://URL-to-issue." + "description": "Use Flutter TODO format: // TODO(username): message, https://URL-to-issue.", + "fixStatus": "noFix" }, { "name": "implementation_imports", - "description": "Don't import implementation files from another package." + "description": "Don't import implementation files from another package.", + "fixStatus": "noFix" }, { "name": "implicit_call_tearoffs", - "description": "Explicitly tear-off `call` methods when using an object as a Function." + "description": "Explicitly tear-off `call` methods when using an object as a Function.", + "fixStatus": "hasFix" }, { "name": "join_return_with_assignment", - "description": "Join return statement with assignment when possible." + "description": "Join return statement with assignment when possible.", + "fixStatus": "needsFix" }, { "name": "leading_newlines_in_multiline_strings", - "description": "Start multiline strings with a newline." + "description": "Start multiline strings with a newline.", + "fixStatus": "hasFix" }, { "name": "library_annotations", - "description": "Attach library annotations to library directives." + "description": "Attach library annotations to library directives.", + "fixStatus": "hasFix" }, { "name": "library_names", - "description": "Name libraries using `lowercase_with_underscores`." + "description": "Name libraries using `lowercase_with_underscores`.", + "fixStatus": "noFix" }, { "name": "library_prefixes", - "description": "Use `lowercase_with_underscores` when specifying a library prefix." + "description": "Use `lowercase_with_underscores` when specifying a library prefix.", + "fixStatus": "noFix" }, { "name": "library_private_types_in_public_api", - "description": "Avoid using private types in public APIs." + "description": "Avoid using private types in public APIs.", + "fixStatus": "noFix" }, { "name": "lines_longer_than_80_chars", - "description": "Avoid lines longer than 80 characters." + "description": "Avoid lines longer than 80 characters.", + "fixStatus": "noFix" }, { "name": "matching_super_parameters", - "description": "Use matching super parameter names." + "description": "Use matching super parameter names.", + "fixStatus": "needsFix" }, { "name": "missing_whitespace_between_adjacent_strings", - "description": "Missing whitespace between adjacent strings." + "description": "Missing whitespace between adjacent strings.", + "fixStatus": "needsFix" }, { "name": "no_default_cases", - "description": "No default cases." + "description": "No default cases.", + "fixStatus": "needsFix" }, { "name": "no_leading_underscores_for_library_prefixes", - "description": "Avoid leading underscores for library prefixes." + "description": "Avoid leading underscores for library prefixes.", + "fixStatus": "hasFix" }, { "name": "no_leading_underscores_for_local_identifiers", - "description": "Avoid leading underscores for local identifiers." + "description": "Avoid leading underscores for local identifiers.", + "fixStatus": "hasFix" }, { "name": "no_literal_bool_comparisons", - "description": "Don't compare booleans to boolean literals." + "description": "Don't compare booleans to boolean literals.", + "fixStatus": "hasFix" }, { "name": "no_runtimeType_toString", - "description": "Avoid calling toString() on runtimeType." + "description": "Avoid calling toString() on runtimeType.", + "fixStatus": "noFix" }, { "name": "non_constant_identifier_names", - "description": "Name non-constant identifiers using lowerCamelCase." + "description": "Name non-constant identifiers using lowerCamelCase.", + "fixStatus": "hasFix" }, { "name": "noop_primitive_operations", - "description": "Noop primitive operations." + "description": "Noop primitive operations.", + "fixStatus": "hasFix" }, { "name": "null_check_on_nullable_type_parameter", - "description": "Don't use null check on a potentially nullable type parameter." + "description": "Don't use null check on a potentially nullable type parameter.", + "fixStatus": "hasFix" }, { "name": "null_closures", - "description": "Do not pass `null` as an argument where a closure is expected." + "description": "Do not pass `null` as an argument where a closure is expected.", + "fixStatus": "hasFix" }, { "name": "omit_local_variable_types", - "description": "Omit type annotations for local variables." + "description": "Omit type annotations for local variables.", + "fixStatus": "hasFix" }, { "name": "one_member_abstracts", - "description": "Avoid defining a one-member abstract class when a simple function will do." + "description": "Avoid defining a one-member abstract class when a simple function will do.", + "fixStatus": "noFix" }, { "name": "only_throw_errors", - "description": "Only throw instances of classes extending either Exception or Error." + "description": "Only throw instances of classes extending either Exception or Error.", + "fixStatus": "noFix" }, { "name": "overridden_fields", - "description": "Don't override fields." + "description": "Don't override fields.", + "fixStatus": "noFix" }, { "name": "package_api_docs", - "description": "Provide doc comments for all public APIs." + "description": "Provide doc comments for all public APIs.", + "fixStatus": "noFix" }, { "name": "package_prefixed_library_names", - "description": "Prefix library names with the package name and a dot-separated path." + "description": "Prefix library names with the package name and a dot-separated path.", + "fixStatus": "noFix" }, { "name": "parameter_assignments", - "description": "Don't reassign references to parameters of functions or methods." + "description": "Don't reassign references to parameters of functions or methods.", + "fixStatus": "noFix" }, { "name": "prefer_adjacent_string_concatenation", - "description": "Use adjacent strings to concatenate string literals." + "description": "Use adjacent strings to concatenate string literals.", + "fixStatus": "hasFix" }, { "name": "prefer_asserts_in_initializer_lists", - "description": "Prefer putting asserts in initializer lists." + "description": "Prefer putting asserts in initializer lists.", + "fixStatus": "needsFix" }, { "name": "prefer_asserts_with_message", - "description": "Prefer asserts with message." + "description": "Prefer asserts with message.", + "fixStatus": "noFix" }, { "name": "prefer_bool_in_asserts", - "description": "Prefer using a boolean as the assert condition." + "description": "Prefer using a boolean as the assert condition.", + "fixStatus": "noFix" }, { "name": "prefer_collection_literals", - "description": "Use collection literals when possible." + "description": "Use collection literals when possible.", + "fixStatus": "hasFix" }, { "name": "prefer_conditional_assignment", - "description": "Prefer using `??=` over testing for null." + "description": "Prefer using `??=` over testing for null.", + "fixStatus": "hasFix" }, { "name": "prefer_const_constructors", - "description": "Prefer const with constant constructors." + "description": "Prefer const with constant constructors.", + "fixStatus": "hasFix" }, { "name": "prefer_const_constructors_in_immutables", - "description": "Prefer declaring const constructors on `@immutable` classes." + "description": "Prefer declaring const constructors on `@immutable` classes.", + "fixStatus": "hasFix" }, { "name": "prefer_const_declarations", - "description": "Prefer const over final for declarations." + "description": "Prefer const over final for declarations.", + "fixStatus": "hasFix" }, { "name": "prefer_const_literals_to_create_immutables", - "description": "Prefer const literals as parameters of constructors on @immutable classes." + "description": "Prefer const literals as parameters of constructors on @immutable classes.", + "fixStatus": "hasFix" }, { "name": "prefer_constructors_over_static_methods", - "description": "Prefer defining constructors instead of static methods to create instances." + "description": "Prefer defining constructors instead of static methods to create instances.", + "fixStatus": "needsFix" }, { "name": "prefer_contains", - "description": "Use contains for `List` and `String` instances." + "description": "Use contains for `List` and `String` instances.", + "fixStatus": "hasFix" }, { "name": "prefer_double_quotes", - "description": "Prefer double quotes where they won't require escape sequences." + "description": "Prefer double quotes where they won't require escape sequences.", + "fixStatus": "hasFix" }, { "name": "prefer_equal_for_default_values", - "description": "Use `=` to separate a named parameter from its default value." + "description": "Use `=` to separate a named parameter from its default value.", + "fixStatus": "noFix" }, { "name": "prefer_expression_function_bodies", - "description": "Use => for short members whose body is a single return statement." + "description": "Use => for short members whose body is a single return statement.", + "fixStatus": "hasFix" }, { "name": "prefer_final_fields", - "description": "Private field could be final." + "description": "Private field could be final.", + "fixStatus": "hasFix" }, { "name": "prefer_final_in_for_each", - "description": "Prefer final in for-each loop variable if reference is not reassigned." + "description": "Prefer final in for-each loop variable if reference is not reassigned.", + "fixStatus": "hasFix" }, { "name": "prefer_final_locals", - "description": "Prefer final for variable declarations if they are not reassigned." + "description": "Prefer final for variable declarations if they are not reassigned.", + "fixStatus": "hasFix" }, { "name": "prefer_final_parameters", - "description": "Prefer final for parameter declarations if they are not reassigned." + "description": "Prefer final for parameter declarations if they are not reassigned.", + "fixStatus": "hasFix" }, { "name": "prefer_for_elements_to_map_fromIterable", - "description": "Prefer 'for' elements when building maps from iterables." + "description": "Prefer 'for' elements when building maps from iterables.", + "fixStatus": "hasFix" }, { "name": "prefer_foreach", - "description": "Use `forEach` to only apply a function to all the elements." + "description": "Use `forEach` to only apply a function to all the elements.", + "fixStatus": "needsFix" }, { "name": "prefer_function_declarations_over_variables", - "description": "Use a function declaration to bind a function to a name." + "description": "Use a function declaration to bind a function to a name.", + "fixStatus": "hasFix" }, { "name": "prefer_generic_function_type_aliases", - "description": "Prefer generic function type aliases." + "description": "Prefer generic function type aliases.", + "fixStatus": "hasFix" }, { "name": "prefer_if_elements_to_conditional_expressions", - "description": "Prefer if elements to conditional expressions where possible." + "description": "Prefer if elements to conditional expressions where possible.", + "fixStatus": "hasFix" }, { "name": "prefer_if_null_operators", - "description": "Prefer using if null operators." + "description": "Prefer using if null operators.", + "fixStatus": "hasFix" }, { "name": "prefer_initializing_formals", - "description": "Use initializing formals when possible." + "description": "Use initializing formals when possible.", + "fixStatus": "hasFix" }, { "name": "prefer_inlined_adds", - "description": "Inline list item declarations where possible." + "description": "Inline list item declarations where possible.", + "fixStatus": "hasFix" }, { "name": "prefer_int_literals", - "description": "Prefer int literals over double literals." + "description": "Prefer int literals over double literals.", + "fixStatus": "hasFix" }, { "name": "prefer_interpolation_to_compose_strings", - "description": "Use interpolation to compose strings and values." + "description": "Use interpolation to compose strings and values.", + "fixStatus": "hasFix" }, { "name": "prefer_is_empty", - "description": "Use `isEmpty` for Iterables and Maps." + "description": "Use `isEmpty` for Iterables and Maps.", + "fixStatus": "hasFix" }, { "name": "prefer_is_not_empty", - "description": "Use `isNotEmpty` for Iterables and Maps." + "description": "Use `isNotEmpty` for Iterables and Maps.", + "fixStatus": "hasFix" }, { "name": "prefer_is_not_operator", - "description": "Prefer is! operator." + "description": "Prefer is! operator.", + "fixStatus": "hasFix" }, { "name": "prefer_iterable_whereType", - "description": "Prefer to use whereType on iterable." + "description": "Prefer to use whereType on iterable.", + "fixStatus": "hasFix" }, { "name": "prefer_mixin", - "description": "Prefer using mixins." + "description": "Prefer using mixins.", + "fixStatus": "needsFix" }, { "name": "prefer_null_aware_method_calls", - "description": "Prefer null aware method calls." + "description": "Prefer null aware method calls.", + "fixStatus": "needsFix" }, { "name": "prefer_null_aware_operators", - "description": "Prefer using null aware operators." + "description": "Prefer using null aware operators.", + "fixStatus": "hasFix" }, { "name": "prefer_single_quotes", - "description": "Only use double quotes for strings containing single quotes." + "description": "Only use double quotes for strings containing single quotes.", + "fixStatus": "hasFix" }, { "name": "prefer_spread_collections", - "description": "Use spread collections when possible." + "description": "Use spread collections when possible.", + "fixStatus": "hasFix" }, { "name": "prefer_typing_uninitialized_variables", - "description": "Prefer typing uninitialized variables and fields." + "description": "Prefer typing uninitialized variables and fields.", + "fixStatus": "hasFix" }, { "name": "provide_deprecation_message", - "description": "Provide a deprecation message, via @Deprecated(\"message\")." + "description": "Provide a deprecation message, via @Deprecated(\"message\").", + "fixStatus": "noFix" }, { "name": "public_member_api_docs", - "description": "Document all public members." + "description": "Document all public members.", + "fixStatus": "noFix" }, { "name": "recursive_getters", - "description": "Property getter recursively returns itself." + "description": "Property getter recursively returns itself.", + "fixStatus": "noFix" }, { "name": "require_trailing_commas", - "description": "Use trailing commas for all function calls and declarations." + "description": "Use trailing commas for all function calls and declarations.", + "fixStatus": "hasFix" }, { "name": "sized_box_for_whitespace", - "description": "SizedBox for whitespace." + "description": "SizedBox for whitespace.", + "fixStatus": "hasFix" }, { "name": "sized_box_shrink_expand", - "description": "Use SizedBox shrink and expand named constructors." + "description": "Use SizedBox shrink and expand named constructors.", + "fixStatus": "needsFix" }, { "name": "slash_for_doc_comments", - "description": "Prefer using /// for doc comments." + "description": "Prefer using /// for doc comments.", + "fixStatus": "hasFix" }, { "name": "sort_child_properties_last", - "description": "Sort child properties last in widget instance creations." + "description": "Sort child properties last in widget instance creations.", + "fixStatus": "hasFix" }, { "name": "sort_constructors_first", - "description": "Sort constructor declarations before other members." + "description": "Sort constructor declarations before other members.", + "fixStatus": "hasFix" }, { "name": "sort_unnamed_constructors_first", - "description": "Sort unnamed constructor declarations first." + "description": "Sort unnamed constructor declarations first.", + "fixStatus": "hasFix" }, { "name": "super_goes_last", - "description": "Place the `super` call last in a constructor initialization list." + "description": "Place the `super` call last in a constructor initialization list.", + "fixStatus": "noFix" }, { "name": "tighten_type_of_initializing_formals", - "description": "Tighten type of initializing formal." + "description": "Tighten type of initializing formal.", + "fixStatus": "needsFix" }, { "name": "type_annotate_public_apis", - "description": "Type annotate public APIs." + "description": "Type annotate public APIs.", + "fixStatus": "hasFix" }, { "name": "type_init_formals", - "description": "Don't type annotate initializing formals." + "description": "Don't type annotate initializing formals.", + "fixStatus": "hasFix" }, { "name": "type_literal_in_constant_pattern", - "description": "Don't use constant patterns with type literals." + "description": "Don't use constant patterns with type literals.", + "fixStatus": "hasFix" }, { "name": "unawaited_futures", - "description": "`Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `dart:async`." + "description": "`Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `dart:async`.", + "fixStatus": "hasFix" }, { "name": "unnecessary_await_in_return", - "description": "Unnecessary await keyword in return." + "description": "Unnecessary await keyword in return.", + "fixStatus": "needsFix" }, { "name": "unnecessary_brace_in_string_interps", - "description": "Avoid using braces in interpolation when not needed." + "description": "Avoid using braces in interpolation when not needed.", + "fixStatus": "hasFix" }, { "name": "unnecessary_breaks", - "description": "Don't use explicit `break`s when a break is implied." + "description": "Don't use explicit `break`s when a break is implied.", + "fixStatus": "hasFix" }, { "name": "unnecessary_const", - "description": "Avoid const keyword." + "description": "Avoid const keyword.", + "fixStatus": "hasFix" }, { "name": "unnecessary_constructor_name", - "description": "Unnecessary `.new` constructor name." + "description": "Unnecessary `.new` constructor name.", + "fixStatus": "hasFix" }, { "name": "unnecessary_final", - "description": "Don't use `final` for local variables." + "description": "Don't use `final` for local variables.", + "fixStatus": "hasFix" }, { "name": "unnecessary_getters_setters", - "description": "Avoid wrapping fields in getters and setters just to be \"safe\"." + "description": "Avoid wrapping fields in getters and setters just to be \"safe\".", + "fixStatus": "hasFix" }, { "name": "unnecessary_lambdas", - "description": "Don't create a lambda when a tear-off will do." + "description": "Don't create a lambda when a tear-off will do.", + "fixStatus": "hasFix" }, { "name": "unnecessary_late", - "description": "Don't specify the `late` modifier when it is not needed." + "description": "Don't specify the `late` modifier when it is not needed.", + "fixStatus": "hasFix" }, { "name": "unnecessary_library_directive", - "description": "Avoid library directives unless they have documentation comments or annotations." + "description": "Avoid library directives unless they have documentation comments or annotations.", + "fixStatus": "hasFix" }, { "name": "unnecessary_new", - "description": "Unnecessary new keyword." + "description": "Unnecessary new keyword.", + "fixStatus": "hasFix" }, { "name": "unnecessary_null_aware_assignments", - "description": "Avoid null in null-aware assignment." + "description": "Avoid null in null-aware assignment.", + "fixStatus": "hasFix" }, { "name": "unnecessary_null_aware_operator_on_extension_on_nullable", - "description": "Unnecessary null aware operator on extension on a nullable type." + "description": "Unnecessary null aware operator on extension on a nullable type.", + "fixStatus": "needsFix" }, { "name": "unnecessary_null_checks", - "description": "Unnecessary null checks." + "description": "Unnecessary null checks.", + "fixStatus": "hasFix" }, { "name": "unnecessary_null_in_if_null_operators", - "description": "Avoid using `null` in `if null` operators." + "description": "Avoid using `null` in `if null` operators.", + "fixStatus": "hasFix" }, { "name": "unnecessary_nullable_for_final_variable_declarations", - "description": "Use a non-nullable type for a final variable initialized with a non-nullable value." + "description": "Use a non-nullable type for a final variable initialized with a non-nullable value.", + "fixStatus": "hasFix" }, { "name": "unnecessary_overrides", - "description": "Don't override a method to do a super method invocation with the same parameters." + "description": "Don't override a method to do a super method invocation with the same parameters.", + "fixStatus": "hasFix" }, { "name": "unnecessary_parenthesis", - "description": "Unnecessary parentheses can be removed." + "description": "Unnecessary parentheses can be removed.", + "fixStatus": "hasFix" }, { "name": "unnecessary_raw_strings", - "description": "Unnecessary raw string." + "description": "Unnecessary raw string.", + "fixStatus": "hasFix" }, { "name": "unnecessary_string_escapes", - "description": "Remove unnecessary backslashes in strings." + "description": "Remove unnecessary backslashes in strings.", + "fixStatus": "hasFix" }, { "name": "unnecessary_string_interpolations", - "description": "Unnecessary string interpolation." + "description": "Unnecessary string interpolation.", + "fixStatus": "hasFix" }, { "name": "unnecessary_this", - "description": "Don't access members with `this` unless avoiding shadowing." + "description": "Don't access members with `this` unless avoiding shadowing.", + "fixStatus": "hasFix" }, { "name": "unnecessary_to_list_in_spreads", - "description": "Unnecessary toList() in spreads." + "description": "Unnecessary toList() in spreads.", + "fixStatus": "hasFix" }, { "name": "unreachable_from_main", - "description": "Unreachable top-level members in executable libraries." + "description": "Unreachable top-level members in executable libraries.", + "fixStatus": "noFix" }, { "name": "use_colored_box", - "description": "Use `ColoredBox`." + "description": "Use `ColoredBox`.", + "fixStatus": "needsFix" }, { "name": "use_decorated_box", - "description": "Use `DecoratedBox`." + "description": "Use `DecoratedBox`.", + "fixStatus": "hasFix" }, { "name": "use_enums", - "description": "Use enums rather than classes that behave like enums." + "description": "Use enums rather than classes that behave like enums.", + "fixStatus": "hasFix" }, { "name": "use_full_hex_values_for_flutter_colors", - "description": "Prefer an 8-digit hexadecimal integer(0xFFFFFFFF) to instantiate Color." + "description": "Prefer an 8-digit hexadecimal integer(0xFFFFFFFF) to instantiate Color.", + "fixStatus": "hasFix" }, { "name": "use_function_type_syntax_for_parameters", - "description": "Use generic function type syntax for parameters." + "description": "Use generic function type syntax for parameters.", + "fixStatus": "hasFix" }, { "name": "use_if_null_to_convert_nulls_to_bools", - "description": "Use if-null operators to convert nulls to bools." + "description": "Use if-null operators to convert nulls to bools.", + "fixStatus": "needsFix" }, { "name": "use_is_even_rather_than_modulo", - "description": "Prefer intValue.isOdd/isEven instead of checking the result of % 2." + "description": "Prefer intValue.isOdd/isEven instead of checking the result of % 2.", + "fixStatus": "needsFix" }, { "name": "use_late_for_private_fields_and_variables", - "description": "Use late for private members with a non-nullable type." + "description": "Use late for private members with a non-nullable type.", + "fixStatus": "needsFix" }, { "name": "use_named_constants", - "description": "Use predefined named constants." + "description": "Use predefined named constants.", + "fixStatus": "needsFix" }, { "name": "use_raw_strings", - "description": "Use raw string to avoid escapes." + "description": "Use raw string to avoid escapes.", + "fixStatus": "hasFix" }, { "name": "use_rethrow_when_possible", - "description": "Use rethrow to rethrow a caught exception." + "description": "Use rethrow to rethrow a caught exception.", + "fixStatus": "hasFix" }, { "name": "use_setters_to_change_properties", - "description": "Use a setter for operations that conceptually change a property." + "description": "Use a setter for operations that conceptually change a property.", + "fixStatus": "noFix" }, { "name": "use_string_buffers", - "description": "Use string buffers to compose strings." + "description": "Use string buffers to compose strings.", + "fixStatus": "needsFix" }, { "name": "use_string_in_part_of_directives", - "description": "Use string in part of directives." + "description": "Use string in part of directives.", + "fixStatus": "hasFix" }, { "name": "use_super_parameters", - "description": "Use super-initializer parameters where possible." + "description": "Use super-initializer parameters where possible.", + "fixStatus": "hasFix" }, { "name": "use_test_throws_matchers", - "description": "Use throwsA matcher instead of fail()." + "description": "Use throwsA matcher instead of fail().", + "fixStatus": "needsFix" }, { "name": "use_to_and_as_if_applicable", - "description": "Start the name of the method with to/_to or as/_as if applicable." + "description": "Start the name of the method with to/_to or as/_as if applicable.", + "fixStatus": "noFix" }, { "name": "void_checks", - "description": "Don't assign to void." + "description": "Don't assign to void.", + "fixStatus": "noFix" } ] \ No newline at end of file From 1a05d9ec0d6cfe733df7c8779ad4e5411f203625 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 6 Jun 2023 15:15:22 -0500 Subject: [PATCH 45/90] Link to 'dart fix' docs in table header (dart-lang/lints#132) * Link to 'dart fix' docs in table header * Update doc generation script --- pkgs/lints/README.md | 9 +++++---- pkgs/lints/tool/README.md | 16 ++++++++-------- pkgs/lints/tool/gen_docs.dart | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 0edf5cd4..2dfe1be5 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -100,8 +100,8 @@ To use these lints create an `analysis_options.yaml` file with: `include: package:lints/core.yaml`. -| Lint Rules | Description | Fix | -| :--------- | :---------- | --- | +| Lint Rules | Description | [Fix][] | +| :--------- | :---------- | ------- | | [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | ✅ | | [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | ✅ | | [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | | @@ -138,8 +138,8 @@ To use these lints create an `analysis_options.yaml` file with: `include: package:lints/recommended.yaml`. -| Lint Rules | Description | Fix | -| :--------- | :---------- | --- | +| Lint Rules | Description | [Fix][] | +| :--------- | :---------- | ------- | | [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | | [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | | [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | ✅ | @@ -206,3 +206,4 @@ To use these lints create an `analysis_options.yaml` file with: [linter repo]: https://github.com/dart-lang/linter [`package:pedantic`]: https://pub.dev/packages/pedantic [`package:flutter_lints`]: https://pub.dev/packages/flutter_lints +[Fix]: https://dart.dev/tools/dart-fix diff --git a/pkgs/lints/tool/README.md b/pkgs/lints/tool/README.md index 2a95cc7a..e1f4a99c 100644 --- a/pkgs/lints/tool/README.md +++ b/pkgs/lints/tool/README.md @@ -1,25 +1,25 @@ ## `tool/validate_lib.dart` -This tool ensures that we don't commit `.dart` source files into the lib/ +This tool ensures that we don't commit `.dart` source files into the `lib/` directory; it's automatically run by the CI. To run manually: -``` -dart tool/validate_lib.dart +```shell +dart run tool/validate_lib.dart ``` ## `tool/gen_docs.dart` This tool regenerates the lists of core and recommended lints into the package's -README.md file. To use it, run: +`README.md` file. To use it, run: -``` -dart tool/gen_docs.dart +```shell +dart run tool/gen_docs.dart ``` It can also validate that the readme file is up-to-date. It's automatically run by the CI; to run it manually: -``` -dart tool/gen_docs.dart --verify +```shell +dart run tool/gen_docs.dart --verify ``` diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index 5d25efc7..43f494ff 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -84,8 +84,8 @@ String _createRuleTable( rules.sort(); final lines = [ - '| Lint Rules | Description | Fix |', - '| :--------- | :---------- | --- |', + '| Lint Rules | Description | [Fix][] |', + '| :--------- | :---------- | ------- |', ...rules.map((rule) { final ruleMeta = lintMeta.firstWhereOrNull((meta) => meta['name'] == rule); From 48b5006b9450dd0414cef14823ad7e4b17a0e7c6 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 20 Jun 2023 12:09:12 -0700 Subject: [PATCH 46/90] update core and recommended from the recent review (dart-lang/lints#136) * update core ad recommended from the recent review * unnecessary_constructor_name was already in the set --- pkgs/lints/CHANGELOG.md | 13 ++++++++++--- pkgs/lints/README.md | 5 +++-- pkgs/lints/lib/core.yaml | 5 +++-- pkgs/lints/pubspec.yaml | 2 +- pkgs/lints/tool/rules.json | 4 ++-- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 9d8d3eef..54f7038f 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,6 +1,13 @@ -## 2.1.2-wip - -- Add 'has quick-fix' checkboxes to the package's readme. +## 3.0.0-wip + +- Added to core.yaml: + - `collection_methods_unrelated_type` + - `implicit_call_tearoffs` + - `use_string_in_part_of_directives` +- Removed from core.yaml: + - `iterable_contains_unrelated_type` + - `list_remove_unrelated_type` +- Add info about which lints have quick fixs to the package's readme. ## 2.1.1 diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 2dfe1be5..f917ba58 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -109,13 +109,13 @@ To use these lints create an `analysis_options.yaml` file with: | [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | ✅ | | [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | | | [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | | +| [`collection_methods_unrelated_type`](https://dart.dev/lints/collection_methods_unrelated_type) | Invocation of various collection methods with arguments of unrelated types. | | | [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | ✅ | | [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | | | [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | ✅ | | [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | | [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | -| [`iterable_contains_unrelated_type`](https://dart.dev/lints/iterable_contains_unrelated_type) | Invocation of Iterable.contains with references of unrelated types. | | -| [`list_remove_unrelated_type`](https://dart.dev/lints/list_remove_unrelated_type) | Invocation of `remove` with references of unrelated types. | | +| [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | | [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | @@ -128,6 +128,7 @@ To use these lints create an `analysis_options.yaml` file with: | [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | | [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | | [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | +| [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | | [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | | | [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | | diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index ec6fff7c..a04ccf47 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -13,13 +13,13 @@ linter: - await_only_futures - camel_case_extensions - camel_case_types + - collection_methods_unrelated_type - curly_braces_in_flow_control_structures - depend_on_referenced_packages - empty_catches - file_names - hash_and_equals - - iterable_contains_unrelated_type - - list_remove_unrelated_type + - implicit_call_tearoffs - no_duplicate_case_values - non_constant_identifier_names - null_check_on_nullable_type_parameter @@ -32,5 +32,6 @@ linter: - provide_deprecation_message - unnecessary_overrides - unrelated_type_equality_checks + - use_string_in_part_of_directives - valid_regexps - void_checks diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 121dbd67..476869a7 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 2.1.2-wip +version: 3.0.0-wip description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index c96bd46d..5cfc4c37 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -152,7 +152,7 @@ { "name": "no_wildcard_variable_uses", "description": "Don't use wildcard parameters or variables.", - "fixStatus": "unregistered" + "fixStatus": "needsEvaluation" }, { "name": "prefer_relative_imports", @@ -182,7 +182,7 @@ { "name": "unrelated_type_equality_checks", "description": "Equality operator `==` invocation with references of unrelated types.", - "fixStatus": "noFix" + "fixStatus": "unregistered" }, { "name": "unsafe_html", From 87c35959f87a5071ef8f571c200c7ca1e2b93df6 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Wed, 28 Jun 2023 13:28:50 -0500 Subject: [PATCH 47/90] Fix typo in 3.0.0-wip changelog entry (dart-lang/lints#137) --- pkgs/lints/CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 54f7038f..7ecf2794 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,13 +1,13 @@ ## 3.0.0-wip -- Added to core.yaml: +- Added to `core.yaml`: - `collection_methods_unrelated_type` - `implicit_call_tearoffs` - `use_string_in_part_of_directives` -- Removed from core.yaml: +- Removed from `core.yaml`: - `iterable_contains_unrelated_type` - `list_remove_unrelated_type` -- Add info about which lints have quick fixs to the package's readme. +- Add info about which lints have quick fixes to the package's readme. ## 2.1.1 From b23d145eceee0bbf9a8111ae23a90b212dc66b4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:05:23 +0000 Subject: [PATCH 48/90] Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/lints#138) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
Release notes

Sourced from actions/checkout's releases.

v3.5.3

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3...v3.5.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

v2.3.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.2&new-version=3.5.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index f328fcb6..65fc6a33 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f - run: dart pub get From f7c120f800a87a1959fca5c8ec7f0d3e50763581 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Fri, 21 Jul 2023 15:56:40 -0500 Subject: [PATCH 49/90] Update tooling to use new `rules.json` location (dart-lang/lints#140) * Update tooling to use new 'rules.json' location * Use dart.dev version of generated file --- pkgs/lints/tool/gen_docs.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index 43f494ff..3a5caca4 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -16,7 +16,7 @@ void main(List args) async { final rulesJsonFile = File('tool/rules.json'); final rulesUrl = - 'https://dart-lang.github.io/linter/lints/machine/rules.json'; + 'https://raw.githubusercontent.com/dart-lang/site-www/main/src/_data/linter_rules.json'; if (!justVerify) { rulesJsonFile.writeAsStringSync((await http.get(Uri.parse(rulesUrl))).body); } @@ -54,7 +54,7 @@ void main(List args) async { print('${readmeFile.path} is not up-to-date (lint tables need to be ' 'regenerated).'); print(''); - print("Run 'dart tools/gen_docs.dart' to re-generate."); + print("Run 'dart tool/gen_docs.dart' to re-generate."); exit(1); } else { print('${readmeFile.path} is up-to-date.'); @@ -93,7 +93,7 @@ String _createRuleTable( if (ruleMeta == null) { print('rules.json data for rule \'$rule\' not found.'); print('Update lib/rules.json from ' - 'https://dart-lang.github.io/linter/lints/machine/rules.json.'); + 'https://raw.githubusercontent.com/dart-lang/site-www/main/src/_data/linter_rules.json.'); exit(1); } final description = ruleMeta['description'] as String?; From 7efe3ac484cf39fe99ef78c9de3bf6bd60c4466d Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Fri, 11 Aug 2023 13:21:59 -0500 Subject: [PATCH 50/90] Cleanup docs and links (dart-lang/lints#142) --- pkgs/lints/README.md | 15 +++++++-------- pkgs/lints/lib/core.yaml | 8 ++++---- pkgs/lints/lib/recommended.yaml | 14 +++++++------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index f917ba58..2026a12f 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -34,21 +34,21 @@ sets in the ecosystem (available at [pub.dev](https://pub.dev/)). Rule set authors: consider adding the `lints` topic to your pubspec to allow easier discovery (e.g., [pub.dev/packages?q=topic:lints](https://pub.dev/packages?q=topic%3Alints)). -For more information about topics, see +For more information about topics, visit [dart.dev/tools/pub/pubspec#topics](https://dart.dev/tools/pub/pubspec#topics). ## Where these lints are used When creating new Dart project using the [`dart create`][dart create] command, -the lints from `package:lints` are enabled by default. +the `recommended` set of lints from `package:lints` is enabled by default. When uploading a package to the [pub.dev] package repository, packages are [awarded pub points][scoring] based on how many of the 'core' lints pass. ## Enabling the lints -For new apps created with `dart create` the `recommended` set of lints are enabled -by default. +For new apps created with `dart create` the `recommended` set of lints are +enabled by default. For existing apps or packages, you can enable these lints via: @@ -74,7 +74,7 @@ For existing apps or packages, you can enable these lints via: ## Customizing the predefined lint sets For details on customizing static analysis above and beyond the predefined -lint sets, see [customizing static analysis]. +lint sets, check out [Customizing static analysis]. ## Evolving the lint sets @@ -198,13 +198,12 @@ To use these lints create an `analysis_options.yaml` file with: | [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | -[dart create]: https://dart.dev/tools/dart-tool +[dart create]: https://dart.dev/tools/dart-create [scoring]: https://pub.dev/help/scoring -[customizing static analysis]: https://dart.dev/guides/language/analysis-options +[customizing static analysis]: https://dart.dev/tools/analysis [rules]: https://dart.dev/tools/linter-rules [pub.dev]: https://pub.dev [issue]: https://github.com/dart-lang/lints/issues [linter repo]: https://github.com/dart-lang/linter -[`package:pedantic`]: https://pub.dev/packages/pedantic [`package:flutter_lints`]: https://pub.dev/packages/flutter_lints [Fix]: https://dart.dev/tools/dart-fix diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index a04ccf47..622e45ae 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -1,8 +1,8 @@ -# This is a set of core lints used to identify critical issues. See -# https://github.com/dart-lang/lints for more information. +# This is a set of core lints used to identify critical issues. +# Check out https://github.com/dart-lang/lints for more information. # -# For documentation about customizing static analysis for your project, see -# https://dart.dev/guides/language/analysis-options. +# To learn more about customizing static analysis for your package or app, +# visit https://dart.dev/tools/analysis. linter: rules: diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 77402e56..b23dc46c 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -1,11 +1,11 @@ -# This set of lints builds on top of `package:lints/core.yaml`; it includes -# lints that help identify additional issues that may lead to problems when -# running or consuming Dart code, as well as lints that enforce writing Dart -# using a single, idiomatic style. See https://github.com/dart-lang/lints for -# more information. +# This set of lints builds on top of `package:lints/core.yaml`. +# It includes lints that help identify additional issues that might lead to +# problems when running or consuming Dart code, as well as lints +# that enforce writing Dart using a single, idiomatic style. +# Check out https://github.com/dart-lang/lints for more information. # -# For documentation about customizing static analysis for your project, see -# https://dart.dev/guides/language/analysis-options. +# To learn more about customizing static analysis for your package or app, +# visit https://dart.dev/tools/analysis. include: package:lints/core.yaml From cc48f6fe2cdd4404d26b9dbeacb4c8f96988fb56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:16:14 +0000 Subject: [PATCH 51/90] Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/lints#144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
Release notes

Sourced from actions/checkout's releases.

v3.6.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3.5.3...v3.6.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.3&new-version=3.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 65fc6a33..be846d62 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f - run: dart pub get From 4314795436fc56bd1b57745ebfd7b663595f5a27 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 6 Sep 2023 10:50:50 -0700 Subject: [PATCH 52/90] move the list of lint rules from the readme to a separate rules.md file (dart-lang/lints#145) * move the list of lint rules from the readme to a separate rules.md file * review feedback --- pkgs/lints/CHANGELOG.md | 2 + pkgs/lints/README.md | 105 +--------------------------------- pkgs/lints/rules.md | 99 ++++++++++++++++++++++++++++++++ pkgs/lints/tool/gen_docs.dart | 22 +++---- pkgs/lints/tool/rules.json | 2 +- 5 files changed, 115 insertions(+), 115 deletions(-) create mode 100644 pkgs/lints/rules.md diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 7ecf2794..dc682947 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -8,6 +8,8 @@ - `iterable_contains_unrelated_type` - `list_remove_unrelated_type` - Add info about which lints have quick fixes to the package's readme. +- Move the list of lint rules from the readme to a separate + [rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) file. ## 2.1.1 diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 2026a12f..b7b08264 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -94,109 +94,8 @@ we know to write Dart code. The process we use is: ## Lint set contents -### Core lints - -To use these lints create an `analysis_options.yaml` file with: -`include: package:lints/core.yaml`. - - -| Lint Rules | Description | [Fix][] | -| :--------- | :---------- | ------- | -| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | ✅ | -| [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | ✅ | -| [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | | -| [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | ✅ | -| [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | ✅ | -| [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | | -| [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | | -| [`collection_methods_unrelated_type`](https://dart.dev/lints/collection_methods_unrelated_type) | Invocation of various collection methods with arguments of unrelated types. | | -| [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | ✅ | -| [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | | -| [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | ✅ | -| [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | -| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | -| [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | -| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | -| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | -| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | -| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | -| [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | ✅ | -| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | ✅ | -| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | ✅ | -| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | ✅ | -| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | ✅ | -| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | -| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | -| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | -| [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | -| [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | | -| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | | - - -### Recommended lints - -To use these lints create an `analysis_options.yaml` file with: -`include: package:lints/recommended.yaml`. - - -| Lint Rules | Description | [Fix][] | -| :--------- | :---------- | ------- | -| [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | -| [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | -| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | ✅ | -| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | ✅ | -| [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | ✅ | -| [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | ✅ | -| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | ✅ | -| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | ✅ | -| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | ✅ | -| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | | -| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | ✅ | -| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | -| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | -| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | -| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | | -| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | -| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | -| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | -| [`no_leading_underscores_for_local_identifiers`](https://dart.dev/lints/no_leading_underscores_for_local_identifiers) | Avoid leading underscores for local identifiers. | ✅ | -| [`null_closures`](https://dart.dev/lints/null_closures) | Do not pass `null` as an argument where a closure is expected. | ✅ | -| [`overridden_fields`](https://dart.dev/lints/overridden_fields) | Don't override fields. | | -| [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | | -| [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | ✅ | -| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | ✅ | -| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | ✅ | -| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | ✅ | -| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | | -| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | ✅ | -| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | ✅ | -| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | ✅ | -| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | ✅ | -| [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | ✅ | -| [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | ✅ | -| [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | ✅ | -| [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | ✅ | -| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | ✅ | -| [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | ✅ | -| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | ✅ | -| [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | | -| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | ✅ | -| [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | ✅ | -| [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | ✅ | -| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | ✅ | -| [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | ✅ | -| [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | ✅ | -| [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | ✅ | -| [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | ✅ | -| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | ✅ | -| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | ✅ | -| [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | ✅ | -| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | ✅ | -| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | ✅ | -| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | ✅ | -| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | -| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | - +See [rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) for a list +of rules that make up the core and recommended rule sets. [dart create]: https://dart.dev/tools/dart-create [scoring]: https://pub.dev/help/scoring diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md new file mode 100644 index 00000000..5d69700c --- /dev/null +++ b/pkgs/lints/rules.md @@ -0,0 +1,99 @@ +## Lint set contents + +### Core lint rules + + +| Lint Rules | Description | [Fix][] | +| :--------- | :---------- | ------- | +| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | ✅ | +| [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | ✅ | +| [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | | +| [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | ✅ | +| [`await_only_futures`](https://dart.dev/lints/await_only_futures) | Await only futures. | ✅ | +| [`camel_case_extensions`](https://dart.dev/lints/camel_case_extensions) | Name extensions using UpperCamelCase. | | +| [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | | +| [`collection_methods_unrelated_type`](https://dart.dev/lints/collection_methods_unrelated_type) | Invocation of various collection methods with arguments of unrelated types. | | +| [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | ✅ | +| [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | | +| [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | ✅ | +| [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | +| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | +| [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | +| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | +| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | +| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | +| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | +| [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | ✅ | +| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | ✅ | +| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | ✅ | +| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | ✅ | +| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | ✅ | +| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | +| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | +| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | +| [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | +| [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | | +| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | | + + +### Recommended lint rules + + +| Lint Rules | Description | [Fix][] | +| :--------- | :---------- | ------- | +| [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | +| [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | +| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | ✅ | +| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | ✅ | +| [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | ✅ | +| [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | ✅ | +| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | ✅ | +| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | ✅ | +| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | ✅ | +| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | | +| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | ✅ | +| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | +| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | +| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | +| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | | +| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | +| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | +| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | +| [`no_leading_underscores_for_local_identifiers`](https://dart.dev/lints/no_leading_underscores_for_local_identifiers) | Avoid leading underscores for local identifiers. | ✅ | +| [`null_closures`](https://dart.dev/lints/null_closures) | Do not pass `null` as an argument where a closure is expected. | ✅ | +| [`overridden_fields`](https://dart.dev/lints/overridden_fields) | Don't override fields. | | +| [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | | +| [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | ✅ | +| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | ✅ | +| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | ✅ | +| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | ✅ | +| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | | +| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | ✅ | +| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | ✅ | +| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | ✅ | +| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | ✅ | +| [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | ✅ | +| [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | ✅ | +| [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | ✅ | +| [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | ✅ | +| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | ✅ | +| [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | ✅ | +| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | ✅ | +| [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | | +| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | ✅ | +| [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | ✅ | +| [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | ✅ | +| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | ✅ | +| [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | ✅ | +| [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | ✅ | +| [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | ✅ | +| [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | ✅ | +| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | ✅ | +| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | ✅ | +| [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | ✅ | +| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | ✅ | +| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | ✅ | +| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | ✅ | +| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | +| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | + diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index 3a5caca4..bbbbaef2 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -23,13 +23,13 @@ void main(List args) async { final rulesJson = (jsonDecode(rulesJsonFile.readAsStringSync()) as List) .cast>(); - final readmeFile = File('README.md'); - final readmeContent = readmeFile.readAsStringSync(); + final rulesMdFile = File('rules.md'); + final rulesMdContent = rulesMdFile.readAsStringSync(); if (justVerify) { - print('Validating that ${readmeFile.path} is up-to-date ...'); + print('Validating that ${rulesMdFile.path} is up-to-date ...'); } else { - print('Regenerating ${readmeFile.path} ...'); + print('Regenerating ${rulesMdFile.path} ...'); } for (var file in ['lib/core.yaml', 'lib/recommended.yaml']) { @@ -37,7 +37,7 @@ void main(List args) async { lintRules[name] = _parseRules(File(file)); } - var newContent = readmeContent; + var newContent = rulesMdContent; for (var ruleSetName in lintRules.keys) { final comment = '\n'; @@ -50,14 +50,14 @@ void main(List args) async { } if (justVerify) { - if (newContent != readmeContent) { - print('${readmeFile.path} is not up-to-date (lint tables need to be ' + if (newContent != rulesMdContent) { + print('${rulesMdFile.path} is not up-to-date (lint tables need to be ' 'regenerated).'); print(''); print("Run 'dart tool/gen_docs.dart' to re-generate."); exit(1); } else { - print('${readmeFile.path} is up-to-date.'); + print('${rulesMdFile.path} is up-to-date.'); } } else { // Re-save rules.json. @@ -68,9 +68,9 @@ void main(List args) async { rulesJsonFile .writeAsStringSync(JsonEncoder.withIndent(' ').convert(rulesJson)); - // Write out the readme file. - readmeFile.writeAsStringSync(newContent); - print('Wrote ${readmeFile.path}.'); + // Write out the rules md file. + rulesMdFile.writeAsStringSync(newContent); + print('Wrote ${rulesMdFile.path}.'); } } diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index 5cfc4c37..08443220 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -1042,7 +1042,7 @@ { "name": "unreachable_from_main", "description": "Unreachable top-level members in executable libraries.", - "fixStatus": "noFix" + "fixStatus": "hasFix" }, { "name": "use_colored_box", From e8ce542b64e8ca4bb27e012a549979947881b0bc Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 6 Sep 2023 10:59:27 -0700 Subject: [PATCH 53/90] fix a dangling table link (dart-lang/lints#146) --- pkgs/lints/README.md | 1 - pkgs/lints/rules.md | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index b7b08264..827228ba 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -105,4 +105,3 @@ of rules that make up the core and recommended rule sets. [issue]: https://github.com/dart-lang/lints/issues [linter repo]: https://github.com/dart-lang/linter [`package:flutter_lints`]: https://pub.dev/packages/flutter_lints -[Fix]: https://dart.dev/tools/dart-fix diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 5d69700c..87bdfa88 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -97,3 +97,5 @@ | [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | | [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | + +[Fix]: https://dart.dev/tools/dart-fix From dd94f2c123b2aa2a914296e251aea0a4a56c1cfc Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 20 Sep 2023 11:50:24 -0700 Subject: [PATCH 54/90] add several rules to core and recommended (dart-lang/lints#150) * add several rules to core and recommended * remove `deprecated_consistency` --- pkgs/lints/CHANGELOG.md | 20 +++++++++++++------- pkgs/lints/lib/core.yaml | 3 +++ pkgs/lints/lib/recommended.yaml | 3 ++- pkgs/lints/rules.md | 6 +++++- pkgs/lints/tool/rules.json | 5 +++++ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index dc682947..86383444 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,12 +1,18 @@ ## 3.0.0-wip -- Added to `core.yaml`: - - `collection_methods_unrelated_type` - - `implicit_call_tearoffs` - - `use_string_in_part_of_directives` -- Removed from `core.yaml`: - - `iterable_contains_unrelated_type` - - `list_remove_unrelated_type` +- `core`: + - added `collection_methods_unrelated_type` + - added `implicit_call_tearoffs` + - added `no_wildcard_variable_uses` + - added `secure_pubspec_urls` + - added `type_literal_in_constant_pattern` + - added `use_string_in_part_of_directives` + - removed `iterable_contains_unrelated_type` + - removed `list_remove_unrelated_type` +- `recommended`: + - added `unnecessary_to_list_in_spreads` + - added `use_super_parameters` + - removed `prefer_equal_for_default_values` - Add info about which lints have quick fixes to the package's readme. - Move the list of lint rules from the readme to a separate [rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) file. diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 622e45ae..6bedf967 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -21,6 +21,7 @@ linter: - hash_and_equals - implicit_call_tearoffs - no_duplicate_case_values + - no_wildcard_variable_uses - non_constant_identifier_names - null_check_on_nullable_type_parameter - package_prefixed_library_names @@ -30,6 +31,8 @@ linter: - prefer_iterable_whereType - prefer_typing_uninitialized_variables - provide_deprecation_message + - secure_pubspec_urls + - type_literal_in_constant_pattern - unnecessary_overrides - unrelated_type_equality_checks - use_string_in_part_of_directives diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index b23dc46c..1446fa9b 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -37,7 +37,6 @@ linter: - prefer_collection_literals - prefer_conditional_assignment - prefer_contains - - prefer_equal_for_default_values - prefer_final_fields - prefer_for_elements_to_map_fromIterable - prefer_function_declarations_over_variables @@ -64,5 +63,7 @@ linter: - unnecessary_string_escapes - unnecessary_string_interpolations - unnecessary_this + - unnecessary_to_list_in_spreads - use_function_type_syntax_for_parameters - use_rethrow_when_possible + - use_super_parameters diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 87bdfa88..06c3b3c5 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -20,6 +20,7 @@ | [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | | [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | +| [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | | [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | | [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | @@ -29,6 +30,8 @@ | [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | ✅ | | [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | ✅ | | [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | +| [`secure_pubspec_urls`](https://dart.dev/lints/secure_pubspec_urls) | Use secure urls in `pubspec.yaml`. | | +| [`type_literal_in_constant_pattern`](https://dart.dev/lints/type_literal_in_constant_pattern) | Don't use constant patterns with type literals. | ✅ | | [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | | [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | | [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | @@ -67,7 +70,6 @@ | [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | ✅ | | [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | ✅ | | [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | ✅ | -| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | | | [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | ✅ | | [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | ✅ | | [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | ✅ | @@ -94,8 +96,10 @@ | [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | ✅ | | [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | ✅ | | [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | ✅ | +| [`unnecessary_to_list_in_spreads`](https://dart.dev/lints/unnecessary_to_list_in_spreads) | Unnecessary toList() in spreads. | ✅ | | [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | | [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | +| [`use_super_parameters`](https://dart.dev/lints/use_super_parameters) | Use super-initializer parameters where possible. | ✅ | [Fix]: https://dart.dev/tools/dart-fix diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index 08443220..72f8b06b 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -254,6 +254,11 @@ "description": "Annotate overridden members.", "fixStatus": "hasFix" }, + { + "name": "annotate_redeclares", + "description": "Annotate redeclared members.", + "fixStatus": "hasFix" + }, { "name": "avoid_annotating_with_dynamic", "description": "Avoid annotating with dynamic when not required.", From a7c27283aa37be00a05a922cffe3886cb7ae98ed Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 26 Sep 2023 08:53:46 -0700 Subject: [PATCH 55/90] rev to 3.0.0-beta in preparation for publishing (dart-lang/lints#153) * support -dev pre-release versions * use a '-beta' version extension --- pkgs/lints/.github/workflows/publish.yaml | 2 +- pkgs/lints/CHANGELOG.md | 2 +- pkgs/lints/pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/.github/workflows/publish.yaml b/pkgs/lints/.github/workflows/publish.yaml index e8e5a365..f4163209 100644 --- a/pkgs/lints/.github/workflows/publish.yaml +++ b/pkgs/lints/.github/workflows/publish.yaml @@ -6,7 +6,7 @@ on: pull_request: branches: [ main ] push: - tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] + tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ] jobs: publish: diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 86383444..a10b1fd3 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,4 +1,4 @@ -## 3.0.0-wip +## 3.0.0-beta - `core`: - added `collection_methods_unrelated_type` diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 476869a7..65ad7bc2 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 3.0.0-wip +version: 3.0.0-beta description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. From f4be736292ee94081cd50b3b7396d3bbf734f221 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 28 Sep 2023 09:52:28 -0700 Subject: [PATCH 56/90] remove no_wildcard_variable_uses; improve testing (dart-lang/lints#156) * remove no_wildcard_variable_uses; improve testing * update workflow min. to 3.0 * fail-fast: false * fix workflow file --- pkgs/lints/.github/workflows/validate.yml | 6 ++++++ pkgs/lints/CHANGELOG.md | 5 ++++- pkgs/lints/lib/core.yaml | 1 - pkgs/lints/pubspec.yaml | 2 +- pkgs/lints/rules.md | 1 - 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index be846d62..7a778896 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -14,10 +14,16 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [3.0.0, stable, beta] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + with: + sdk: ${{ matrix.sdk }} - run: dart pub get - run: dart format --output=none --set-exit-if-changed . diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index a10b1fd3..f0388e48 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,9 +1,12 @@ +## 3.0.0-beta.2 + +- Remove `no_wildcard_variable_uses` from core. + ## 3.0.0-beta - `core`: - added `collection_methods_unrelated_type` - added `implicit_call_tearoffs` - - added `no_wildcard_variable_uses` - added `secure_pubspec_urls` - added `type_literal_in_constant_pattern` - added `use_string_in_part_of_directives` diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 6bedf967..9f0e6e4a 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -21,7 +21,6 @@ linter: - hash_and_equals - implicit_call_tearoffs - no_duplicate_case_values - - no_wildcard_variable_uses - non_constant_identifier_names - null_check_on_nullable_type_parameter - package_prefixed_library_names diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 65ad7bc2..b8df5e69 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 3.0.0-beta +version: 3.0.0-beta.2 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 06c3b3c5..44a384fb 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -20,7 +20,6 @@ | [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | | [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | -| [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | | [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | | [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | From f2ff9d4d387a7920543f903360352c2fac6e7084 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 28 Sep 2023 10:01:00 -0700 Subject: [PATCH 57/90] add dangling_library_doc_comments, remove prefer_void_to_null (dart-lang/lints#157) --- pkgs/lints/CHANGELOG.md | 2 ++ pkgs/lints/lib/core.yaml | 1 + pkgs/lints/lib/recommended.yaml | 1 - pkgs/lints/rules.md | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index f0388e48..254e221f 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,6 +1,8 @@ ## 3.0.0-beta.2 +- Add `dangling_library_doc_comments` to core. - Remove `no_wildcard_variable_uses` from core. +- Remove `prefer_void_to_null` from recommended. ## 3.0.0-beta diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 9f0e6e4a..e986edc9 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -15,6 +15,7 @@ linter: - camel_case_types - collection_methods_unrelated_type - curly_braces_in_flow_control_structures + - dangling_library_doc_comments - depend_on_referenced_packages - empty_catches - file_names diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 1446fa9b..d9cd9166 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -47,7 +47,6 @@ linter: - prefer_is_not_operator - prefer_null_aware_operators - prefer_spread_collections - - prefer_void_to_null - recursive_getters - slash_for_doc_comments - type_init_formals diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 44a384fb..70dee71b 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -14,6 +14,7 @@ | [`camel_case_types`](https://dart.dev/lints/camel_case_types) | Name types using UpperCamelCase. | | | [`collection_methods_unrelated_type`](https://dart.dev/lints/collection_methods_unrelated_type) | Invocation of various collection methods with arguments of unrelated types. | | | [`curly_braces_in_flow_control_structures`](https://dart.dev/lints/curly_braces_in_flow_control_structures) | DO use curly braces for all flow control structures. | ✅ | +| [`dangling_library_doc_comments`](https://dart.dev/lints/dangling_library_doc_comments) | Attach library doc comments to library directives. | ✅ | | [`depend_on_referenced_packages`](https://dart.dev/lints/depend_on_referenced_packages) | Depend on referenced packages. | | | [`empty_catches`](https://dart.dev/lints/empty_catches) | Avoid empty catch blocks. | ✅ | | [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | @@ -79,7 +80,6 @@ | [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | ✅ | | [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | ✅ | | [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | ✅ | -| [`prefer_void_to_null`](https://dart.dev/lints/prefer_void_to_null) | Don't use the Null type, unless you are positive that you don't want void. | ✅ | | [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | | | [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | ✅ | | [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | ✅ | From 8cec1cd7bbbfa713b111422b72b8411a5caa782c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 10:27:15 +0000 Subject: [PATCH 58/90] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/lints#158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.5.0 to 1.5.1.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available in an environment variable, DART_HOME (dart-lang/lints#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/lints#35).

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

  • Added a flavor option setup.sh to allow downloading unpublished builds.

v1.0.0

  • Promoted to 1.0 stable.

v0.5

  • Fixed a Windows pub global activate path issue.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.5.0&new-version=1.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 7a778896..4be9e2d9 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From d4ea622af420f0344a502b3bb934993bed304956 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:12:15 -0700 Subject: [PATCH 59/90] Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/lints#159) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/f43a0e5ff2bd294095638e18286ca9a3d1956744...8ade135a41bc03ea155e62e844d188df1ea18608) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 4be9e2d9..cd5f03cc 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.0.0, stable, beta] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From 4b1926034e7f17249999c596f949fb87b2f66d5c Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 17 Oct 2023 16:42:13 -0700 Subject: [PATCH 60/90] rev to 3.0.0; prep to publish (dart-lang/lints#160) --- pkgs/lints/CHANGELOG.md | 11 ++++------- pkgs/lints/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 254e221f..4b1032d5 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,23 +1,20 @@ -## 3.0.0-beta.2 - -- Add `dangling_library_doc_comments` to core. -- Remove `no_wildcard_variable_uses` from core. -- Remove `prefer_void_to_null` from recommended. - -## 3.0.0-beta +## 3.0.0 - `core`: - added `collection_methods_unrelated_type` + - added `dangling_library_doc_comments` - added `implicit_call_tearoffs` - added `secure_pubspec_urls` - added `type_literal_in_constant_pattern` - added `use_string_in_part_of_directives` - removed `iterable_contains_unrelated_type` - removed `list_remove_unrelated_type` + - removed `no_wildcard_variable_uses` - `recommended`: - added `unnecessary_to_list_in_spreads` - added `use_super_parameters` - removed `prefer_equal_for_default_values` + - removed `prefer_void_to_null` - Add info about which lints have quick fixes to the package's readme. - Move the list of lint rules from the readme to a separate [rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) file. diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index b8df5e69..647ffa7e 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 3.0.0-beta.2 +version: 3.0.0 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. From 3b84d310948655fdd46eafe1c90cd542f8872c5b Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Mon, 23 Oct 2023 11:28:25 -0500 Subject: [PATCH 61/90] Remove mention of no_wildcard_variable_uses from changelog (dart-lang/lints#164) --- pkgs/lints/CHANGELOG.md | 1 - pkgs/lints/tool/rules.json | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 4b1032d5..4924517d 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -9,7 +9,6 @@ - added `use_string_in_part_of_directives` - removed `iterable_contains_unrelated_type` - removed `list_remove_unrelated_type` - - removed `no_wildcard_variable_uses` - `recommended`: - added `unnecessary_to_list_in_spreads` - added `use_super_parameters` diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index 72f8b06b..fc501a2b 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -44,6 +44,11 @@ "description": "Avoid types as parameter names.", "fixStatus": "hasFix" }, + { + "name": "avoid_unstable_final_fields", + "description": "Avoid overriding a final field to return different values if called multiple times.", + "fixStatus": "noFix" + }, { "name": "avoid_web_libraries_in_flutter", "description": "Avoid using web-only libraries outside Flutter web plugin packages.", From 4ae44a7a6cba3e59b10afcb9edc847f1ae4aadb7 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 23 Oct 2023 11:05:53 -0700 Subject: [PATCH 62/90] add no_wildcard_variable_uses; rev to a new major version (dart-lang/lints#165) * add no_wildcard_variable_uses; rev to a new major version * regen docs * test against sdk 3.1 --- pkgs/lints/.github/workflows/validate.yml | 4 ++-- pkgs/lints/CHANGELOG.md | 6 ++++++ pkgs/lints/lib/core.yaml | 1 + pkgs/lints/pubspec.yaml | 4 ++-- pkgs/lints/rules.md | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index cd5f03cc..f85a7955 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -17,11 +17,11 @@ jobs: strategy: fail-fast: false matrix: - sdk: [3.0.0, stable, beta] + sdk: [3.1, stable, beta] steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 4924517d..11978f7f 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,9 @@ +## 4.0.0-wip + +- `core`: + - added `no_wildcard_variable_uses` +- Updated the SDK lower-bound to 3.1. + ## 3.0.0 - `core`: diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index e986edc9..990d7530 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -22,6 +22,7 @@ linter: - hash_and_equals - implicit_call_tearoffs - no_duplicate_case_values + - no_wildcard_variable_uses - non_constant_identifier_names - null_check_on_nullable_type_parameter - package_prefixed_library_names diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 647ffa7e..6c02d5b1 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 3.0.0 +version: 4.0.0-wip description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. @@ -10,7 +10,7 @@ topics: - lints environment: - sdk: ^3.0.0 + sdk: ^3.1.0 # NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 70dee71b..04e39213 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -21,6 +21,7 @@ | [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | | [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | +| [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | | [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | | [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | From ea7eaf5b440eac739442427d6e48a4cc804ef5b9 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 30 Oct 2023 11:24:23 -0700 Subject: [PATCH 63/90] Update README.md to use new syntax for adding dev dependencies (dart-lang/lints#167) As documented here: https://dart.dev/tools/pub/cmd/pub-add#dev-dependency --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 827228ba..7349a5dc 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -55,7 +55,7 @@ For existing apps or packages, you can enable these lints via: 1. In a terminal, located at the root of your package, run this command: ```terminal - dart pub add --dev lints + dart pub add dev:lints ``` 2. Create a new `analysis_options.yaml` file, next to the pubspec, that From 68d0df8bd40034c5fa5e1382800b8b4c884da1c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:23:19 +0000 Subject: [PATCH 64/90] Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/lints#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
Release notes

Sourced from actions/checkout's releases.

v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.0...v4.1.1

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.0&new-version=4.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index f85a7955..3d224446 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.1, stable, beta] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} From 3727b78e2f31e6c92292f1c97610b9a7ebe7206a Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 14 Nov 2023 10:14:35 -0800 Subject: [PATCH 65/90] add a section on upgrading to the latest lint set to the readme (dart-lang/lints#171) --- pkgs/lints/CHANGELOG.md | 1 + pkgs/lints/README.md | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 11978f7f..0b76fbc5 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -3,6 +3,7 @@ - `core`: - added `no_wildcard_variable_uses` - Updated the SDK lower-bound to 3.1. +- Add a section on upgrading to the latest lint set to the readme. ## 3.0.0 diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 7349a5dc..c43af1c5 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -71,6 +71,14 @@ For existing apps or packages, you can enable these lints via: include: package:lints/core.yaml ``` +## Upgrading to the latest lints + +To upgrade to the latest version of the lint set, run: + +``` +dart pub add dev:lints +``` + ## Customizing the predefined lint sets For details on customizing static analysis above and beyond the predefined From a0bf795a6dfeedf110641a8772379daba5e03696 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:59:46 +0000 Subject: [PATCH 66/90] Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/lints#176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.0 to 1.6.2.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available in an environment variable, DART_HOME (dart-lang/lints#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/lints#35).

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.0&new-version=1.6.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 3d224446..eead84f9 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From 34ec24ba38fbb040c460c977b4eeddff67fe04f8 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 8 Feb 2024 18:31:06 -0800 Subject: [PATCH 67/90] add library_annotations; remove package_prefixed_library_names (dart-lang/lints#179) --- pkgs/lints/CHANGELOG.md | 4 +++- pkgs/lints/lib/core.yaml | 2 +- pkgs/lints/rules.md | 4 ++-- pkgs/lints/tool/rules.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 0b76fbc5..bdd9ea7c 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,7 +1,9 @@ ## 4.0.0-wip - `core`: - - added `no_wildcard_variable_uses` + - added `library_annotations` (https://github.com/dart-lang/lints/issues/177) + - added `no_wildcard_variable_uses` (https://github.com/dart-lang/lints/issues/139) + - removed `package_prefixed_library_names` (https://github.com/dart-lang/lints/issues/172) - Updated the SDK lower-bound to 3.1. - Add a section on upgrading to the latest lint set to the readme. diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 990d7530..1cfe995f 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -21,11 +21,11 @@ linter: - file_names - hash_and_equals - implicit_call_tearoffs + - library_annotations - no_duplicate_case_values - no_wildcard_variable_uses - non_constant_identifier_names - null_check_on_nullable_type_parameter - - package_prefixed_library_names - prefer_generic_function_type_aliases - prefer_is_empty - prefer_is_not_empty diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 04e39213..2a4a5b96 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -5,7 +5,7 @@ | Lint Rules | Description | [Fix][] | | :--------- | :---------- | ------- | -| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty else statements. | ✅ | +| [`avoid_empty_else`](https://dart.dev/lints/avoid_empty_else) | Avoid empty statements in else clauses. | ✅ | | [`avoid_relative_lib_imports`](https://dart.dev/lints/avoid_relative_lib_imports) | Avoid relative imports for files in `lib/`. | ✅ | | [`avoid_shadowing_type_parameters`](https://dart.dev/lints/avoid_shadowing_type_parameters) | Avoid shadowing type parameters. | | | [`avoid_types_as_parameter_names`](https://dart.dev/lints/avoid_types_as_parameter_names) | Avoid types as parameter names. | ✅ | @@ -20,11 +20,11 @@ | [`file_names`](https://dart.dev/lints/file_names) | Name source files using `lowercase_with_underscores`. | | | [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. | ✅ | | [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. | ✅ | +| [`library_annotations`](https://dart.dev/lints/library_annotations) | Attach library annotations to library directives. | ✅ | | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | | [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | | [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | -| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | | | [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | ✅ | | [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | ✅ | | [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | ✅ | diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index fc501a2b..a0550056 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -11,7 +11,7 @@ }, { "name": "avoid_empty_else", - "description": "Avoid empty else statements.", + "description": "Avoid empty statements in else clauses.", "fixStatus": "hasFix" }, { From 8f633a965b965c91dc493c7409efc0b8a8610ec0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:12:03 +0000 Subject: [PATCH 68/90] Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/lints#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
Release notes

Sourced from actions/checkout's releases.

v4.1.2

We are investigating the following issue with this release and have rolled-back the v4 tag to point to v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.1...v4.1.2

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.1&new-version=4.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index eead84f9..f26245ed 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.1, stable, beta] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From f95ebd34408b658854d10fb85270865134e19498 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 30 Apr 2024 09:56:10 -0700 Subject: [PATCH 69/90] remove the 'library_names' lint (dart-lang/lints#183) --- pkgs/lints/CHANGELOG.md | 2 ++ pkgs/lints/lib/recommended.yaml | 1 - pkgs/lints/rules.md | 1 - pkgs/lints/tool/gen_docs.dart | 10 ++-------- pkgs/lints/tool/rules.json | 27 +++++++++++++++++++++------ 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index bdd9ea7c..ec395c51 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -4,6 +4,8 @@ - added `library_annotations` (https://github.com/dart-lang/lints/issues/177) - added `no_wildcard_variable_uses` (https://github.com/dart-lang/lints/issues/139) - removed `package_prefixed_library_names` (https://github.com/dart-lang/lints/issues/172) +- `recommended`: + - removed `library_names` (https://github.com/dart-lang/lints/issues/181) - Updated the SDK lower-bound to 3.1. - Add a section on upgrading to the latest lint set to the readme. diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index d9cd9166..eda84d68 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -25,7 +25,6 @@ linter: - empty_statements - exhaustive_cases - implementation_imports - - library_names - library_prefixes - library_private_types_in_public_api - no_leading_underscores_for_library_prefixes diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 2a4a5b96..8b44b0e3 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -59,7 +59,6 @@ | [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | | [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | | [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | -| [`library_names`](https://dart.dev/lints/library_names) | Name libraries using `lowercase_with_underscores`. | | | [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | | [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | | [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index bbbbaef2..7a331072 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -90,14 +90,8 @@ String _createRuleTable( final ruleMeta = lintMeta.firstWhereOrNull((meta) => meta['name'] == rule); - if (ruleMeta == null) { - print('rules.json data for rule \'$rule\' not found.'); - print('Update lib/rules.json from ' - 'https://raw.githubusercontent.com/dart-lang/site-www/main/src/_data/linter_rules.json.'); - exit(1); - } - final description = ruleMeta['description'] as String?; - final hasFix = ruleMeta['fixStatus'] == 'hasFix'; + final description = ruleMeta?['description'] as String? ?? ''; + final hasFix = ruleMeta?['fixStatus'] == 'hasFix'; final fixDesc = hasFix ? '✅' : ''; return '| [`$rule`](https://dart.dev/lints/$rule) | $description | $fixDesc |'; diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index a0550056..fdf9ec97 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -27,7 +27,7 @@ { "name": "avoid_returning_null_for_future", "description": "Avoid returning null for Future.", - "fixStatus": "hasFix" + "fixStatus": "noFix" }, { "name": "avoid_slow_async_io", @@ -72,7 +72,7 @@ { "name": "comment_references", "description": "Only reference in scope identifiers in doc comments.", - "fixStatus": "noFix" + "fixStatus": "hasFix" }, { "name": "control_flow_in_finally", @@ -82,7 +82,7 @@ { "name": "deprecated_member_use_from_same_package", "description": "Avoid using deprecated elements from within the package in which they are declared.", - "fixStatus": "needsFix" + "fixStatus": "hasFix" }, { "name": "diagnostic_describe_all_properties", @@ -134,6 +134,11 @@ "description": "Boolean expression composed only with literals.", "fixStatus": "noFix" }, + { + "name": "missing_code_block_language_in_doc_comment", + "description": "A code block is missing a specified language.", + "fixStatus": "needsEvaluation" + }, { "name": "no_adjacent_strings_in_list", "description": "Don't use adjacent strings in list.", @@ -179,6 +184,11 @@ "description": "Avoid `throw` in finally block.", "fixStatus": "noFix" }, + { + "name": "unintended_html_in_doc_comment", + "description": "Use of angle brackets in a doc comment is treated as HTML by Markdown.", + "fixStatus": "needsEvaluation" + }, { "name": "unnecessary_statements", "description": "Avoid using unnecessary statements.", @@ -247,7 +257,7 @@ { "name": "always_require_non_null_named_parameters", "description": "Specify `@required` on named parameters without defaults.", - "fixStatus": "hasFix" + "fixStatus": "noFix" }, { "name": "always_specify_types", @@ -522,7 +532,7 @@ { "name": "flutter_style_todos", "description": "Use Flutter TODO format: // TODO(username): message, https://URL-to-issue.", - "fixStatus": "noFix" + "fixStatus": "hasFix" }, { "name": "implementation_imports", @@ -871,7 +881,7 @@ }, { "name": "require_trailing_commas", - "description": "Use trailing commas for all function calls and declarations.", + "description": "Use trailing commas for all parameter lists and argument lists.", "fixStatus": "hasFix" }, { @@ -984,6 +994,11 @@ "description": "Avoid library directives unless they have documentation comments or annotations.", "fixStatus": "hasFix" }, + { + "name": "unnecessary_library_name", + "description": "Don't have a library name in a `library` declaration.", + "fixStatus": "hasFix" + }, { "name": "unnecessary_new", "description": "Unnecessary new keyword.", From 008685c57cbb6d593b03dcf35e08a755d6dccde0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 10:19:36 +0000 Subject: [PATCH 70/90] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/lints#186) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.4.
Release notes

Sourced from actions/checkout's releases.

v4.1.4

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.3...v4.1.4

v4.1.3

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.2...v4.1.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.2&new-version=4.1.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index f26245ed..12a46db1 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.1, stable, beta] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From 4d31b374666f5e43632e0c13b4e7333329471738 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 15:29:38 +0000 Subject: [PATCH 71/90] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/lints#185) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.2 to 1.6.4.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.4

  • Rebuild JS code to include changes from v1.6.3

v1.6.3

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.2&new-version=1.6.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 12a46db1..bc822c04 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From c32c8c7cd54285b6cbab1e260f44cfa158447c7c Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 9 May 2024 09:31:36 -0700 Subject: [PATCH 72/90] rev to 4.0.0; prep to publish (dart-lang/lints#184) --- pkgs/lints/CHANGELOG.md | 2 +- pkgs/lints/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index ec395c51..5950671f 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,4 +1,4 @@ -## 4.0.0-wip +## 4.0.0 - `core`: - added `library_annotations` (https://github.com/dart-lang/lints/issues/177) diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 6c02d5b1..66f7a8a8 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 4.0.0-wip +version: 4.0.0 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. From b47a1010ea88f61aa65426d9bffc03dce6ce48ca Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Mon, 13 May 2024 13:44:09 +0200 Subject: [PATCH 73/90] Tighten up the `gen_docs.dart` script. (dart-lang/lints#187) Move some functionality into helper functions, to make the overall logic easier to read. Extracted constants, added comments. Make the script work when called from any directory (finds package root relative to `Platform.script`, instead of assuming current working directory is the root.) Remove dependency on `package:collection` which was only used for one function, in code that was restructured. General functionality should still be the same (the generated output and JSON cache haven't changed). --- pkgs/lints/pubspec.yaml | 1 - pkgs/lints/tool/gen_docs.dart | 232 +++++++++++++++++++++++++--------- 2 files changed, 171 insertions(+), 62 deletions(-) diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 66f7a8a8..c4ea8923 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -16,7 +16,6 @@ environment: # dependencies: dev_dependencies: - collection: ^1.17.0 http: ^1.0.0 path: ^1.8.0 yaml: ^3.1.0 diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index 7a331072..d3a5732d 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -5,98 +5,208 @@ import 'dart:convert'; import 'dart:io'; -import 'package:collection/collection.dart'; import 'package:path/path.dart' as p; import 'package:yaml/yaml.dart' as yaml; import 'package:http/http.dart' as http; +/// Source of truth for linter rules. +const rulesUrl = + 'https://raw.githubusercontent.com/dart-lang/site-www/main/src/_data/linter_rules.json'; + +/// Local cache of linter rules from [rulesUrl]. +/// +/// Relative to package root. +const rulesCacheFilePath = 'tool/rules.json'; + +/// Generated rules documentation markdown file. +/// +/// Relative to package root. +const rulesMarkdownFilePath = 'rules.md'; + +/// Fetches the [rulesUrl] JSON description of all lints, saves a cached +/// summary of the relevant fields in [rulesCacheFilePath], and +/// updates [rulesMarkdownFilePath] to +/// +/// Passing any command line argument disables generating documentation, +/// and makes this tool just verify that the doc is up-to-date with the +/// [rulesCacheFilePath]. (Which it always should be, since the two +/// are saved at the same time.) void main(List args) async { - final justVerify = args.isNotEmpty; - final lintRules = >{}; - - final rulesJsonFile = File('tool/rules.json'); - final rulesUrl = - 'https://raw.githubusercontent.com/dart-lang/site-www/main/src/_data/linter_rules.json'; - if (!justVerify) { - rulesJsonFile.writeAsStringSync((await http.get(Uri.parse(rulesUrl))).body); + final verifyOnly = args.isNotEmpty; + + // Read lint rules. + final rulesJson = await _fetchRulesJson(verifyOnly: verifyOnly); + + // Read existing generated Markdown documentation. + final rulesMarkdownFile = _packageRelativeFile(rulesMarkdownFilePath); + final rulesMarkdownContent = rulesMarkdownFile.readAsStringSync(); + + if (verifyOnly) { + print('Validating that ${rulesMarkdownFile.path} is up-to-date ...'); + } else { + print('Regenerating ${rulesMarkdownFile.path} ...'); } - final rulesJson = (jsonDecode(rulesJsonFile.readAsStringSync()) as List) - .cast>(); - final rulesMdFile = File('rules.md'); - final rulesMdContent = rulesMdFile.readAsStringSync(); + // Generate new documentation. + var newRulesMarkdownContent = + _updateMarkdown(rulesMarkdownContent, rulesJson); + + // If no documentation change, all is up-to-date. + if (newRulesMarkdownContent == rulesMarkdownContent) { + print('${rulesMarkdownFile.path} is up-to-date.'); + return; + } - if (justVerify) { - print('Validating that ${rulesMdFile.path} is up-to-date ...'); + /// Documentation has changed. + if (verifyOnly) { + print('${rulesMarkdownFile.path} is not up-to-date (lint tables need to be ' + 'regenerated).'); + print(''); + print("Run 'dart tool/gen_docs.dart' to re-generate."); + exit(1); } else { - print('Regenerating ${rulesMdFile.path} ...'); + // Save [rulesMarkdownFilePath]. + rulesMarkdownFile.writeAsStringSync(newRulesMarkdownContent); + print('Wrote ${rulesMarkdownFile.path}.'); } +} - for (var file in ['lib/core.yaml', 'lib/recommended.yaml']) { - var name = p.basenameWithoutExtension(file); - lintRules[name] = _parseRules(File(file)); +/// Fetches or load the JSON lint rules. +/// +/// If [verifyOnly] is `false`, fetches JSON from [rulesUrl], +/// extracts the needed information, and writes a summary to +/// [rulesCacheFilePath]. +/// +/// If [verifyOnly] is `true`, only reads the cached data back from +/// [rulesCacheFilePath]. +Future>> _fetchRulesJson( + {required bool verifyOnly}) async { + final rulesJsonFile = _packageRelativeFile(rulesCacheFilePath); + if (verifyOnly) { + final rulesJsonText = rulesJsonFile.readAsStringSync(); + return _readJson(rulesJsonText); } + final rulesJsonText = (await http.get(Uri.parse(rulesUrl))).body; + final rulesJson = _readJson(rulesJsonText); - var newContent = rulesMdContent; + // Re-save [rulesJsonFile] file. + var newRulesJson = [...rulesJson.values]; + rulesJsonFile + .writeAsStringSync(JsonEncoder.withIndent(' ').convert(newRulesJson)); - for (var ruleSetName in lintRules.keys) { - final comment = '\n'; + return rulesJson; +} - newContent = newContent.replaceRange( - newContent.indexOf(comment) + comment.length, - newContent.lastIndexOf(comment), - _createRuleTable(lintRules[ruleSetName]!, rulesJson), - ); - } +/// Extracts relevant information from a list of JSON objects. +/// +/// For each JSON object, includes only the relevant (string-typed) properties, +/// then creates a map indexed by the `'name'` property of the objects. +Map> _readJson(String rulesJsonText) { + /// Relevant keys in the JSON information about lints. + const relevantKeys = {'name', 'description', 'fixStatus'}; + final rulesJson = jsonDecode(rulesJsonText) as List; + return { + for (Map rule in rulesJson) + rule['name'] as String: { + for (var key in relevantKeys) key: rule[key] as String + } + }; +} - if (justVerify) { - if (newContent != rulesMdContent) { - print('${rulesMdFile.path} is not up-to-date (lint tables need to be ' - 'regenerated).'); - print(''); - print("Run 'dart tool/gen_docs.dart' to re-generate."); - exit(1); - } else { - print('${rulesMdFile.path} is up-to-date.'); - } - } else { - // Re-save rules.json. - const retainKeys = {'name', 'description', 'fixStatus'}; - for (var rule in rulesJson) { - rule.removeWhere((key, value) => !retainKeys.contains(key)); +/// Inserts new Markdown content for both rule sets into [content]. +/// +/// For both "core" and "recommended" rule sets, +/// replaces the table between the two `` and the two +/// `` markers with a new table generated from +/// [rulesJson], based on the list of rules in `lib/core.yaml` and +/// `lib/recommended.yaml`. +String _updateMarkdown( + String content, Map> rulesJson) { + for (var ruleSetName in ['core', 'recommended']) { + var ruleFile = _packageRelativeFile(p.join('lib', '$ruleSetName.yaml')); + var ruleSet = _parseRules(ruleFile); + + final rangeDelimiter = '\n'; + var rangeStart = content.indexOf(rangeDelimiter) + rangeDelimiter.length; + var rangeEnd = content.indexOf(rangeDelimiter, rangeStart); + if (rangeEnd < 0) { + stderr.writeln('Missing "$rangeDelimiter" in $rulesMarkdownFilePath.'); + continue; } - rulesJsonFile - .writeAsStringSync(JsonEncoder.withIndent(' ').convert(rulesJson)); - - // Write out the rules md file. - rulesMdFile.writeAsStringSync(newContent); - print('Wrote ${rulesMdFile.path}.'); + content = content.replaceRange( + rangeStart, rangeEnd, _createRuleTable(ruleSet, rulesJson)); } + return content; } +/// Parses analysis options YAML file, and extracts linter rules. List _parseRules(File yamlFile) { var yamlData = yaml.loadYaml(yamlFile.readAsStringSync()) as Map; - return (yamlData['linter']['rules'] as List).toList().cast(); + var linterEntry = yamlData['linter'] as Map; + return List.from(linterEntry['rules'] as List); } +/// Creates markdown source for a table of lint rules. String _createRuleTable( - List rules, List> lintMeta) { + List rules, Map> lintMeta) { rules.sort(); final lines = [ '| Lint Rules | Description | [Fix][] |', '| :--------- | :---------- | ------- |', - ...rules.map((rule) { - final ruleMeta = - lintMeta.firstWhereOrNull((meta) => meta['name'] == rule); - - final description = ruleMeta?['description'] as String? ?? ''; - final hasFix = ruleMeta?['fixStatus'] == 'hasFix'; - final fixDesc = hasFix ? '✅' : ''; - - return '| [`$rule`](https://dart.dev/lints/$rule) | $description | $fixDesc |'; - }), + for (var rule in rules) _createRuleTableRow(rule, lintMeta), ]; return '${lines.join('\n')}\n'; } + +/// Creates a line containing the markdown table row for a single lint rule. +/// +/// Used by [_createRuleTable] for each row in the generated table. +/// The row should have the same number of entires as the table format, +/// and should be on a single line with no newline at the end. +String _createRuleTableRow( + String rule, Map> lintMeta) { + final ruleMeta = lintMeta[rule]; + if (ruleMeta == null) { + stderr.writeln("WARNING: Missing rule information for rule: $rule"); + } + final description = ruleMeta?['description'] ?? ''; + final hasFix = ruleMeta?['fixStatus'] == 'hasFix'; + final fixDesc = hasFix ? '✅' : ''; + + return '| [`$rule`](https://dart.dev/lints/$rule) | ' + '$description | $fixDesc |'; +} + +/// A path relative to the root of this package. +/// +/// Works independently of the current working directory. +/// Is based on the location of this script, through [Platform.script]. +File _packageRelativeFile(String packagePath) => + File(p.join(_packageRoot, packagePath)); + +/// Cached package root used by [_packageRelative]. +final String _packageRoot = _relativePackageRoot(); + +/// A path to the package root from the current directory. +/// +/// If the current directory is inside the package, the returned path is +/// a relative path of a number of `..` segments. +/// If the current directory is outside of the package, the returned path +/// may be absolute. +String _relativePackageRoot() { + var rootPath = p.dirname(p.dirname(Platform.script.path)); + if (p.isRelative(rootPath)) return rootPath; + var baseDir = p.current; + if (rootPath == baseDir) return ''; + if (baseDir.startsWith(rootPath)) { + var backSteps = []; + do { + backSteps.add('..'); + baseDir = p.dirname(baseDir); + } while (baseDir != rootPath); + return p.joinAll(backSteps); + } + return rootPath; +} From bcb9f052aee147177ada4ac43d2f95f8f10af80d Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 16 May 2024 09:33:43 -0700 Subject: [PATCH 74/90] Update README.md (dart-lang/lints#189) --- pkgs/lints/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index c43af1c5..751a72b5 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -39,7 +39,7 @@ For more information about topics, visit ## Where these lints are used -When creating new Dart project using the [`dart create`][dart create] command, +When creating a new Dart project using the [`dart create`][dart create] command, the `recommended` set of lints from `package:lints` is enabled by default. When uploading a package to the [pub.dev] package repository, packages are From 0e28bddd9cf26c1a8fedc8037e82797bf225dd59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 10:52:12 +0000 Subject: [PATCH 75/90] Bump actions/checkout from 4.1.4 to 4.1.6 (dart-lang/lints#191) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.4 to 4.1.6.
Release notes

Sourced from actions/checkout's releases.

v4.1.6

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.5...v4.1.6

v4.1.5

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.4...v4.1.5

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.4&new-version=4.1.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index bc822c04..44fdaebe 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.1, stable, beta] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From dcd52fe4c7f83d2d88a2d20e74e261072c86dd03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:31:05 +0000 Subject: [PATCH 76/90] Bump actions/checkout from 4.1.6 to 4.1.7 (dart-lang/lints#193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
Release notes

Sourced from actions/checkout's releases.

v4.1.7

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.6...v4.1.7

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.6&new-version=4.1.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 44fdaebe..46f11368 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [3.1, stable, beta] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From 94b2e13b4465ca219eb88703dc76ec307052a3d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 10:33:05 +0000 Subject: [PATCH 77/90] Bump dart-lang/setup-dart from 1.6.4 to 1.6.5 (dart-lang/lints#194) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.4 to 1.6.5.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.5

dart-lang/lints#118: dart-lang/setup-dartdart-lang/lints#118

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.5

dart-lang/lints#118: dart-lang/setup-dartdart-lang/lints#118

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.4&new-version=1.6.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 46f11368..c0ba0c7a 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From 37cbcc2df5613b4973fece72fe2fecb1ed074409 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 7 Aug 2024 15:40:56 -0700 Subject: [PATCH 78/90] add unnecessary_library_name to recommended (dart-lang/lints#198) * add unnecessary_library_name to recommended * update the workflow config * link to the lint's docs --- pkgs/lints/.github/workflows/validate.yml | 2 +- pkgs/lints/CHANGELOG.md | 8 + pkgs/lints/lib/recommended.yaml | 1 + pkgs/lints/pubspec.yaml | 4 +- pkgs/lints/rules.md | 41 +- pkgs/lints/tool/rules.json | 562 +++++++++++----------- 6 files changed, 319 insertions(+), 299 deletions(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index c0ba0c7a..1b70e81e 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [3.1, stable, beta] + sdk: [3.4, stable, beta] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 5950671f..b77eb439 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,11 @@ +## 5.0.0-wip + +- `recommended`: + - added [unnecessary_library_name] (https://github.com/dart-lang/lints/issues/181) +- Updated the SDK lower-bound to 3.4. + +[unnecessary_library_name]: https://dart.dev/lints/unnecessary_library_name + ## 4.0.0 - `core`: diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index eda84d68..bf0d9cd0 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -54,6 +54,7 @@ linter: - unnecessary_constructor_name - unnecessary_getters_setters - unnecessary_late + - unnecessary_library_name - unnecessary_new - unnecessary_null_aware_assignments - unnecessary_null_in_if_null_operators diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index c4ea8923..cbe926dd 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 4.0.0 +version: 5.0.0-wip description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. @@ -10,7 +10,7 @@ topics: - lints environment: - sdk: ^3.1.0 + sdk: ^3.4.0 # NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 8b44b0e3..1d6eb5d4 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -24,20 +24,20 @@ | [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. | ✅ | | [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | | | [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. | ✅ | -| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. | ✅ | +| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use `null` check on a potentially nullable type parameter. | ✅ | | [`prefer_generic_function_type_aliases`](https://dart.dev/lints/prefer_generic_function_type_aliases) | Prefer generic function type aliases. | ✅ | -| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for Iterables and Maps. | ✅ | -| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for Iterables and Maps. | ✅ | -| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. | ✅ | +| [`prefer_is_empty`](https://dart.dev/lints/prefer_is_empty) | Use `isEmpty` for `Iterable`s and `Map`s. | ✅ | +| [`prefer_is_not_empty`](https://dart.dev/lints/prefer_is_not_empty) | Use `isNotEmpty` for `Iterable`s and `Map`s. | ✅ | +| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use `whereType` on iterable. | ✅ | | [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. | ✅ | -| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | | +| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via `@Deprecated("message")`. | | | [`secure_pubspec_urls`](https://dart.dev/lints/secure_pubspec_urls) | Use secure urls in `pubspec.yaml`. | | | [`type_literal_in_constant_pattern`](https://dart.dev/lints/type_literal_in_constant_pattern) | Don't use constant patterns with type literals. | ✅ | | [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | | [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | | [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | | [`valid_regexps`](https://dart.dev/lints/valid_regexps) | Use valid regular expression syntax. | | -| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to void. | | +| [`void_checks`](https://dart.dev/lints/void_checks) | Don't assign to `void`. | | ### Recommended lint rules @@ -47,14 +47,14 @@ | :--------- | :---------- | ------- | | [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | | [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | -| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to null. | ✅ | -| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for null in custom == operators. | ✅ | +| [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to `null`. | ✅ | +| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for `null` in custom `==` operators. | ✅ | | [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | ✅ | | [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | ✅ | -| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning null for void. | ✅ | +| [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning `null` for `void`. | ✅ | | [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. | ✅ | | [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. | ✅ | -| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | | +| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in `finally` blocks. | | | [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. | ✅ | | [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | | [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | @@ -68,34 +68,35 @@ | [`package_names`](https://dart.dev/lints/package_names) | Use `lowercase_with_underscores` for package names. | | | [`prefer_adjacent_string_concatenation`](https://dart.dev/lints/prefer_adjacent_string_concatenation) | Use adjacent strings to concatenate string literals. | ✅ | | [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. | ✅ | -| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. | ✅ | +| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for `null`. | ✅ | | [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. | ✅ | -| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. | ✅ | -| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. | ✅ | +| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be `final`. | ✅ | +| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer `for` elements when building maps from iterables. | ✅ | | [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. | ✅ | -| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using if null operators. | ✅ | +| [`prefer_if_null_operators`](https://dart.dev/lints/prefer_if_null_operators) | Prefer using `??` operators. | ✅ | | [`prefer_initializing_formals`](https://dart.dev/lints/prefer_initializing_formals) | Use initializing formals when possible. | ✅ | | [`prefer_inlined_adds`](https://dart.dev/lints/prefer_inlined_adds) | Inline list item declarations where possible. | ✅ | | [`prefer_interpolation_to_compose_strings`](https://dart.dev/lints/prefer_interpolation_to_compose_strings) | Use interpolation to compose strings and values. | ✅ | | [`prefer_is_not_operator`](https://dart.dev/lints/prefer_is_not_operator) | Prefer is! operator. | ✅ | -| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using null aware operators. | ✅ | +| [`prefer_null_aware_operators`](https://dart.dev/lints/prefer_null_aware_operators) | Prefer using `null`-aware operators. | ✅ | | [`prefer_spread_collections`](https://dart.dev/lints/prefer_spread_collections) | Use spread collections when possible. | ✅ | | [`recursive_getters`](https://dart.dev/lints/recursive_getters) | Property getter recursively returns itself. | | -| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using /// for doc comments. | ✅ | +| [`slash_for_doc_comments`](https://dart.dev/lints/slash_for_doc_comments) | Prefer using `///` for doc comments. | ✅ | | [`type_init_formals`](https://dart.dev/lints/type_init_formals) | Don't type annotate initializing formals. | ✅ | | [`unnecessary_brace_in_string_interps`](https://dart.dev/lints/unnecessary_brace_in_string_interps) | Avoid using braces in interpolation when not needed. | ✅ | -| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid const keyword. | ✅ | +| [`unnecessary_const`](https://dart.dev/lints/unnecessary_const) | Avoid `const` keyword. | ✅ | | [`unnecessary_constructor_name`](https://dart.dev/lints/unnecessary_constructor_name) | Unnecessary `.new` constructor name. | ✅ | | [`unnecessary_getters_setters`](https://dart.dev/lints/unnecessary_getters_setters) | Avoid wrapping fields in getters and setters just to be "safe". | ✅ | | [`unnecessary_late`](https://dart.dev/lints/unnecessary_late) | Don't specify the `late` modifier when it is not needed. | ✅ | +| [`unnecessary_library_name`](https://dart.dev/lints/unnecessary_library_name) | Don't have a library name in a `library` declaration. | ✅ | | [`unnecessary_new`](https://dart.dev/lints/unnecessary_new) | Unnecessary new keyword. | ✅ | -| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid null in null-aware assignment. | ✅ | -| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `if null` operators. | ✅ | +| [`unnecessary_null_aware_assignments`](https://dart.dev/lints/unnecessary_null_aware_assignments) | Avoid `null` in `null`-aware assignment. | ✅ | +| [`unnecessary_null_in_if_null_operators`](https://dart.dev/lints/unnecessary_null_in_if_null_operators) | Avoid using `null` in `??` operators. | ✅ | | [`unnecessary_nullable_for_final_variable_declarations`](https://dart.dev/lints/unnecessary_nullable_for_final_variable_declarations) | Use a non-nullable type for a final variable initialized with a non-nullable value. | ✅ | | [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. | ✅ | | [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. | ✅ | | [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. | ✅ | -| [`unnecessary_to_list_in_spreads`](https://dart.dev/lints/unnecessary_to_list_in_spreads) | Unnecessary toList() in spreads. | ✅ | +| [`unnecessary_to_list_in_spreads`](https://dart.dev/lints/unnecessary_to_list_in_spreads) | Unnecessary `toList()` in spreads. | ✅ | | [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. | ✅ | | [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. | ✅ | | [`use_super_parameters`](https://dart.dev/lints/use_super_parameters) | Use super-initializer parameters where possible. | ✅ | diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index fdf9ec97..5a8d1ff1 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -1,244 +1,4 @@ [ - { - "name": "always_use_package_imports", - "description": "Avoid relative imports for files in `lib/`.", - "fixStatus": "hasFix" - }, - { - "name": "avoid_dynamic_calls", - "description": "Avoid method calls or property accesses on a \"dynamic\" target.", - "fixStatus": "noFix" - }, - { - "name": "avoid_empty_else", - "description": "Avoid empty statements in else clauses.", - "fixStatus": "hasFix" - }, - { - "name": "avoid_print", - "description": "Avoid `print` calls in production code.", - "fixStatus": "hasFix" - }, - { - "name": "avoid_relative_lib_imports", - "description": "Avoid relative imports for files in `lib/`.", - "fixStatus": "hasFix" - }, - { - "name": "avoid_returning_null_for_future", - "description": "Avoid returning null for Future.", - "fixStatus": "noFix" - }, - { - "name": "avoid_slow_async_io", - "description": "Avoid slow async `dart:io` methods.", - "fixStatus": "needsFix" - }, - { - "name": "avoid_type_to_string", - "description": "Avoid .toString() in production code since results may be minified.", - "fixStatus": "noFix" - }, - { - "name": "avoid_types_as_parameter_names", - "description": "Avoid types as parameter names.", - "fixStatus": "hasFix" - }, - { - "name": "avoid_unstable_final_fields", - "description": "Avoid overriding a final field to return different values if called multiple times.", - "fixStatus": "noFix" - }, - { - "name": "avoid_web_libraries_in_flutter", - "description": "Avoid using web-only libraries outside Flutter web plugin packages.", - "fixStatus": "noFix" - }, - { - "name": "cancel_subscriptions", - "description": "Cancel instances of dart.async.StreamSubscription.", - "fixStatus": "noFix" - }, - { - "name": "close_sinks", - "description": "Close instances of `dart.core.Sink`.", - "fixStatus": "noFix" - }, - { - "name": "collection_methods_unrelated_type", - "description": "Invocation of various collection methods with arguments of unrelated types.", - "fixStatus": "noFix" - }, - { - "name": "comment_references", - "description": "Only reference in scope identifiers in doc comments.", - "fixStatus": "hasFix" - }, - { - "name": "control_flow_in_finally", - "description": "Avoid control flow in finally blocks.", - "fixStatus": "noFix" - }, - { - "name": "deprecated_member_use_from_same_package", - "description": "Avoid using deprecated elements from within the package in which they are declared.", - "fixStatus": "hasFix" - }, - { - "name": "diagnostic_describe_all_properties", - "description": "DO reference all public properties in debug methods.", - "fixStatus": "hasFix" - }, - { - "name": "discarded_futures", - "description": "Don't invoke asynchronous functions in non-async blocks.", - "fixStatus": "hasFix" - }, - { - "name": "empty_statements", - "description": "Avoid empty statements.", - "fixStatus": "hasFix" - }, - { - "name": "hash_and_equals", - "description": "Always override `hashCode` if overriding `==`.", - "fixStatus": "hasFix" - }, - { - "name": "implicit_reopen", - "description": "Don't implicitly reopen classes.", - "fixStatus": "hasFix" - }, - { - "name": "invalid_case_patterns", - "description": "Use case expressions that are valid in Dart 3.0.", - "fixStatus": "hasFix" - }, - { - "name": "invariant_booleans", - "description": "Conditions should not unconditionally evaluate to `true` or to `false`.", - "fixStatus": "noFix" - }, - { - "name": "iterable_contains_unrelated_type", - "description": "Invocation of Iterable.contains with references of unrelated types.", - "fixStatus": "noFix" - }, - { - "name": "list_remove_unrelated_type", - "description": "Invocation of `remove` with references of unrelated types.", - "fixStatus": "noFix" - }, - { - "name": "literal_only_boolean_expressions", - "description": "Boolean expression composed only with literals.", - "fixStatus": "noFix" - }, - { - "name": "missing_code_block_language_in_doc_comment", - "description": "A code block is missing a specified language.", - "fixStatus": "needsEvaluation" - }, - { - "name": "no_adjacent_strings_in_list", - "description": "Don't use adjacent strings in list.", - "fixStatus": "needsFix" - }, - { - "name": "no_duplicate_case_values", - "description": "Don't use more than one case with same value.", - "fixStatus": "hasFix" - }, - { - "name": "no_logic_in_create_state", - "description": "Don't put any logic in createState.", - "fixStatus": "noFix" - }, - { - "name": "no_self_assignments", - "description": "Don't assign a variable to itself.", - "fixStatus": "needsEvaluation" - }, - { - "name": "no_wildcard_variable_uses", - "description": "Don't use wildcard parameters or variables.", - "fixStatus": "needsEvaluation" - }, - { - "name": "prefer_relative_imports", - "description": "Prefer relative imports for files in `lib/`.", - "fixStatus": "hasFix" - }, - { - "name": "prefer_void_to_null", - "description": "Don't use the Null type, unless you are positive that you don't want void.", - "fixStatus": "hasFix" - }, - { - "name": "test_types_in_equals", - "description": "Test type arguments in operator ==(Object other).", - "fixStatus": "noFix" - }, - { - "name": "throw_in_finally", - "description": "Avoid `throw` in finally block.", - "fixStatus": "noFix" - }, - { - "name": "unintended_html_in_doc_comment", - "description": "Use of angle brackets in a doc comment is treated as HTML by Markdown.", - "fixStatus": "needsEvaluation" - }, - { - "name": "unnecessary_statements", - "description": "Avoid using unnecessary statements.", - "fixStatus": "noFix" - }, - { - "name": "unrelated_type_equality_checks", - "description": "Equality operator `==` invocation with references of unrelated types.", - "fixStatus": "unregistered" - }, - { - "name": "unsafe_html", - "description": "Avoid unsafe HTML APIs.", - "fixStatus": "unregistered" - }, - { - "name": "use_build_context_synchronously", - "description": "Do not use BuildContexts across async gaps.", - "fixStatus": "noFix" - }, - { - "name": "use_key_in_widget_constructors", - "description": "Use key in widget constructors.", - "fixStatus": "hasFix" - }, - { - "name": "valid_regexps", - "description": "Use valid regular expression syntax.", - "fixStatus": "noFix" - }, - { - "name": "depend_on_referenced_packages", - "description": "Depend on referenced packages.", - "fixStatus": "needsFix" - }, - { - "name": "package_names", - "description": "Use `lowercase_with_underscores` for package names.", - "fixStatus": "noFix" - }, - { - "name": "secure_pubspec_urls", - "description": "Use secure urls in `pubspec.yaml`.", - "fixStatus": "noFix" - }, - { - "name": "sort_pub_dependencies", - "description": "Sort pub dependencies alphabetically.", - "fixStatus": "needsFix" - }, { "name": "always_declare_return_types", "description": "Declare method return types.", @@ -264,6 +24,11 @@ "description": "Specify type annotations.", "fixStatus": "hasFix" }, + { + "name": "always_use_package_imports", + "description": "Avoid relative imports for files in `lib/`.", + "fixStatus": "hasFix" + }, { "name": "annotate_overrides", "description": "Annotate overridden members.", @@ -276,7 +41,7 @@ }, { "name": "avoid_annotating_with_dynamic", - "description": "Avoid annotating with dynamic when not required.", + "description": "Avoid annotating with `dynamic` when not required.", "fixStatus": "hasFix" }, { @@ -286,7 +51,7 @@ }, { "name": "avoid_bool_literals_in_conditional_expressions", - "description": "Avoid bool literals in conditional expressions.", + "description": "Avoid `bool` literals in conditional expressions.", "fixStatus": "needsFix" }, { @@ -296,7 +61,7 @@ }, { "name": "avoid_catching_errors", - "description": "Don't explicitly catch Error or types that implement it.", + "description": "Don't explicitly catch `Error` or types that implement it.", "fixStatus": "unregistered" }, { @@ -306,9 +71,19 @@ }, { "name": "avoid_double_and_int_checks", - "description": "Avoid double and int checks.", + "description": "Avoid `double` and `int` checks.", "fixStatus": "needsFix" }, + { + "name": "avoid_dynamic_calls", + "description": "Avoid method calls or property accesses on a `dynamic` target.", + "fixStatus": "noFix" + }, + { + "name": "avoid_empty_else", + "description": "Avoid empty statements in else clauses.", + "fixStatus": "hasFix" + }, { "name": "avoid_equals_and_hash_code_on_mutable_classes", "description": "Avoid overloading operator == and hashCode on classes not marked `@immutable`.", @@ -326,7 +101,7 @@ }, { "name": "avoid_final_parameters", - "description": "Avoid final for parameter declarations.", + "description": "Avoid `final` for parameter declarations.", "fixStatus": "needsFix" }, { @@ -341,7 +116,7 @@ }, { "name": "avoid_init_to_null", - "description": "Don't explicitly initialize variables to null.", + "description": "Don't explicitly initialize variables to `null`.", "fixStatus": "hasFix" }, { @@ -356,7 +131,7 @@ }, { "name": "avoid_null_checks_in_equality_operators", - "description": "Don't check for null in custom == operators.", + "description": "Don't check for `null` in custom `==` operators.", "fixStatus": "hasFix" }, { @@ -364,6 +139,11 @@ "description": "Avoid positional boolean parameters.", "fixStatus": "noFix" }, + { + "name": "avoid_print", + "description": "Avoid `print` calls in production code.", + "fixStatus": "hasFix" + }, { "name": "avoid_private_typedef_functions", "description": "Avoid private typedef functions.", @@ -374,6 +154,11 @@ "description": "Avoid redundant argument values.", "fixStatus": "hasFix" }, + { + "name": "avoid_relative_lib_imports", + "description": "Avoid relative imports for files in `lib/`.", + "fixStatus": "hasFix" + }, { "name": "avoid_renaming_method_parameters", "description": "Don't rename parameters of overridden methods.", @@ -389,9 +174,14 @@ "description": "Avoid returning null from members whose return type is bool, double, int, or num.", "fixStatus": "noFix" }, + { + "name": "avoid_returning_null_for_future", + "description": "Avoid returning null for Future.", + "fixStatus": "noFix" + }, { "name": "avoid_returning_null_for_void", - "description": "Avoid returning null for void.", + "description": "Avoid returning `null` for `void`.", "fixStatus": "hasFix" }, { @@ -414,6 +204,21 @@ "description": "Avoid single cascade in expression statements.", "fixStatus": "hasFix" }, + { + "name": "avoid_slow_async_io", + "description": "Avoid slow asynchronous `dart:io` methods.", + "fixStatus": "needsFix" + }, + { + "name": "avoid_type_to_string", + "description": "Avoid .toString() in production code since results may be minified.", + "fixStatus": "noFix" + }, + { + "name": "avoid_types_as_parameter_names", + "description": "Avoid types as parameter names.", + "fixStatus": "hasFix" + }, { "name": "avoid_types_on_closure_parameters", "description": "Avoid annotating types for function expression parameters.", @@ -424,6 +229,11 @@ "description": "Avoid unnecessary containers.", "fixStatus": "hasFix" }, + { + "name": "avoid_unstable_final_fields", + "description": "Avoid overriding a final field to return different values if called multiple times.", + "fixStatus": "noFix" + }, { "name": "avoid_unused_constructor_parameters", "description": "Avoid defining unused parameters in constructors.", @@ -431,9 +241,14 @@ }, { "name": "avoid_void_async", - "description": "Avoid async functions that return void.", + "description": "Avoid `async` functions that return `void`.", "fixStatus": "hasFix" }, + { + "name": "avoid_web_libraries_in_flutter", + "description": "Avoid using web-only libraries outside Flutter web plugin packages.", + "fixStatus": "noFix" + }, { "name": "await_only_futures", "description": "Await only futures.", @@ -449,6 +264,11 @@ "description": "Name types using UpperCamelCase.", "fixStatus": "noFix" }, + { + "name": "cancel_subscriptions", + "description": "Cancel instances of `dart:async` `StreamSubscription`.", + "fixStatus": "noFix" + }, { "name": "cascade_invocations", "description": "Cascade consecutive method invocations on the same reference.", @@ -459,11 +279,26 @@ "description": "Don't cast a nullable value to a non nullable type.", "fixStatus": "hasFix" }, + { + "name": "close_sinks", + "description": "Close instances of `dart:core` `Sink`.", + "fixStatus": "noFix" + }, + { + "name": "collection_methods_unrelated_type", + "description": "Invocation of various collection methods with arguments of unrelated types.", + "fixStatus": "noFix" + }, { "name": "combinators_ordering", "description": "Sort combinator names alphabetically.", "fixStatus": "hasFix" }, + { + "name": "comment_references", + "description": "Only reference in scope identifiers in doc comments.", + "fixStatus": "hasFix" + }, { "name": "conditional_uri_does_not_exist", "description": "Missing conditional import.", @@ -474,6 +309,11 @@ "description": "Prefer using lowerCamelCase for constant names.", "fixStatus": "hasFix" }, + { + "name": "control_flow_in_finally", + "description": "Avoid control flow in `finally` blocks.", + "fixStatus": "noFix" + }, { "name": "curly_braces_in_flow_control_structures", "description": "DO use curly braces for all flow control structures.", @@ -484,21 +324,46 @@ "description": "Attach library doc comments to library directives.", "fixStatus": "hasFix" }, + { + "name": "depend_on_referenced_packages", + "description": "Depend on referenced packages.", + "fixStatus": "needsFix" + }, { "name": "deprecated_consistency", "description": "Missing deprecated annotation.", "fixStatus": "needsFix" }, + { + "name": "deprecated_member_use_from_same_package", + "description": "Avoid using deprecated elements from within the package in which they are declared.", + "fixStatus": "hasFix" + }, + { + "name": "diagnostic_describe_all_properties", + "description": "DO reference all public properties in debug methods.", + "fixStatus": "hasFix" + }, { "name": "directives_ordering", "description": "Adhere to Effective Dart Guide directives sorting conventions.", "fixStatus": "hasFix" }, + { + "name": "discarded_futures", + "description": "Don't invoke asynchronous functions in non-`async` blocks.", + "fixStatus": "hasFix" + }, { "name": "do_not_use_environment", "description": "Do not use environment declared variables.", "fixStatus": "noFix" }, + { + "name": "document_ignores", + "description": "Document ignore comments.", + "fixStatus": "needsFix" + }, { "name": "empty_catches", "description": "Avoid empty catch blocks.", @@ -509,6 +374,11 @@ "description": "Use `;` instead of `{}` for empty constructor bodies.", "fixStatus": "hasFix" }, + { + "name": "empty_statements", + "description": "Avoid empty statements.", + "fixStatus": "hasFix" + }, { "name": "enable_null_safety", "description": "Do use sound null safety.", @@ -534,6 +404,11 @@ "description": "Use Flutter TODO format: // TODO(username): message, https://URL-to-issue.", "fixStatus": "hasFix" }, + { + "name": "hash_and_equals", + "description": "Always override `hashCode` if overriding `==`.", + "fixStatus": "hasFix" + }, { "name": "implementation_imports", "description": "Don't import implementation files from another package.", @@ -544,6 +419,31 @@ "description": "Explicitly tear-off `call` methods when using an object as a Function.", "fixStatus": "hasFix" }, + { + "name": "implicit_reopen", + "description": "Don't implicitly reopen classes.", + "fixStatus": "hasFix" + }, + { + "name": "invalid_case_patterns", + "description": "Use case expressions that are valid in Dart 3.0.", + "fixStatus": "hasFix" + }, + { + "name": "invalid_runtime_check_with_js_interop_types", + "description": "Avoid runtime type tests with JS interop types where the result may not\n be platform-consistent.", + "fixStatus": "needsFix" + }, + { + "name": "invariant_booleans", + "description": "Conditions should not unconditionally evaluate to `true` or to `false`.", + "fixStatus": "noFix" + }, + { + "name": "iterable_contains_unrelated_type", + "description": "Invocation of `Iterable.contains` with references of unrelated types.", + "fixStatus": "noFix" + }, { "name": "join_return_with_assignment", "description": "Join return statement with assignment when possible.", @@ -579,21 +479,46 @@ "description": "Avoid lines longer than 80 characters.", "fixStatus": "noFix" }, + { + "name": "list_remove_unrelated_type", + "description": "Invocation of `remove` with references of unrelated types.", + "fixStatus": "noFix" + }, + { + "name": "literal_only_boolean_expressions", + "description": "Boolean expression composed only with literals.", + "fixStatus": "noFix" + }, { "name": "matching_super_parameters", "description": "Use matching super parameter names.", "fixStatus": "needsFix" }, + { + "name": "missing_code_block_language_in_doc_comment", + "description": "A code block is missing a specified language.", + "fixStatus": "needsEvaluation" + }, { "name": "missing_whitespace_between_adjacent_strings", "description": "Missing whitespace between adjacent strings.", "fixStatus": "needsFix" }, + { + "name": "no_adjacent_strings_in_list", + "description": "Don't use adjacent strings in list.", + "fixStatus": "needsFix" + }, { "name": "no_default_cases", "description": "No default cases.", "fixStatus": "needsFix" }, + { + "name": "no_duplicate_case_values", + "description": "Don't use more than one case with same value.", + "fixStatus": "hasFix" + }, { "name": "no_leading_underscores_for_library_prefixes", "description": "Avoid leading underscores for library prefixes.", @@ -609,11 +534,26 @@ "description": "Don't compare booleans to boolean literals.", "fixStatus": "hasFix" }, + { + "name": "no_logic_in_create_state", + "description": "Don't put any logic in createState.", + "fixStatus": "noFix" + }, { "name": "no_runtimeType_toString", - "description": "Avoid calling toString() on runtimeType.", + "description": "Avoid calling `toString()` on `runtimeType`.", "fixStatus": "noFix" }, + { + "name": "no_self_assignments", + "description": "Don't assign a variable to itself.", + "fixStatus": "needsEvaluation" + }, + { + "name": "no_wildcard_variable_uses", + "description": "Don't use wildcard parameters or variables.", + "fixStatus": "needsEvaluation" + }, { "name": "non_constant_identifier_names", "description": "Name non-constant identifiers using lowerCamelCase.", @@ -626,7 +566,7 @@ }, { "name": "null_check_on_nullable_type_parameter", - "description": "Don't use null check on a potentially nullable type parameter.", + "description": "Don't use `null` check on a potentially nullable type parameter.", "fixStatus": "hasFix" }, { @@ -659,6 +599,11 @@ "description": "Provide doc comments for all public APIs.", "fixStatus": "noFix" }, + { + "name": "package_names", + "description": "Use `lowercase_with_underscores` for package names.", + "fixStatus": "noFix" + }, { "name": "package_prefixed_library_names", "description": "Prefix library names with the package name and a dot-separated path.", @@ -696,22 +641,22 @@ }, { "name": "prefer_conditional_assignment", - "description": "Prefer using `??=` over testing for null.", + "description": "Prefer using `??=` over testing for `null`.", "fixStatus": "hasFix" }, { "name": "prefer_const_constructors", - "description": "Prefer const with constant constructors.", + "description": "Prefer `const` with constant constructors.", "fixStatus": "hasFix" }, { "name": "prefer_const_constructors_in_immutables", - "description": "Prefer declaring const constructors on `@immutable` classes.", + "description": "Prefer declaring `const` constructors on `@immutable` classes.", "fixStatus": "hasFix" }, { "name": "prefer_const_declarations", - "description": "Prefer const over final for declarations.", + "description": "Prefer `const` over `final` for declarations.", "fixStatus": "hasFix" }, { @@ -746,7 +691,7 @@ }, { "name": "prefer_final_fields", - "description": "Private field could be final.", + "description": "Private field could be `final`.", "fixStatus": "hasFix" }, { @@ -766,7 +711,7 @@ }, { "name": "prefer_for_elements_to_map_fromIterable", - "description": "Prefer 'for' elements when building maps from iterables.", + "description": "Prefer `for` elements when building maps from iterables.", "fixStatus": "hasFix" }, { @@ -791,7 +736,7 @@ }, { "name": "prefer_if_null_operators", - "description": "Prefer using if null operators.", + "description": "Prefer using `??` operators.", "fixStatus": "hasFix" }, { @@ -816,12 +761,12 @@ }, { "name": "prefer_is_empty", - "description": "Use `isEmpty` for Iterables and Maps.", + "description": "Use `isEmpty` for `Iterable`s and `Map`s.", "fixStatus": "hasFix" }, { "name": "prefer_is_not_empty", - "description": "Use `isNotEmpty` for Iterables and Maps.", + "description": "Use `isNotEmpty` for `Iterable`s and `Map`s.", "fixStatus": "hasFix" }, { @@ -831,7 +776,7 @@ }, { "name": "prefer_iterable_whereType", - "description": "Prefer to use whereType on iterable.", + "description": "Prefer to use `whereType` on iterable.", "fixStatus": "hasFix" }, { @@ -841,12 +786,17 @@ }, { "name": "prefer_null_aware_method_calls", - "description": "Prefer null aware method calls.", + "description": "Prefer `null`-aware method calls.", "fixStatus": "needsFix" }, { "name": "prefer_null_aware_operators", - "description": "Prefer using null aware operators.", + "description": "Prefer using `null`-aware operators.", + "fixStatus": "hasFix" + }, + { + "name": "prefer_relative_imports", + "description": "Prefer relative imports for files in `lib/`.", "fixStatus": "hasFix" }, { @@ -864,9 +814,14 @@ "description": "Prefer typing uninitialized variables and fields.", "fixStatus": "hasFix" }, + { + "name": "prefer_void_to_null", + "description": "Don't use the Null type, unless you are positive that you don't want void.", + "fixStatus": "hasFix" + }, { "name": "provide_deprecation_message", - "description": "Provide a deprecation message, via @Deprecated(\"message\").", + "description": "Provide a deprecation message, via `@Deprecated(\"message\")`.", "fixStatus": "noFix" }, { @@ -884,9 +839,14 @@ "description": "Use trailing commas for all parameter lists and argument lists.", "fixStatus": "hasFix" }, + { + "name": "secure_pubspec_urls", + "description": "Use secure urls in `pubspec.yaml`.", + "fixStatus": "noFix" + }, { "name": "sized_box_for_whitespace", - "description": "SizedBox for whitespace.", + "description": "`SizedBox` for whitespace.", "fixStatus": "hasFix" }, { @@ -896,7 +856,7 @@ }, { "name": "slash_for_doc_comments", - "description": "Prefer using /// for doc comments.", + "description": "Prefer using `///` for doc comments.", "fixStatus": "hasFix" }, { @@ -909,6 +869,11 @@ "description": "Sort constructor declarations before other members.", "fixStatus": "hasFix" }, + { + "name": "sort_pub_dependencies", + "description": "Sort pub dependencies alphabetically.", + "fixStatus": "needsFix" + }, { "name": "sort_unnamed_constructors_first", "description": "Sort unnamed constructor declarations first.", @@ -919,6 +884,16 @@ "description": "Place the `super` call last in a constructor initialization list.", "fixStatus": "noFix" }, + { + "name": "test_types_in_equals", + "description": "Test type of argument in `operator ==(Object other)`.", + "fixStatus": "noFix" + }, + { + "name": "throw_in_finally", + "description": "Avoid `throw` in `finally` block.", + "fixStatus": "noFix" + }, { "name": "tighten_type_of_initializing_formals", "description": "Tighten type of initializing formal.", @@ -945,10 +920,15 @@ "fixStatus": "hasFix" }, { - "name": "unnecessary_await_in_return", - "description": "Unnecessary await keyword in return.", + "name": "unintended_html_in_doc_comment", + "description": "Use of angle brackets in a doc comment is treated as HTML by Markdown.", "fixStatus": "needsFix" }, + { + "name": "unnecessary_await_in_return", + "description": "Unnecessary `await` keyword in return.", + "fixStatus": "hasFix" + }, { "name": "unnecessary_brace_in_string_interps", "description": "Avoid using braces in interpolation when not needed.", @@ -961,7 +941,7 @@ }, { "name": "unnecessary_const", - "description": "Avoid const keyword.", + "description": "Avoid `const` keyword.", "fixStatus": "hasFix" }, { @@ -1006,7 +986,7 @@ }, { "name": "unnecessary_null_aware_assignments", - "description": "Avoid null in null-aware assignment.", + "description": "Avoid `null` in `null`-aware assignment.", "fixStatus": "hasFix" }, { @@ -1016,12 +996,12 @@ }, { "name": "unnecessary_null_checks", - "description": "Unnecessary null checks.", + "description": "Unnecessary `null` checks.", "fixStatus": "hasFix" }, { "name": "unnecessary_null_in_if_null_operators", - "description": "Avoid using `null` in `if null` operators.", + "description": "Avoid using `null` in `??` operators.", "fixStatus": "hasFix" }, { @@ -1044,6 +1024,11 @@ "description": "Unnecessary raw string.", "fixStatus": "hasFix" }, + { + "name": "unnecessary_statements", + "description": "Avoid using unnecessary statements.", + "fixStatus": "noFix" + }, { "name": "unnecessary_string_escapes", "description": "Remove unnecessary backslashes in strings.", @@ -1061,7 +1046,7 @@ }, { "name": "unnecessary_to_list_in_spreads", - "description": "Unnecessary toList() in spreads.", + "description": "Unnecessary `toList()` in spreads.", "fixStatus": "hasFix" }, { @@ -1069,6 +1054,21 @@ "description": "Unreachable top-level members in executable libraries.", "fixStatus": "hasFix" }, + { + "name": "unrelated_type_equality_checks", + "description": "Equality operator `==` invocation with references of unrelated types.", + "fixStatus": "unregistered" + }, + { + "name": "unsafe_html", + "description": "Avoid unsafe HTML APIs.", + "fixStatus": "unregistered" + }, + { + "name": "use_build_context_synchronously", + "description": "Do not use `BuildContext` across asynchronous gaps.", + "fixStatus": "unregistered" + }, { "name": "use_colored_box", "description": "Use `ColoredBox`.", @@ -1096,7 +1096,7 @@ }, { "name": "use_if_null_to_convert_nulls_to_bools", - "description": "Use if-null operators to convert nulls to bools.", + "description": "Use `??` operators to convert `null`s to `bool`s.", "fixStatus": "needsFix" }, { @@ -1104,6 +1104,11 @@ "description": "Prefer intValue.isOdd/isEven instead of checking the result of % 2.", "fixStatus": "needsFix" }, + { + "name": "use_key_in_widget_constructors", + "description": "Use key in widget constructors.", + "fixStatus": "hasFix" + }, { "name": "use_late_for_private_fields_and_variables", "description": "Use late for private members with a non-nullable type.", @@ -1112,7 +1117,7 @@ { "name": "use_named_constants", "description": "Use predefined named constants.", - "fixStatus": "needsFix" + "fixStatus": "hasFix" }, { "name": "use_raw_strings", @@ -1154,9 +1159,14 @@ "description": "Start the name of the method with to/_to or as/_as if applicable.", "fixStatus": "noFix" }, + { + "name": "valid_regexps", + "description": "Use valid regular expression syntax.", + "fixStatus": "noFix" + }, { "name": "void_checks", - "description": "Don't assign to void.", + "description": "Don't assign to `void`.", "fixStatus": "noFix" } ] \ No newline at end of file From d82f9c305b4e71f9f7cca88c5306f2d88446a697 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 14 Aug 2024 10:21:02 -0700 Subject: [PATCH 79/90] add invalid_runtime_check_with_js_interop_types to the recommended lint set (dart-lang/lints#199) --- pkgs/lints/.github/workflows/validate.yml | 2 +- pkgs/lints/CHANGELOG.md | 4 +++- pkgs/lints/lib/recommended.yaml | 1 + pkgs/lints/pubspec.yaml | 2 +- pkgs/lints/rules.md | 2 ++ pkgs/lints/tool/rules.json | 16 +++++++++++++--- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 1b70e81e..3ae64df5 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [3.4, stable, beta] + sdk: [3.5, stable, beta] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index b77eb439..e37d3de6 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -2,9 +2,11 @@ - `recommended`: - added [unnecessary_library_name] (https://github.com/dart-lang/lints/issues/181) -- Updated the SDK lower-bound to 3.4. + - added [invalid_runtime_check_with_js_interop_types] (https://github.com/dart-lang/lints/issues/188) +- Updated the SDK lower-bound to 3.5. [unnecessary_library_name]: https://dart.dev/lints/unnecessary_library_name +[invalid_runtime_check_with_js_interop_types]: https://dart.dev/tools/linter-rules/invalid_runtime_check_with_js_interop_types ## 4.0.0 diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index bf0d9cd0..602ae5ba 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -25,6 +25,7 @@ linter: - empty_statements - exhaustive_cases - implementation_imports + - invalid_runtime_check_with_js_interop_types - library_prefixes - library_private_types_in_public_api - no_leading_underscores_for_library_prefixes diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index cbe926dd..7481937d 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -10,7 +10,7 @@ topics: - lints environment: - sdk: ^3.4.0 + sdk: ^3.5.0 # NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 1d6eb5d4..f48b389f 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -59,6 +59,8 @@ | [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | | [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | | [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | +| [`invalid_runtime_check_with_js_interop_types`](https://dart.dev/lints/invalid_runtime_check_with_js_interop_types) | Avoid runtime type tests with JS interop types where the result may not + be platform-consistent. | | | [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | | [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | | [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index 5a8d1ff1..3fac4a29 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -296,7 +296,7 @@ }, { "name": "comment_references", - "description": "Only reference in scope identifiers in doc comments.", + "description": "Only reference in-scope identifiers in doc comments.", "fixStatus": "hasFix" }, { @@ -531,7 +531,7 @@ }, { "name": "no_literal_bool_comparisons", - "description": "Don't compare booleans to boolean literals.", + "description": "Don't compare Boolean expressions to Boolean literals.", "fixStatus": "hasFix" }, { @@ -579,6 +579,11 @@ "description": "Omit type annotations for local variables.", "fixStatus": "hasFix" }, + { + "name": "omit_obvious_local_variable_types", + "description": "Omit obvious type annotations for local variables.", + "fixStatus": "hasFix" + }, { "name": "one_member_abstracts", "description": "Avoid defining a one-member abstract class when a simple function will do.", @@ -1086,7 +1091,7 @@ }, { "name": "use_full_hex_values_for_flutter_colors", - "description": "Prefer an 8-digit hexadecimal integer(0xFFFFFFFF) to instantiate Color.", + "description": "Prefer an 8-digit hexadecimal integer (for example, 0xFFFFFFFF) to instantiate a Color.", "fixStatus": "hasFix" }, { @@ -1159,6 +1164,11 @@ "description": "Start the name of the method with to/_to or as/_as if applicable.", "fixStatus": "noFix" }, + { + "name": "use_truncating_division", + "description": "Use truncating division.", + "fixStatus": "hasFix" + }, { "name": "valid_regexps", "description": "Use valid regular expression syntax.", From 1940026bc6e186e632280b38b04460e8337878e1 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 5 Sep 2024 08:59:17 -0700 Subject: [PATCH 80/90] Remove avoid_null_checks_in_equality_operators from recommended (dart-lang/lints#201) --- pkgs/lints/CHANGELOG.md | 2 ++ pkgs/lints/lib/recommended.yaml | 1 - pkgs/lints/rules.md | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index e37d3de6..5c81e603 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -3,10 +3,12 @@ - `recommended`: - added [unnecessary_library_name] (https://github.com/dart-lang/lints/issues/181) - added [invalid_runtime_check_with_js_interop_types] (https://github.com/dart-lang/lints/issues/188) + - removed [avoid_null_checks_in_equality_operators] (https://github.com/dart-lang/lints/issues/200) - Updated the SDK lower-bound to 3.5. [unnecessary_library_name]: https://dart.dev/lints/unnecessary_library_name [invalid_runtime_check_with_js_interop_types]: https://dart.dev/tools/linter-rules/invalid_runtime_check_with_js_interop_types +[avoid_null_checks_in_equality_operators]: https://dart.dev/tools/linter-rules/avoid_null_checks_in_equality_operators ## 4.0.0 diff --git a/pkgs/lints/lib/recommended.yaml b/pkgs/lints/lib/recommended.yaml index 602ae5ba..5b762ff7 100644 --- a/pkgs/lints/lib/recommended.yaml +++ b/pkgs/lints/lib/recommended.yaml @@ -14,7 +14,6 @@ linter: - annotate_overrides - avoid_function_literals_in_foreach_calls - avoid_init_to_null - - avoid_null_checks_in_equality_operators - avoid_renaming_method_parameters - avoid_return_types_on_setters - avoid_returning_null_for_void diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index f48b389f..7aba8449 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -48,7 +48,6 @@ | [`annotate_overrides`](https://dart.dev/lints/annotate_overrides) | Annotate overridden members. | ✅ | | [`avoid_function_literals_in_foreach_calls`](https://dart.dev/lints/avoid_function_literals_in_foreach_calls) | Avoid using `forEach` with a function literal. | ✅ | | [`avoid_init_to_null`](https://dart.dev/lints/avoid_init_to_null) | Don't explicitly initialize variables to `null`. | ✅ | -| [`avoid_null_checks_in_equality_operators`](https://dart.dev/lints/avoid_null_checks_in_equality_operators) | Don't check for `null` in custom `==` operators. | ✅ | | [`avoid_renaming_method_parameters`](https://dart.dev/lints/avoid_renaming_method_parameters) | Don't rename parameters of overridden methods. | ✅ | | [`avoid_return_types_on_setters`](https://dart.dev/lints/avoid_return_types_on_setters) | Avoid return types on setters. | ✅ | | [`avoid_returning_null_for_void`](https://dart.dev/lints/avoid_returning_null_for_void) | Avoid returning `null` for `void`. | ✅ | From c369399948fec0a7776fbac17cb66eea44894f3a Mon Sep 17 00:00:00 2001 From: Lenz Paul <34327253+lenzpaul@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:44:08 -0400 Subject: [PATCH 81/90] Fixes formatting error in the rules.md table (dart-lang/lints#206) * Fixes formatting error in the rules.md table The content after the rule `invalid_runtime_check_with_js_interop_types` was not formatted in a table due to syntax error * Fix multiline descriptions formatting in markdown generation - Updated the `_createRuleTableRow` function to properly handle multiline descriptions by replacing line breaks with spaces - Trimmed leading/trailing whitespace and reduced consecutive spaces to a single space - This ensures that the generated markdown table rows in rules.md are correctly formatted, preventing description content from breaking across lines or having inconsistent spacing --- pkgs/lints/rules.md | 3 +-- pkgs/lints/tool/gen_docs.dart | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 7aba8449..6aac54eb 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -58,8 +58,7 @@ | [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. | ✅ | | [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. | ✅ | | [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | | -| [`invalid_runtime_check_with_js_interop_types`](https://dart.dev/lints/invalid_runtime_check_with_js_interop_types) | Avoid runtime type tests with JS interop types where the result may not - be platform-consistent. | | +| [`invalid_runtime_check_with_js_interop_types`](https://dart.dev/lints/invalid_runtime_check_with_js_interop_types) | Avoid runtime type tests with JS interop types where the result may not be platform-consistent. | | | [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | | | [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | | | [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. | ✅ | diff --git a/pkgs/lints/tool/gen_docs.dart b/pkgs/lints/tool/gen_docs.dart index d3a5732d..2ecea386 100644 --- a/pkgs/lints/tool/gen_docs.dart +++ b/pkgs/lints/tool/gen_docs.dart @@ -171,7 +171,10 @@ String _createRuleTableRow( if (ruleMeta == null) { stderr.writeln("WARNING: Missing rule information for rule: $rule"); } - final description = ruleMeta?['description'] ?? ''; + final description = (ruleMeta?['description'] ?? '') + .replaceAll('\n', ' ') + .replaceAll(RegExp(r'\s+'), ' ') + .trim(); final hasFix = ruleMeta?['fixStatus'] == 'hasFix'; final fixDesc = hasFix ? '✅' : ''; From 532cbe4612828b0c6bf561427a84d68f70312acc Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 25 Sep 2024 10:39:42 -0700 Subject: [PATCH 82/90] rev to 5.0.0 in preparation for publishing (dart-lang/lints#210) --- pkgs/lints/CHANGELOG.md | 6 +++--- pkgs/lints/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 5c81e603..9f1bd144 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,13 +1,13 @@ -## 5.0.0-wip +## 5.0.0 - `recommended`: - - added [unnecessary_library_name] (https://github.com/dart-lang/lints/issues/181) - added [invalid_runtime_check_with_js_interop_types] (https://github.com/dart-lang/lints/issues/188) + - added [unnecessary_library_name] (https://github.com/dart-lang/lints/issues/181) - removed [avoid_null_checks_in_equality_operators] (https://github.com/dart-lang/lints/issues/200) - Updated the SDK lower-bound to 3.5. -[unnecessary_library_name]: https://dart.dev/lints/unnecessary_library_name [invalid_runtime_check_with_js_interop_types]: https://dart.dev/tools/linter-rules/invalid_runtime_check_with_js_interop_types +[unnecessary_library_name]: https://dart.dev/lints/unnecessary_library_name [avoid_null_checks_in_equality_operators]: https://dart.dev/tools/linter-rules/avoid_null_checks_in_equality_operators ## 4.0.0 diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 7481937d..3a45c87a 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 5.0.0-wip +version: 5.0.0 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. From 7f2bf15b6966bace9cf9c44fcaba90125e8d57f8 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 25 Sep 2024 12:50:58 -0700 Subject: [PATCH 83/90] add unintended_html_in_doc_comment; rev to 5.1.0 (dart-lang/lints#211) * add unintended_html_in_doc_comment; rev to 5.1.0 * use 3.6 beta --- pkgs/lints/.github/workflows/publish.yaml | 2 ++ pkgs/lints/.github/workflows/validate.yml | 2 +- pkgs/lints/CHANGELOG.md | 8 ++++++++ pkgs/lints/lib/core.yaml | 1 + pkgs/lints/pubspec.yaml | 4 ++-- pkgs/lints/rules.md | 1 + pkgs/lints/tool/rules.json | 17 +++++++++++------ 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/pkgs/lints/.github/workflows/publish.yaml b/pkgs/lints/.github/workflows/publish.yaml index f4163209..005c3ab8 100644 --- a/pkgs/lints/.github/workflows/publish.yaml +++ b/pkgs/lints/.github/workflows/publish.yaml @@ -12,3 +12,5 @@ jobs: publish: if: ${{ github.repository_owner == 'dart-lang' }} uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main + with: + sdk: beta diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 3ae64df5..3ad53160 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [3.5, stable, beta] + sdk: [beta] # todo: re-add stable steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 9f1bd144..3012455d 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,3 +1,11 @@ +## 5.1.0 + +- `core`: + - added [unintended_html_in_doc_comment] (https://github.com/dart-lang/lints/issues/192) +- Updated the SDK lower-bound to 3.6. + +[unintended_html_in_doc_comment]: https://dart.dev/lints/unintended_html_in_doc_comment + ## 5.0.0 - `recommended`: diff --git a/pkgs/lints/lib/core.yaml b/pkgs/lints/lib/core.yaml index 1cfe995f..ca8a8ca1 100644 --- a/pkgs/lints/lib/core.yaml +++ b/pkgs/lints/lib/core.yaml @@ -34,6 +34,7 @@ linter: - provide_deprecation_message - secure_pubspec_urls - type_literal_in_constant_pattern + - unintended_html_in_doc_comment - unnecessary_overrides - unrelated_type_equality_checks - use_string_in_part_of_directives diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 3a45c87a..3a0b6df4 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 5.0.0 +version: 5.1.0 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. @@ -10,7 +10,7 @@ topics: - lints environment: - sdk: ^3.5.0 + sdk: ^3.6.0-0 # NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: diff --git a/pkgs/lints/rules.md b/pkgs/lints/rules.md index 6aac54eb..e4dd15e4 100644 --- a/pkgs/lints/rules.md +++ b/pkgs/lints/rules.md @@ -33,6 +33,7 @@ | [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via `@Deprecated("message")`. | | | [`secure_pubspec_urls`](https://dart.dev/lints/secure_pubspec_urls) | Use secure urls in `pubspec.yaml`. | | | [`type_literal_in_constant_pattern`](https://dart.dev/lints/type_literal_in_constant_pattern) | Don't use constant patterns with type literals. | ✅ | +| [`unintended_html_in_doc_comment`](https://dart.dev/lints/unintended_html_in_doc_comment) | Use of angle brackets in a doc comment is treated as HTML by Markdown. | | | [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. | ✅ | | [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | | | [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. | ✅ | diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index 3fac4a29..d853c158 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -62,7 +62,7 @@ { "name": "avoid_catching_errors", "description": "Don't explicitly catch `Error` or types that implement it.", - "fixStatus": "unregistered" + "fixStatus": "noFix" }, { "name": "avoid_classes_with_only_static_members", @@ -432,7 +432,7 @@ { "name": "invalid_runtime_check_with_js_interop_types", "description": "Avoid runtime type tests with JS interop types where the result may not\n be platform-consistent.", - "fixStatus": "needsFix" + "fixStatus": "needsEvaluation" }, { "name": "invariant_booleans", @@ -531,7 +531,7 @@ }, { "name": "no_literal_bool_comparisons", - "description": "Don't compare Boolean expressions to Boolean literals.", + "description": "Don't compare boolean expressions to boolean literals.", "fixStatus": "hasFix" }, { @@ -884,6 +884,11 @@ "description": "Sort unnamed constructor declarations first.", "fixStatus": "hasFix" }, + { + "name": "specify_nonobvious_local_variable_types", + "description": "Specify non-obvious type annotations for local variables.", + "fixStatus": "hasFix" + }, { "name": "super_goes_last", "description": "Place the `super` call last in a constructor initialization list.", @@ -1062,17 +1067,17 @@ { "name": "unrelated_type_equality_checks", "description": "Equality operator `==` invocation with references of unrelated types.", - "fixStatus": "unregistered" + "fixStatus": "needsEvaluation" }, { "name": "unsafe_html", "description": "Avoid unsafe HTML APIs.", - "fixStatus": "unregistered" + "fixStatus": "noFix" }, { "name": "use_build_context_synchronously", "description": "Do not use `BuildContext` across asynchronous gaps.", - "fixStatus": "unregistered" + "fixStatus": "noFix" }, { "name": "use_colored_box", From 4a0b9550f8db45ad3b0146419194130bbba9d40c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:54:16 +0000 Subject: [PATCH 84/90] Bump actions/checkout from 4.1.7 to 4.2.0 (dart-lang/lints#212) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
Release notes

Sourced from actions/checkout's releases.

v4.2.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.7...v4.2.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.2.0

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.7&new-version=4.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 3ad53160..5f60386c 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [beta] # todo: re-add stable steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From dfcdd2a7432850ab60431e34a4fc614c8e9c4781 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 21 Oct 2024 09:47:40 +0200 Subject: [PATCH 85/90] Update README.md before archiving (dart-lang/lints#214) --- pkgs/lints/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 751a72b5..90f5a6a6 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,3 +1,6 @@ +> [!IMPORTANT] +> This repo has moved to https://github.com/dart-lang/core/tree/main/pkgs/lints + [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![package publisher](https://img.shields.io/pub/publisher/lints.svg)](https://pub.dev/packages/lints/publisher) From e62ca1df25bc0aa3e7359bbaa46d702857021dcb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:16:50 +0000 Subject: [PATCH 86/90] Bump actions/checkout from 4.2.0 to 4.2.2 (dart-lang/lints#215) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.2.
Release notes

Sourced from actions/checkout's releases.

v4.2.2

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.2.1...v4.2.2

v4.2.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.2.0...v4.2.1

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.2.2

v4.2.1

v4.2.0

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.2.0&new-version=4.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 5f60386c..33f12212 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: sdk: [beta] # todo: re-add stable steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From 49591a2afd5c6681495f9a1b5b76209ab2b043bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:00:18 +0000 Subject: [PATCH 87/90] Bump dart-lang/setup-dart from 1.6.5 to 1.7.0 (dart-lang/lints#217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.5 to 1.7.0.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.7.0

What's Changed

  • Install a Flutter SDK in the publish workflow allowing for publication of flutter packages.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.7.0

v1.6.5

dart-lang/lints#118: dart-lang/setup-dartdart-lang/lints#118

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.5&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/lints/.github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/lints/.github/workflows/validate.yml b/pkgs/lints/.github/workflows/validate.yml index 33f12212..bb82fbc4 100644 --- a/pkgs/lints/.github/workflows/validate.yml +++ b/pkgs/lints/.github/workflows/validate.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} From 16a704722531e2e5b90ce6b8b05dce3fa7ea2456 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 3 Dec 2024 10:27:27 -0800 Subject: [PATCH 88/90] Revert "Update README.md before archiving (dart-lang/lints#214)" (dart-lang/lints#219) This reverts commit dfcdd2a7432850ab60431e34a4fc614c8e9c4781. --- pkgs/lints/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkgs/lints/README.md b/pkgs/lints/README.md index 90f5a6a6..751a72b5 100644 --- a/pkgs/lints/README.md +++ b/pkgs/lints/README.md @@ -1,6 +1,3 @@ -> [!IMPORTANT] -> This repo has moved to https://github.com/dart-lang/core/tree/main/pkgs/lints - [![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain) [![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints) [![package publisher](https://img.shields.io/pub/publisher/lints.svg)](https://pub.dev/packages/lints/publisher) From 2e5c71dba46c23655efa572bb1848b53c6e216f5 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 11 Dec 2024 14:09:29 -0800 Subject: [PATCH 89/90] update the sdk lower bound to the current stable (dart-lang/lints#220) --- pkgs/lints/.github/workflows/publish.yaml | 2 -- pkgs/lints/CHANGELOG.md | 6 +++++- pkgs/lints/pubspec.yaml | 4 ++-- pkgs/lints/tool/rules.json | 22 +++++++++++++++++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pkgs/lints/.github/workflows/publish.yaml b/pkgs/lints/.github/workflows/publish.yaml index 005c3ab8..f4163209 100644 --- a/pkgs/lints/.github/workflows/publish.yaml +++ b/pkgs/lints/.github/workflows/publish.yaml @@ -12,5 +12,3 @@ jobs: publish: if: ${{ github.repository_owner == 'dart-lang' }} uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main - with: - sdk: beta diff --git a/pkgs/lints/CHANGELOG.md b/pkgs/lints/CHANGELOG.md index 3012455d..be12b329 100644 --- a/pkgs/lints/CHANGELOG.md +++ b/pkgs/lints/CHANGELOG.md @@ -1,8 +1,12 @@ +## 5.1.1 + +- Updated the SDK lower bound to 3.6. + ## 5.1.0 - `core`: - added [unintended_html_in_doc_comment] (https://github.com/dart-lang/lints/issues/192) -- Updated the SDK lower-bound to 3.6. +- Updated the SDK lower bound to 3.6 (dev). [unintended_html_in_doc_comment]: https://dart.dev/lints/unintended_html_in_doc_comment diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index 3a0b6df4..e157af3d 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -1,5 +1,5 @@ name: lints -version: 5.1.0 +version: 5.1.1 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. @@ -10,7 +10,7 @@ topics: - lints environment: - sdk: ^3.6.0-0 + sdk: ^3.6.0 # NOTE: Code is not allowed in this package - do not add dependencies. # dependencies: diff --git a/pkgs/lints/tool/rules.json b/pkgs/lints/tool/rules.json index d853c158..5dff4a90 100644 --- a/pkgs/lints/tool/rules.json +++ b/pkgs/lints/tool/rules.json @@ -109,6 +109,11 @@ "description": "Avoid using `forEach` with a function literal.", "fixStatus": "hasFix" }, + { + "name": "avoid_futureor_void", + "description": "Avoid using 'FutureOr' as the type of a result.", + "fixStatus": "noFix" + }, { "name": "avoid_implementing_value_types", "description": "Don't implement classes that override `==`.", @@ -584,6 +589,11 @@ "description": "Omit obvious type annotations for local variables.", "fixStatus": "hasFix" }, + { + "name": "omit_obvious_property_types", + "description": "Omit obvious type annotations for top-level and static variables.", + "fixStatus": "hasFix" + }, { "name": "one_member_abstracts", "description": "Avoid defining a one-member abstract class when a simple function will do.", @@ -889,6 +899,11 @@ "description": "Specify non-obvious type annotations for local variables.", "fixStatus": "hasFix" }, + { + "name": "specify_nonobvious_property_types", + "description": "Specify non-obvious type annotations for top-level and static variables.", + "fixStatus": "hasFix" + }, { "name": "super_goes_last", "description": "Place the `super` call last in a constructor initialization list.", @@ -1074,6 +1089,11 @@ "description": "Avoid unsafe HTML APIs.", "fixStatus": "noFix" }, + { + "name": "unsafe_variance", + "description": "Unsafe type: Has a type variable in a non-covariant position.", + "fixStatus": "noFix" + }, { "name": "use_build_context_synchronously", "description": "Do not use `BuildContext` across asynchronous gaps.", @@ -1082,7 +1102,7 @@ { "name": "use_colored_box", "description": "Use `ColoredBox`.", - "fixStatus": "needsFix" + "fixStatus": "hasFix" }, { "name": "use_decorated_box", From bcff5ce3e1546029ffb4d93a850fc2fde6e8623d Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 20 Dec 2024 13:28:09 +0100 Subject: [PATCH 90/90] Add issue template and other fixes --- .github/ISSUE_TEMPLATE/lints.md | 5 +++++ pkgs/lints/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/lints.md diff --git a/.github/ISSUE_TEMPLATE/lints.md b/.github/ISSUE_TEMPLATE/lints.md new file mode 100644 index 00000000..df93601f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lints.md @@ -0,0 +1,5 @@ +--- +name: "package:lints" +about: "Create a bug or file a feature request against package:lints." +labels: "package:lints" +--- \ No newline at end of file diff --git a/pkgs/lints/pubspec.yaml b/pkgs/lints/pubspec.yaml index e157af3d..954d5c73 100644 --- a/pkgs/lints/pubspec.yaml +++ b/pkgs/lints/pubspec.yaml @@ -3,7 +3,7 @@ version: 5.1.1 description: > Official Dart lint rules. Defines the 'core' and 'recommended' set of lints suggested by the Dart team. -repository: https://github.com/dart-lang/lints +repository: https://github.com/dart-lang/core/tree/main/pkgs/lints topics: - analysis