-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e8f522
commit b17875f
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 1.0.0-dev.0 | ||
|
||
* Initial pre-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright 2021, The Flutter Authors. All rights reserved. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[![pub package](https://img.shields.io/pub/v/flutter_lints.svg)](https://pub.dev/packages/flutter_lints) | ||
|
||
This package contains a recommended set of lints for [Flutter] apps, packages, | ||
and plugins to encourage good coding practices. | ||
|
||
Lints are surfaced by the [dart analyzer], which statically checks dart code. | ||
[Dart-enabled IDEs] typically present the issues identified by the analyzer in | ||
their UI. Alternatively, the analyzer can be invoked manually by running | ||
`flutter analyze`. | ||
|
||
This package is built on top of Dart's `recommended.yaml` set of lints from | ||
[package:lints]. | ||
|
||
## Usage | ||
|
||
Flutter apps, packages, and plugins created with `flutter create` starting with | ||
Flutter version 2.xx are already set up to use the lints defined in this | ||
package. Entities created before that version can use these lints by following | ||
these instructions: | ||
|
||
1. Depend on this package as a **dev_dependency** by running | ||
`flutter pub add --dev flutter_lints`. | ||
2. Create an `analyzer_options.yaml` file at the root of the package (alongside | ||
the `pubspec.yaml` file) and `include: package:flutter_lints/flutter.yaml` | ||
from it. | ||
|
||
Example `analyzer_options.yaml` file: | ||
|
||
```yaml | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
linter: | ||
# The lint rules applied to this project can be customized in the | ||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
# included above or to enable additional rules. A list of all available lints | ||
# and their documentation is published at | ||
# https://dart-lang.github.io/linter/lints/index.html. | ||
# | ||
# Instead of disabling a lint rule for the entire project in the | ||
# section below, it can also be suppressed for a single line of code | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options | ||
``` | ||
|
||
[Flutter]: https://flutter.dev | ||
[dart analyzer]: https://dart.dev/guides/language/analysis-options | ||
[Dart-enabled IDEs]: https://dart.dev/tools#ides-and-editors | ||
[package:lints]: https://pub.dev/packages/lints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Recommended lints for Flutter apps, packages, and plugins. | ||
|
||
include: package:lints/recommended.yaml | ||
|
||
linter: | ||
rules: | ||
- avoid_print | ||
- avoid_unnecessary_containers | ||
- avoid_web_libraries_in_flutter | ||
- no_logic_in_create_state | ||
- prefer_const_constructors | ||
- prefer_const_constructors_in_immutables | ||
- prefer_const_declarations | ||
- prefer_const_literals_to_create_immutables | ||
- sized_box_for_whitespace | ||
- use_full_hex_values_for_flutter_colors | ||
- use_key_in_widget_constructors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: flutter_lints | ||
description: Recommended lints for Flutter apps, packages, and plugins. | ||
version: 1.0.0-dev.0 | ||
homepage: https://github.com/flutter/packages/tree/master/packages/flutter_lints | ||
|
||
environment: | ||
sdk: '>=2.12.0 <3.0.0' | ||
|
||
dependencies: | ||
lints: ^1.0.0-dev.0 | ||
# Code is not allowed in this package. Do not add any dependencies or dev_dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
filecount=`find . -name '*.dart' | wc -l` | ||
if [ $filecount -ne 0 ] | ||
then | ||
echo 'Dart sources are not allowed in this package:' | ||
find . -name '*.dart' | ||
exit 1 | ||
fi |