-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
194 additions
and
2 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,7 @@ | ||
.dart_tool | ||
.packages | ||
pubspec.lock | ||
|
||
.DS_Store | ||
.idea | ||
.vscode |
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 |
---|---|---|
@@ -1,2 +1,31 @@ | ||
# flutter_guardian | ||
Lint rules for Dart and Flutter used internally at Softeq | ||
# Softeq Flutter Lints | ||
|
||
Lint rules for Dart and Flutter used internally at Softeq. | ||
|
||
This package is built on top of Dart/Flutter's recommended set of lints from [package:flutter_lints](https://pub.dev/packages/flutter_lints). | ||
|
||
**Note**: This package was heavily inspired by [pedantic](https://github.com/dart-lang/pedantic). | ||
|
||
## Usage | ||
|
||
To use the lints, add as a dev dependency in your `pubspec.yaml`: | ||
|
||
```yaml | ||
dev_dependencies: | ||
|
||
flutteq_lints: | ||
git: | ||
url: git@github.com:Softeq/flutteq_lints.git | ||
ref: v1.0.0 | ||
``` | ||
Then, add an include in `analysis_options.yaml`: | ||
|
||
```yaml | ||
include: package:flutteq_lints/analysis_options.yaml | ||
``` | ||
|
||
## Resources | ||
|
||
- [Dart Linter rules](https://dart.dev/tools/linter-rules) | ||
- [Customizing static analysis](https://dart.dev/tools/analysis) |
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 @@ | ||
include: lib/analysis_options.yaml |
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 @@ | ||
include: package:flutteq_lints/analysis_options.yaml |
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,13 @@ | ||
// The following syntax deactivates a lint for the entire file: | ||
// ignore_for_file: avoid_print | ||
|
||
void main() { | ||
/// The following line would normally show a lint warning | ||
/// but we can disable the lint rule for this line using the following syntax. | ||
// ignore: prefer_final_locals, prefer_single_quotes | ||
var greeting = "hello world"; | ||
|
||
/// The following line would normally show a lint warning | ||
/// but we can disable the lint rule for this file using `ignore_for_file`. | ||
print(greeting); | ||
} |
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,10 @@ | ||
name: flutteq_lints_example | ||
version: 0.0.1 | ||
publish_to: none | ||
|
||
environment: | ||
sdk: ">=2.18.0 <3.0.0" | ||
|
||
dev_dependencies: | ||
flutteq_lints: | ||
path: ../ |
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,113 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
analyzer: | ||
language: | ||
strict-casts: true | ||
strict-inference: true | ||
strict-raw-types: true | ||
|
||
errors: | ||
close_sinks: warning | ||
missing_required_param: error | ||
missing_return: error | ||
record_literal_one_positional_no_trailing_comma: error | ||
collection_methods_unrelated_type: warning | ||
unrelated_type_equality_checks: warning | ||
|
||
exclude: | ||
- '**/*.g.dart' | ||
- '**/*.gen.dart' | ||
- test/.test_coverage.dart | ||
- lib/generated_plugin_registrant.dart | ||
|
||
linter: | ||
rules: | ||
- always_declare_return_types | ||
- always_put_required_named_parameters_first | ||
- always_use_package_imports | ||
- avoid_bool_literals_in_conditional_expressions | ||
- avoid_catching_errors | ||
- avoid_double_and_int_checks | ||
- avoid_dynamic_calls | ||
- avoid_equals_and_hash_code_on_mutable_classes | ||
- avoid_escaping_inner_quotes | ||
- avoid_field_initializers_in_const_classes | ||
- avoid_final_parameters | ||
- avoid_js_rounded_ints | ||
- avoid_multiple_declarations_per_line | ||
- avoid_positional_boolean_parameters | ||
- avoid_private_typedef_functions | ||
- avoid_redundant_argument_values: false | ||
- avoid_returning_this | ||
- avoid_setters_without_getters | ||
- avoid_slow_async_io | ||
- avoid_type_to_string | ||
- avoid_unused_constructor_parameters | ||
- avoid_void_async | ||
- cancel_subscriptions | ||
- cascade_invocations | ||
- cast_nullable_to_non_nullable | ||
- combinators_ordering | ||
- comment_references | ||
- conditional_uri_does_not_exist | ||
- deprecated_consistency | ||
- directives_ordering | ||
- eol_at_end_of_file | ||
- flutter_style_todos: false | ||
- implicit_reopen | ||
- invalid_case_patterns | ||
- join_return_with_assignment | ||
- leading_newlines_in_multiline_strings | ||
- lines_longer_than_80_chars: false | ||
- literal_only_boolean_expressions | ||
- missing_whitespace_between_adjacent_strings | ||
- no_adjacent_strings_in_list | ||
- no_default_cases | ||
- no_runtimeType_toString | ||
- noop_primitive_operations | ||
- omit_local_variable_types | ||
- one_member_abstracts | ||
- only_throw_errors | ||
- package_api_docs | ||
- package_prefixed_library_names | ||
- parameter_assignments | ||
- prefer_asserts_in_initializer_lists | ||
- prefer_asserts_with_message | ||
- prefer_constructors_over_static_methods | ||
- prefer_final_in_for_each | ||
- prefer_final_locals | ||
- prefer_if_elements_to_conditional_expressions | ||
- prefer_int_literals | ||
- prefer_null_aware_method_calls | ||
- prefer_single_quotes | ||
- prefer_void_to_null | ||
- public_member_api_docs: false | ||
- require_trailing_commas | ||
- sized_box_shrink_expand | ||
- sort_constructors_first: false | ||
- sort_pub_dependencies: false | ||
- sort_unnamed_constructors_first | ||
- test_types_in_equals | ||
- throw_in_finally | ||
- tighten_type_of_initializing_formals | ||
- type_annotate_public_apis | ||
- unawaited_futures | ||
- unnecessary_await_in_return | ||
- unnecessary_breaks | ||
- unnecessary_lambdas | ||
- unnecessary_library_directive | ||
- unnecessary_null_checks | ||
- unnecessary_parenthesis | ||
- unnecessary_raw_strings | ||
- unnecessary_statements | ||
- use_colored_box | ||
- use_enums | ||
- use_if_null_to_convert_nulls_to_bools | ||
- use_is_even_rather_than_modulo | ||
- use_late_for_private_fields_and_variables | ||
- use_named_constants | ||
- use_raw_strings | ||
- use_setters_to_change_properties | ||
- use_string_buffers | ||
- use_test_throws_matchers | ||
- use_to_and_as_if_applicable |
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 @@ | ||
include: package:flutteq_lints/analysis_options.1.0.0.yaml |
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 @@ | ||
/// Dart analyzer settings and best practices | ||
/// used internally at [Softeq](https://softeq.com). | ||
library flutteq_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,14 @@ | ||
name: flutteq_lints | ||
version: 1.0.0 | ||
description: Lint rules for Dart and Flutter used internally at Softeq. | ||
repository: https://github.com/Softeq/flutteq_lints | ||
issue_tracker: https://github.com/Softeq/flutteq_lints/issues | ||
homepage: https://github.com/Softeq/flutteq_lints | ||
documentation: https://github.com/Softeq/flutteq_lints | ||
topics: [lints, analyzer, analysis] | ||
|
||
environment: | ||
sdk: ">=3.0.0 <4.0.0" | ||
|
||
dependencies: | ||
flutter_lints: ^3.0.1 |