This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
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.
refactor: centralize linting configuration
- Loading branch information
Showing
15 changed files
with
644 additions
and
237 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,24 @@ | ||
# `analysis_options` | ||
|
||
Provide a strict lint configuration. | ||
|
||
## Features | ||
|
||
- Strictest selection of lints around! | ||
- Follows [Effective Dart][effective-dart] even more than [VGA]. | ||
|
||
## Getting started | ||
|
||
To use the lints, add as a dev dependency in your `pubspec.yaml`; | ||
then, add an include in `analysis_options.yaml`: | ||
|
||
```yaml | ||
include: package:analysis_options/analysis_options.yaml | ||
``` | ||
## Additional information | ||
This is based on [VGA], changes are PRed back. | ||
[effective-dart]: https://dart.dev/effective-dart | ||
[VGA]: https://pub.dev/packages/very_good_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,5 @@ | ||
include: lib/analysis_options.yaml | ||
|
||
analyzer: | ||
plugins: | ||
- custom_lint |
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,2 @@ | ||
/// Analyzer configuration for the Our Democracy team. | ||
library; |
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,75 @@ | ||
# 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:very_good_analysis/analysis_options.yaml | ||
|
||
analyzer: | ||
exclude: | ||
- "lib/gen/**" | ||
- "lib/src/l10n/app_localizations*.dart" | ||
- "lib/generated_plugin_registrant.dart" | ||
- "test/.test_coverage.dart" | ||
- "build/**" | ||
- "**/*.g.dart" | ||
- "**/*.gr.dart" | ||
- "**/*.gen.dart" | ||
- "**/*.freezed.dart" | ||
|
||
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.dev/lints. | ||
# | ||
# 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: | ||
# Differences from VGA | ||
prefer_relative_imports: true | ||
always_use_package_imports: false | ||
lines_longer_than_80_chars: false | ||
one_member_abstracts: false | ||
|
||
# Extra rules, not in VGA | ||
avoid_classes_with_only_static_members: true | ||
avoid_implementing_value_types: true | ||
avoid_types_on_closure_parameters: true | ||
deprecated_member_use_from_same_package: true | ||
diagnostic_describe_all_properties: true | ||
no_literal_bool_comparisons: true | ||
prefer_foreach: true | ||
prefer_mixin: true | ||
type_literal_in_constant_pattern: true | ||
unnecessary_null_aware_operator_on_extension_on_nullable: true | ||
unreachable_from_main: true | ||
|
||
# Temporary suppression of rules in VGA | ||
public_member_api_docs: false | ||
|
||
# Rules with false-positives, not in VGA | ||
discarded_futures: true | ||
close_sinks: true | ||
|
||
# Experimental rules, not yet in VGA | ||
annotate_redeclares: true | ||
|
||
# New/updated rules, not yet in VGA | ||
unintended_html_in_doc_comment: true | ||
invalid_runtime_check_with_js_interop_types: true | ||
unnecessary_library_name: true | ||
document_ignores: true | ||
avoid_catches_without_on_clauses: true | ||
|
||
# Newly (or soon-to-be) deprecated rules, still in VGA | ||
unnecessary_await_in_return: false | ||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
Oops, something went wrong.