Skip to content

Commit

Permalink
deploy: 9a070d2
Browse files Browse the repository at this point in the history
  • Loading branch information
pq committed Jul 20, 2023
1 parent 50b6143 commit 47c3c2f
Show file tree
Hide file tree
Showing 229 changed files with 1,586 additions and 13,401 deletions.
63 changes: 7 additions & 56 deletions lints/always_declare_return_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,16 @@
<body>
<div class="wrapper">
<header>
<h1>always_declare_return_types</h1>
<p>Group: style</p>
<p>Maturity: stable</p>
<div class="tooltip">
<p>Dart SDK: >= 2.0.0</p>
<span class="tooltip-content">Since info is static, may be stale</span>
</div>
<a class="style-type" href="https://medium.com/dartlang/quick-fixes-for-analysis-issues-c10df084971a"><!--suppress HtmlUnknownTarget --><img alt="has-fix" src="has-fix.svg"></a>
<ul>
<li><a href="index.html">View all <strong>Lint Rules</strong></a></li>
<li><a href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></li>
</ul>
<p><a class="overflow-link" href="index.html">View all <strong>Lint Rules</strong></a></p>
<p><a class="overflow-link" href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></p>
<a href="https://dart.dev/lints/always_declare_return_types"><h1>always_declare_return_types</h1></a>
</header>
<section>

<p><strong>DO</strong> declare method return types.</p>
<p>When declaring a method or function <em>always</em> specify a return type.
Declaring return types for functions helps improve your codebase by allowing the
analyzer to more adequately check your code for errors that could occur during
runtime.</p>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">main() { }

_bar() =&gt; _Foo();

class _Foo {
_foo() =&gt; 42;
}
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">void main() { }

_Foo _bar() =&gt; _Foo();

class _Foo {
int _foo() =&gt; 42;
}

typedef predicate = bool Function(Object o);
</code></pre>


<h2>Usage</h2>
<p>To enable the <code>always_declare_return_types</code> lint,
add <code>always_declare_return_types</code> under <strong>linter &gt; rules</strong> in your
<a href="https://dart.dev/guides/language/analysis-options"><code>analysis_options.yaml</code></a>
file:</p>
<pre><code class="language-yaml">linter:
rules:
- always_declare_return_types
</code></pre>

<h2>Lint documentation has moved!</h2>
<p>
Find up-to-date documentation for the
<code>always_declare_return_types</code> linter rule at
<a href="https://dart.dev/lints/always_declare_return_types">https://dart.dev/lints/always_declare_return_types</a>.
</p>
</section>
</div>
<footer>
<p>Maintained by the <a href="https://dart.dev/">Dart Team</a></p>
<p>Visit us on <a href="https://github.com/dart-lang/linter">GitHub</a></p>
</footer>
</body>
</html>
67 changes: 7 additions & 60 deletions lints/always_put_control_body_on_new_line.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,69 +14,16 @@
<body>
<div class="wrapper">
<header>
<h1>always_put_control_body_on_new_line</h1>
<p>Group: style</p>
<p>Maturity: stable</p>
<div class="tooltip">
<p>Dart SDK: >= 2.0.0</p>
<span class="tooltip-content">Since info is static, may be stale</span>
</div>
<a class="style-type" href="https://medium.com/dartlang/quick-fixes-for-analysis-issues-c10df084971a"><!--suppress HtmlUnknownTarget --><img alt="has-fix" src="has-fix.svg"></a>
<ul>
<li><a href="index.html">View all <strong>Lint Rules</strong></a></li>
<li><a href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></li>
</ul>
<p><a class="overflow-link" href="index.html">View all <strong>Lint Rules</strong></a></p>
<p><a class="overflow-link" href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></p>
<a href="https://dart.dev/lints/always_put_control_body_on_new_line"><h1>always_put_control_body_on_new_line</h1></a>
</header>
<section>

<p>From the <a href="https://flutter.dev/style-guide/">style guide for the flutter repo</a>:</p>
<p><strong>DO</strong> separate the control structure expression from its statement.</p>
<p>Don't put the statement part of an <code>if</code>, <code>for</code>, <code>while</code>, <code>do</code> on the same line
as the expression, even if it is short. Doing so makes it unclear that there
is relevant code there. This is especially important for early returns.</p>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">if (notReady) return;

if (notReady)
return;
else print('ok')

while (condition) i += 1;
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">if (notReady)
return;

if (notReady)
return;
else
print('ok')

while (condition)
i += 1;
</code></pre>
<p>Note that this rule can conflict with the
<a href="https://dart.dev/tools/dart-format">Dart formatter</a>, and should not be enabled
when the Dart formatter is used.</p>


