Skip to content

Commit 453a9f8

Browse files
committed
first release.
1 parent edb58b2 commit 453a9f8

9 files changed

+198
-171
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ pubspec.lock
88

99
# Directory created by dartdoc
1010
doc/api/
11+
.history

README.md

+6-84
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,22 @@
1-
[![pub package](https://img.shields.io/pub/v/lints.svg)](https://pub.dev/packages/lints)
2-
[![Build Status](https://github.com/dart-lang/lints/workflows/validate/badge.svg)](https://github.com/dart-lang/lints/actions?query=branch%3Amain)
1+
# Not an offical lint package
32

4-
# Official Dart lint rules
5-
6-
The Dart linter is a static analyzer for identifying possible problems in your
7-
Dart source code. More than a hundred [linter rules][rules] are available,
8-
checking anything from potential typing issues, coding style, and formatting.
9-
This package, `lints`, contains the lint settings recommended by the Dart team.
10-
11-
Two sets of lints are available:
12-
13-
* **Core lints**: Lints that help identify critical issues that are likely to
14-
lead to problems when running or consuming Dart code. All code should pass these
15-
lints.
16-
17-
* **Recommended lints**: Lints that help identify additional issues that may
18-
lead to problems when running or consuming Dart code, and lints that enforce
19-
writing Dart using a single, idiomatic style and format. All code is encouraged
20-
to pass these lints. The recommended lints include all the core lints.
21-
22-
## Where these lints are used
23-
24-
When creating new Dart project using the [`dart create`][dart create] command,
25-
the lints from `package:lints` are enabled by default.
26-
27-
When uploading a package to the [pub.dev] package repository, packages are
28-
[awarded pub points][scoring] based on how many of the 'core' lints pass.
29-
30-
For documentation on the individual lints, see the [linter rules][rules] page on
31-
dart.dev.
3+
This linter inclues every non-clashing lints.
324

335
## How to enable these lints
346

35-
For new apps created with `dart create`, the lints are enabled by default.
36-
37-
For existing apps or packages, take these steps to enable these lints:
7+
To enable these lints for your apps or package:
388

399
1. In a terminal, located at the root of your package, run this command:
4010

4111
```terminal
42-
dart pub add --dev lints
12+
dart pub add --dev lint_hard
4313
```
4414
4515
2. Create a new `analysis_options.yaml` file, next to the pubspec, that
46-
includes the lints package:
16+
includes the lint_hard package:
4717
4818
```yaml
49-
include: package:lints/recommended.yaml
50-
```
51-
52-
or:
53-
54-
```yaml
55-
include: package:lints/core.yaml
19+
include: package:lint_hard/all.yaml
5620
```
5721
5822
## Customizing the predefined lint sets
@@ -61,45 +25,3 @@ You can customize the predefined lint sets, both to disable one or more of the
6125
lints included, or to add additional lints. For details see [customizing static
6226
analysis].
6327
64-
## Migrating from `package:pedantic`
65-
66-
In migrating from the predefined lint sets provided by the [`package:pedantic`],
67-
you get static analysis coverage from 29 additional lints. There are, however,
68-
6 lints which the pedantic package includes which are not included in the
69-
predefined lint sets provided by the lints package:
70-
`always_declare_return_types`, `prefer_single_quotes`,
71-
`sort_child_properties_last`, `unawaited_futures`, `unsafe_html`, and
72-
`use_full_hex_values_for_flutter_colors` (also included in
73-
[`package:flutter_lints`]). To keep any of these lints enabled,
74-
add them to your [analysis options][customizing static analysis].
75-
76-
Additionally, `package:pedantic` provides the `unawaited` method for use with
77-
`unawaited_futures`. With SDK version 2.14 this method is available in the
78-
`dart:async` package, and this is now the recommended way to use it. Be sure to
79-
mark the minimum SDK version of your package as `2.14` if you do so.
80-
81-
## Evolving the lint sets
82-
83-
The Dart language changes and the ecosystem continues to develop new best
84-
practices, so the lint sets must be periodically updated to reflect the best way
85-
we know to write Dart code. The informal process we use is:
86-
87-
1. Anyone can file an [issue] to discuss a potential change to a lint set. (A
88-
change here means adding or removing a lint from one or both sets. If you
89-
want to discuss implementing an entirely new lint, the place to suggest that
90-
is at the [linter repo].) Feedback is welcome from any Dart user.
91-
92-
2. Periodically, a group of Dart and Flutter team members meet to review the
93-
suggestions and decide what to adopt.
94-
95-
3. The lists are updated and a new version of the package is published.
96-
97-
[dart create]: https://dart.dev/tools/dart-tool
98-
[scoring]: https://pub.dev/help/scoring
99-
[customizing static analysis]: https://dart.dev/guides/language/analysis-options
100-
[rules]: https://dart.dev/tools/linter-rules
101-
[pub.dev]: https://pub.dev
102-
[issue]: https://github.com/dart-lang/lints/issues
103-
[linter repo]: https://github.com/dart-lang/linter
104-
[`package:pedantic`]: https://pub.dev/packages/pedantic
105-
[`package:flutter_lints`]: https://pub.dev/packages/flutter_lints

example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
An example project that uses Dart recommended lints.
1+
An example project that uses lint_hard.

example/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# (the recommended set includes the core lints).
1212
# The core lints are also what is used by pub.dev for scoring packages.
1313

14-
include: package:lints/recommended.yaml
14+
include: package:lint_hard/all.yaml
1515

1616
# Uncomment the following section to specify additional rules.
1717

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: example
2-
description: An example project that uses Dart recommended lints.
2+
description: An example project that uses lint_hard.
33
version: 0.1.0
44
publish_to: none
55

lib/all.yaml

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
linter:
2+
rules:
3+
always_declare_return_types : true
4+
always_put_control_body_on_new_line : true
5+
always_put_required_named_parameters_first : true
6+
always_require_non_null_named_parameters : true
7+
always_use_package_imports : false
8+
annotate_overrides : true
9+
avoid_annotating_with_dynamic : true
10+
avoid_bool_literals_in_conditional_expressions : true
11+
avoid_catches_without_on_clauses : true
12+
avoid_catching_errors : true
13+
avoid_classes_with_only_static_members : true
14+
avoid_double_and_int_checks : true
15+
avoid_dynamic_calls : true
16+
avoid_empty_else : true
17+
avoid_equals_and_hash_code_on_mutable_classes : true
18+
avoid_escaping_inner_quotes : true
19+
avoid_field_initializers_in_const_classes : true
20+
avoid_function_literals_in_foreach_calls : true
21+
avoid_implementing_value_types : true
22+
avoid_init_to_null : true
23+
avoid_js_rounded_ints : true
24+
avoid_null_checks_in_equality_operators : true
25+
avoid_positional_boolean_parameters : true
26+
avoid_private_typedef_functions : true
27+
avoid_redundant_argument_values : true
28+
avoid_relative_lib_imports : true
29+
avoid_renaming_method_parameters : true
30+
avoid_return_types_on_setters : true
31+
avoid_returning_null : true
32+
avoid_returning_null_for_future : true
33+
avoid_returning_null_for_void : true
34+
avoid_returning_this : true
35+
avoid_setters_without_getters : true
36+
avoid_shadowing_type_parameters : true
37+
avoid_single_cascade_in_expression_statements : true
38+
avoid_slow_async_io : true
39+
avoid_type_to_string : true
40+
avoid_types_as_parameter_names : true
41+
avoid_types_on_closure_parameters : true
42+
avoid_unnecessary_containers : true
43+
avoid_unused_constructor_parameters : true
44+
avoid_void_async : true
45+
avoid_web_libraries_in_flutter : true
46+
await_only_futures : true
47+
camel_case_extensions : true
48+
camel_case_types : true
49+
cancel_subscriptions : true
50+
cascade_invocations : true
51+
cast_nullable_to_non_nullable : true
52+
close_sinks : true
53+
comment_references : true
54+
constant_identifier_names : true
55+
control_flow_in_finally : true
56+
curly_braces_in_flow_control_structures : true
57+
diagnostic_describe_all_properties : true
58+
directives_ordering : true
59+
do_not_use_environment : true
60+
empty_catches : true
61+
empty_constructor_bodies : true
62+
empty_statements : true
63+
exhaustive_cases : true
64+
file_names : true
65+
flutter_style_todos : true
66+
hash_and_equals : true
67+
implementation_imports : true
68+
invariant_booleans : true
69+
iterable_contains_unrelated_type : true
70+
join_return_with_assignment : true
71+
leading_newlines_in_multiline_strings : true
72+
library_names : true
73+
library_prefixes : true
74+
lines_longer_than_80_chars : true
75+
list_remove_unrelated_type : true
76+
literal_only_boolean_expressions : true
77+
missing_whitespace_between_adjacent_strings : true
78+
no_adjacent_strings_in_list : true
79+
no_default_cases : true
80+
no_duplicate_case_values : true
81+
no_logic_in_create_state : true
82+
no_runtimeType_toString : true
83+
non_constant_identifier_names : true
84+
null_check_on_nullable_type_parameter : true
85+
null_closures : true
86+
omit_local_variable_types : true
87+
one_member_abstracts : true
88+
only_throw_errors : true
89+
overridden_fields : true
90+
package_api_docs : true
91+
package_names : true
92+
package_prefixed_library_names : true
93+
parameter_assignments : true
94+
prefer_adjacent_string_concatenation : true
95+
prefer_asserts_in_initializer_lists : true
96+
prefer_asserts_with_message : true
97+
prefer_collection_literals : true
98+
prefer_conditional_assignment : true
99+
prefer_const_constructors : true
100+
prefer_const_constructors_in_immutables : true
101+
prefer_const_declarations : true
102+
prefer_const_literals_to_create_immutables : true
103+
prefer_constructors_over_static_methods : true
104+
prefer_contains : true
105+
prefer_equal_for_default_values : true
106+
prefer_expression_function_bodies : true
107+
prefer_final_fields : true
108+
prefer_final_in_for_each : true
109+
prefer_final_locals : true
110+
prefer_for_elements_to_map_fromIterable : true
111+
prefer_foreach : true
112+
prefer_function_declarations_over_variables : true
113+
prefer_generic_function_type_aliases : true
114+
prefer_if_elements_to_conditional_expressions : true
115+
prefer_if_null_operators : true
116+
prefer_initializing_formals : true
117+
prefer_inlined_adds : true
118+
prefer_int_literals : true
119+
prefer_interpolation_to_compose_strings : true
120+
prefer_is_empty : true
121+
prefer_is_not_empty : true
122+
prefer_is_not_operator : true
123+
prefer_iterable_whereType : true
124+
prefer_mixin : true
125+
prefer_null_aware_operators : true
126+
prefer_relative_imports : true
127+
prefer_single_quotes : true
128+
prefer_spread_collections : true
129+
prefer_typing_uninitialized_variables : true
130+
prefer_void_to_null : true
131+
provide_deprecation_message : true
132+
public_member_api_docs : false
133+
recursive_getters : true
134+
sized_box_for_whitespace : true
135+
slash_for_doc_comments : true
136+
sort_child_properties_last : true
137+
sort_constructors_first : true
138+
sort_pub_dependencies : true
139+
sort_unnamed_constructors_first : true
140+
test_types_in_equals : true
141+
throw_in_finally : true
142+
tighten_type_of_initializing_formals : true
143+
type_annotate_public_apis : true
144+
type_init_formals : true
145+
unawaited_futures : true
146+
unnecessary_await_in_return : true
147+
unnecessary_brace_in_string_interps : true
148+
unnecessary_const : true
149+
unnecessary_getters_setters : true
150+
unnecessary_lambdas : true
151+
unnecessary_new : true
152+
unnecessary_null_aware_assignments : true
153+
unnecessary_null_checks : true
154+
unnecessary_null_in_if_null_operators : true
155+
unnecessary_nullable_for_final_variable_declarations : true
156+
unnecessary_overrides : true
157+
unnecessary_parenthesis : true
158+
unnecessary_raw_strings : true
159+
unnecessary_statements : true
160+
unnecessary_string_escapes : true
161+
unnecessary_string_interpolations : true
162+
unnecessary_this : true
163+
unrelated_type_equality_checks : true
164+
unsafe_html : true
165+
use_full_hex_values_for_flutter_colors : true
166+
use_function_type_syntax_for_parameters : true
167+
use_is_even_rather_than_modulo : true
168+
use_key_in_widget_constructors : true
169+
use_late_for_private_fields_and_variables : true
170+
use_raw_strings : true
171+
use_rethrow_when_possible : true
172+
use_setters_to_change_properties : true
173+
use_string_buffers : true
174+
use_to_and_as_if_applicable : true
175+
valid_regexps : true
176+
void_checks : true
177+
avoid_print: false
178+
179+
180+
181+
analyzer:
182+
strong-mode:
183+
implicit-casts: false
184+
implicit-dynamic: false

lib/core.yaml

-28
This file was deleted.

0 commit comments

Comments
 (0)