Skip to content

Commit

Permalink
Prepare v1.8.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
passsy committed Dec 12, 2021
1 parent d22746e commit 67d2966
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 49 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changlog

## 1.8.1

Requires Dart `sdk: '>=2.15.0-7.0.dev <3.0.0'`

- Enable [`always_use_package_imports`](https://dart-lang.github.io/linter/lints/always_use_package_imports.html)
- Enable [`avoid_double_and_int_checks`](https://dart-lang.github.io/linter/lints/avoid_double_and_int_checks.html)
- Enable [`use_is_even_rather_than_modulo`](https://dart-lang.github.io/linter/lints/use_is_even_rather_than_modulo.html)
- [`parameter_assignments`](https://dart-lang.github.io/linter/lints/always_use_package_imports.html) is now a warning (was hint)
- [`missing_required_param`](https://dart-lang.github.io/linter/lints/missing_required_param.html) is now a error (was warning)
- [`missing_return`](https://dart-lang.github.io/linter/lints/missing_return.html) is now an error (was warning)
- ignore any errors in auto-generated flutter file `lib/generated_plugin_registrant.dart`

### Package

- Enable [`library_private_types_in_public_api`](https://dart-lang.github.io/linter/lints/library_private_types_in_public_api.html)
- Enable [`lines_longer_than_80_chars`](https://dart-lang.github.io/linter/lints/lines_longer_than_80_chars.html)
- Enable [`prefer_single_quotes`](https://dart-lang.github.io/linter/lints/prefer_single_quotes.html)

Big thanks to @rydmike for comparing all popular lint packages, identifying missing rules for this `lint`

## 1.8.0

Requires Dart `sdk: '>=2.15.0-7.0.dev <3.0.0'`
Expand Down
78 changes: 30 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,55 @@

# Lint for Dart/Flutter


<p align="center">
<img src="https://user-images.githubusercontent.com/1096485/66209493-bc0ec900-e6b7-11e9-80c6-222e778f0c8d.png">
</p>

`lint` is a hand-picked, open-source, community-driven collection of lint rules for Dart and Flutter projects.
The set of rules follows the [Effective Dart: Style Guide](https://dart.dev/guides/language/effective-dart/style).

This package can be used as a replacement for [`package:pedantic`](https://github.com/dart-lang/pedantic) for those who prefer stricter rules.
This package can be used as a replacement for [`package:lints`](https://pub.dev/packages/lints) or the discontinued [`package:pedantic`](https://github.com/dart-lang/pedantic) for those who prefer stricter rules.

`lint` tries to be strict but not annoying.

## Install

Add `lint` as dependency to your `pubspec.yaml`
Add `lint` as dependency to your `pubspec.yaml`. Version `^1.0.0` means you're automatically getting the latest version for `lint` when running `pub upgrade`
```yaml
dev_dependencies:
lint: ^1.0.0
```

Create a `analysis_options.yaml` file in the root of your project and import the `lint` rules:
Create a `analysis_options.yaml` file in the root of your project with the following content:

```yaml
include: package:lint/analysis_options.yaml
```
# This file configures the analyzer to use the lint rule set from `package:lint`

If you're writing a package with a public API you should use the `package` version instead
```yaml
include: package:lint/analysis_options_package.yaml
```
# For apps, use the default set
include: package:lint/analysis_options.yaml

## Enable/Disable rules
# Packages, that may be distributed (i.e. via pub.dev) should use the package
# version, resulting in a better pub score.
# include: package:lint/analysis_options_package.yaml

`lint` is customizable, you can add or remove rules, depending on your needs.
To do so adjust your `analysis_options.yaml`.

```yaml
include: package:lint/analysis_options.yaml
# You might want to exclude auto-generated files from dart analysis
analyzer:
exclude:
#- '**.freezed.dart'

# You can customize the lint rules set to your own liking. A list of all rules
# can be found at https://dart-lang.github.io/linter/lints/options/options.html
linter:
rules:
# ------ Disable individual rules ----- #
# --- #
# Turn off what you don't like. #
# ------------------------------------- #

# Use parameter order as in json response
always_put_required_named_parameters_first: false

# Util classes are awesome!
avoid_classes_with_only_static_members: false


# ------ Enable individual rules ------ #
# --- #
# These rules here are good but too #
# opinionated to enable them by default #
# ------------------------------------- #

# avoid_classes_with_only_static_members: false

# Make constructors the first thing in every class
sort_constructors_first: true

# The new tabs vs. spaces. Choose wisely
prefer_single_quotes: true
prefer_double_quotes: true
# sort_constructors_first: true

# Good packages document everything
public_member_api_docs: true

# Blindly follow the Flutter code style, which prefers types everywhere
always_specify_types: true

# Back to the 80s
lines_longer_than_80_chars: true
# Choose wisely, but you don't have to
# prefer_double_quotes: true
# prefer_single_quotes: true
```

## Lint badge
Expand All @@ -88,7 +65,13 @@ Add the badge to your `README.md` show that you honor strict lint rules
[![style: lint](https://img.shields.io/badge/style-lint-4BC0F5.svg)](https://pub.dev/packages/lint)
```

## Comparison to package:pedantic
## Comparison with other lint packages

A detailed comparison of all linting packages for dart can be found at https://rydmike.com/blog_flutter_linting.html

`lint` is among the strictest but not the strictest. It tires to find the right balance between useful and annoying.

## Comparison to discontinued package:pedantic

Google publicly shares their internal rules as `package:pedantic` in open-source.
It represents what Google is enforcing internally throughout all Dart code.
Expand All @@ -101,7 +84,6 @@ For developers outside Google, it is the norm to have separate lint rules per pr
One project might enable more rules then others.

`lint` enables a majority of lint rules, leaving out contradictory and very opinionated rules.


## License

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: lint
version: 1.8.0
version: 1.8.1
description: An opinionated, community-driven set of lint rules for Dart and Flutter projects. Like pedantic but stricter
homepage: https://github.com/passsy/dart-lint

Expand Down

0 comments on commit 67d2966

Please sign in to comment.