<h2>Usage</h2>
<p>To enable the <code>always_put_control_body_on_new_line</code> lint,
add <code>always_put_control_body_on_new_line</code> under <strong>linter &gt; rules</strong> in your
<a href="https://dart.dev/guides/language/analysis-options"><code>analysis_options.yaml</code></a>
file:</p>
<pre><code class="language-yaml">linter:
rules:
- always_put_control_body_on_new_line
</code></pre>

<h2>Lint documentation has moved!</h2>
<p>
Find up-to-date documentation for the
<code>always_put_control_body_on_new_line</code> linter rule at
<a href="https://dart.dev/lints/always_put_control_body_on_new_line">https://dart.dev/lints/always_put_control_body_on_new_line</a>.
</p>
</section>
</div>
<footer>
<p>Maintained by the <a href="https://dart.dev/">Dart Team</a></p>
<p>Visit us on <a href="https://github.com/dart-lang/linter">GitHub</a></p>
</footer>
</body>
</html>
51 changes: 7 additions & 44 deletions lints/always_put_required_named_parameters_first.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,16 @@
<body>
<div class="wrapper">
<header>
<h1>always_put_required_named_parameters_first</h1>
<p>Group: style</p>
<p>Maturity: stable</p>
<div class="tooltip">
<p>Dart SDK: >= 2.0.0</p>
<span class="tooltip-content">Since info is static, may be stale</span>
</div>
<a class="style-type" href="https://medium.com/dartlang/quick-fixes-for-analysis-issues-c10df084971a"><!--suppress HtmlUnknownTarget --><img alt="has-fix" src="has-fix.svg"></a>
<ul>
<li><a href="index.html">View all <strong>Lint Rules</strong></a></li>
<li><a href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></li>
</ul>
<p><a class="overflow-link" href="index.html">View all <strong>Lint Rules</strong></a></p>
<p><a class="overflow-link" href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></p>
<a href="https://dart.dev/lints/always_put_required_named_parameters_first"><h1>always_put_required_named_parameters_first</h1></a>
</header>
<section>

<p><strong>DO</strong> specify <code>required</code> on named parameter before other named parameters.</p>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">m({b, c, required a}) ;
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">m({required a, b, c}) ;
</code></pre>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">m({b, c, @required a}) ;
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">m({@required a, b, c}) ;
</code></pre>


<h2>Usage</h2>
<p>To enable the <code>always_put_required_named_parameters_first</code> lint,
add <code>always_put_required_named_parameters_first</code> under <strong>linter &gt; rules</strong> in your
<a href="https://dart.dev/guides/language/analysis-options"><code>analysis_options.yaml</code></a>
file:</p>
<pre><code class="language-yaml">linter:
rules:
- always_put_required_named_parameters_first
</code></pre>

<h2>Lint documentation has moved!</h2>
<p>
Find up-to-date documentation for the
<code>always_put_required_named_parameters_first</code> linter rule at
<a href="https://dart.dev/lints/always_put_required_named_parameters_first">https://dart.dev/lints/always_put_required_named_parameters_first</a>.
</p>
</section>
</div>
<footer>
<p>Maintained by the <a href="https://dart.dev/">Dart Team</a></p>
<p>Visit us on <a href="https://github.com/dart-lang/linter">GitHub</a></p>
</footer>
</body>
</html>
55 changes: 7 additions & 48 deletions lints/always_require_non_null_named_parameters.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,16 @@
<body>
<div class="wrapper">
<header>
<h1>always_require_non_null_named_parameters</h1>
<p>Group: style</p>
<p>Maturity: <span style="color:orangered;font-weight:bold;" >deprecated</span></p>
<div class="tooltip">
<p>Dart SDK: >= 2.0.0</p>
<span class="tooltip-content">Since info is static, may be stale</span>
</div>
<a class="style-type" href="https://medium.com/dartlang/quick-fixes-for-analysis-issues-c10df084971a"><!--suppress HtmlUnknownTarget --><img alt="has-fix" src="has-fix.svg"></a>
<ul>
<li><a href="index.html">View all <strong>Lint Rules</strong></a></li>
<li><a href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></li>
</ul>
<p><a class="overflow-link" href="index.html">View all <strong>Lint Rules</strong></a></p>
<p><a class="overflow-link" href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></p>
<a href="https://dart.dev/lints/always_require_non_null_named_parameters"><h1>always_require_non_null_named_parameters</h1></a>
</header>
<section>

<p><strong>DO</strong> specify <code>@required</code> on named parameters without a default value on which
an <code>assert(param != null)</code> is done.</p>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">m1({a}) {
assert(a != null);
}
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">m1({@required a}) {
assert(a != null);
}

m2({a: 1}) {
assert(a != null);
}
</code></pre>
<p>NOTE: Only asserts at the start of the bodies will be taken into account.</p>


