Skip to content

Commit

Permalink
Add a file listing all released, non-removed linter rules (#4990)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
parlough authored Jun 14, 2023
1 parent 6c22baf commit 38973de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_includes/linter-rules-section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions src/tools/linter-rules/all.md
Original file line number Diff line number Diff line change
@@ -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.

<?code-excerpt ?>
```yaml
linter:
rules:
{% for lint in site.data.linter_rules %}
{%- if lint.sinceDartSdk != "Unreleased" and lint.state != "removed" -%}
- {{lint.name}}
{% endif -%}
{% endfor -%}
```
<div class="prettify-filename">analysis_options.yaml</div>
File renamed without changes.

0 comments on commit 38973de

Please sign in to comment.