From 38973deedb07ef0dfda7e13d5a29306dac1e435e Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Wed, 14 Jun 2023 11:13:22 -0500 Subject: [PATCH] Add a file listing all released, non-removed linter rules (#4990) Despite personally not fully understanding why, https://dart-lang.github.io/linter/lints/options/options.html appears to be a relatively(?) popular resource. Some developer's linter workflows include copying all rules, then disabling until they're happy. I believe at least some developers on the Flutter team have done this before. To still support that workflow and provide a location to redirect to from https://dart-lang.github.io/linter/lints/options/options.html, this PR introduces a similar file on dart.dev. There is a difference though in that it only lists (non-removed) linter rules that have been released in the latest stable SDK. --- src/_includes/linter-rules-section.md | 2 +- src/tools/linter-rules/all.md | 23 +++++++++++++++++++ .../index.md} | 0 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/tools/linter-rules/all.md rename src/tools/{linter-rules.md => linter-rules/index.md} (100%) diff --git a/src/_includes/linter-rules-section.md b/src/_includes/linter-rules-section.md index aa23e7e8cc..f850ff15c0 100644 --- a/src/_includes/linter-rules-section.md +++ b/src/_includes/linter-rules-section.md @@ -74,7 +74,7 @@ _This rule is available as of Dart {{lint.sinceDartSdk}}._ To enable the `{{lint.name}}` rule, add `{{lint.name}}` under **linter > rules** in your -[`analysis_options.yaml`](https://dart.dev/guides/language/analysis-options) +[`analysis_options.yaml`](/guides/language/analysis-options) file: ```yaml diff --git a/src/tools/linter-rules/all.md b/src/tools/linter-rules/all.md new file mode 100644 index 0000000000..4f31ff928d --- /dev/null +++ b/src/tools/linter-rules/all.md @@ -0,0 +1,23 @@ +--- +title: All linter rules +description: Auto-generated configuration enabling all linter rules. +toc: false +--- + +The following is an auto-generated list of all linter rules +available in the Dart SDK as of version `{{site.data.pkg-vers.SDK.vers}}`. +Add them to your +[`analysis_options.yaml`](/guides/language/analysis-options) file +and adjust as you see fit. + + +```yaml +linter: + rules: + {% for lint in site.data.linter_rules %} + {%- if lint.sinceDartSdk != "Unreleased" and lint.state != "removed" -%} + - {{lint.name}} + {% endif -%} + {% endfor -%} +``` +
analysis_options.yaml
diff --git a/src/tools/linter-rules.md b/src/tools/linter-rules/index.md similarity index 100% rename from src/tools/linter-rules.md rename to src/tools/linter-rules/index.md