<h2>Usage</h2>
<p>To enable the <code>always_require_non_null_named_parameters</code> lint,
add <code>always_require_non_null_named_parameters</code> under <strong>linter &gt; rules</strong> in your
<a href="https://dart.dev/guides/language/analysis-options"><code>analysis_options.yaml</code></a>
file:</p>
<pre><code class="language-yaml">linter:
rules:
- always_require_non_null_named_parameters
</code></pre>

<h2>Lint documentation has moved!</h2>
<p>
Find up-to-date documentation for the
<code>always_require_non_null_named_parameters</code> linter rule at
<a href="https://dart.dev/lints/always_require_non_null_named_parameters">https://dart.dev/lints/always_require_non_null_named_parameters</a>.
</p>
</section>
</div>
<footer>
<p>Maintained by the <a href="https://dart.dev/">Dart Team</a></p>
<p>Visit us on <a href="https://github.com/dart-lang/linter">GitHub</a></p>
</footer>
</body>
</html>
72 changes: 6 additions & 66 deletions lints/always_specify_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,16 @@
<body>
<div class="wrapper">
<header>
<h1>always_specify_types</h1>
<p>Group: style</p>
<p>Maturity: stable</p>
<div class="tooltip">
<p>Dart SDK: >= 2.0.0</p>
<span class="tooltip-content">Since info is static, may be stale</span>
</div>
<a class="style-type" href="https://medium.com/dartlang/quick-fixes-for-analysis-issues-c10df084971a"><!--suppress HtmlUnknownTarget --><img alt="has-fix" src="has-fix.svg"></a>
<ul>
<li><a href="index.html">View all <strong>Lint Rules</strong></a></li>
<li><a href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></li>
</ul>
<p><a class="overflow-link" href="index.html">View all <strong>Lint Rules</strong></a></p>
<p><a class="overflow-link" href="https://dart.dev/guides/language/analysis-options#enabling-linter-rules">Using the <strong>Linter</strong></a></p>
<a href="https://dart.dev/lints/always_specify_types"><h1>always_specify_types</h1></a>
</header>
<section>

<p>From the <a href="https://flutter.dev/style-guide/">style guide for the flutter repo</a>:</p>
<p><strong>DO</strong> specify type annotations.</p>
<p>Avoid <code>var</code> when specifying that a type is unknown and short-hands that elide
type annotations. Use <code>dynamic</code> if you are being explicit that the type is
unknown. Use <code>Object</code> if you are being explicit that you want an object that
implements <code>==</code> and <code>hashCode</code>.</p>
<p><strong>BAD:</strong></p>
<pre><code class="language-dart">var foo = 10;
final bar = Bar();
const quux = 20;
</code></pre>
<p><strong>GOOD:</strong></p>
<pre><code class="language-dart">int foo = 10;
final Bar bar = Bar();
String baz = 'hello';
const int quux = 20;
</code></pre>
<p>NOTE: Using the the <code>@optionalTypeArgs</code> annotation in the <code>meta</code> package, API
authors can special-case type variables whose type needs to by dynamic but whose
declaration should be treated as optional. For example, suppose you have a
<code>Key</code> object whose type parameter you'd like to treat as optional. Using the
<code>@optionalTypeArgs</code> would look like this:</p>
<pre><code class="language-dart">import 'package:meta/meta.dart';

@optionalTypeArgs
class Key&lt;T&gt; {
...
}

main() {
Key s = Key(); // OK!
}
</code></pre>

<h2>Lint documentation has moved!</h2>
<p>
Incompatible with: <!--suppress HtmlUnknownTarget --><a href = "avoid_types_on_closure_parameters.html" >avoid_types_on_closure_parameters</a>, <a href = "omit_local_variable_types.html" >omit_local_variable_types</a>.
</p>

<h2>Usage</h2>
<p>To enable the <code>always_specify_types</code> lint,
add <code>always_specify_types</code> under <strong>linter &gt; rules</strong> in your
<a href="https://dart.dev/guides/language/analysis-options"><code>analysis_options.yaml</code></a>
file:</p>
<pre><code class="language-yaml">linter:
rules:
- always_specify_types
</code></pre>

Find up-to-date documentation for the
<code>always_specify_types</code> linter rule at
<a href="https://dart.dev/lints/always_specify_types">https://dart.dev/lints/always_specify_types</a>.
</p>
</section>
</div>
<footer>
<p>Maintained by the <a href="https://dart.dev/">Dart Team</a></p>
<p>Visit us on <a href="https://github.com/dart-lang/linter">GitHub</a></p>
</footer>
</body>
</html>
Loading

0 comments on commit 47c3c2f

Please sign in to comment.