Move lint rules to a separated pacakge

This commit is contained in:
Ming Ming 2023-08-16 00:42:51 +08:00
parent 5a94a27db1
commit 8ba6526844
17 changed files with 64 additions and 170 deletions

View file

@ -1,10 +1,7 @@
include: package:flutter_lints/flutter.yaml
include: package:np_lints/np.yaml
linter:
rules:
unawaited_futures: true
avoid_void_async: true
prefer_interpolation_to_compose_strings: false
no_leading_underscores_for_local_identifiers: false
use_build_context_synchronously: false
directives_ordering: true

View file

@ -581,7 +581,7 @@ packages:
source: hosted
version: "1.0.0"
flutter_lints:
dependency: "direct dev"
dependency: transitive
description:
name: flutter_lints
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
@ -969,6 +969,13 @@ packages:
relative: true
source: path
version: "0.0.1"
np_lints:
dependency: "direct dev"
description:
path: "../np_lints"
relative: true
source: path
version: "1.0.0"
octo_image:
dependency: "direct main"
description:
@ -1786,5 +1793,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=2.19.0 <3.0.0"
dart: ">=2.19.6 <3.0.0"
flutter: ">=3.4.0-17.0.pre"

View file

@ -148,13 +148,14 @@ dev_dependencies:
ref: copy_with_build-1.7.0
dart_code_metrics: any
drift_dev: 2.8.0
flutter_lints: any
flutter_test:
sdk: flutter
# integration_test:
# sdk: flutter
np_codegen_build:
path: ../codegen_build
np_lints:
path: ../np_lints
to_string_build:
git:
url: https://gitlab.com/nkming2/dart-to-string

View file

@ -1,30 +1 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
include: package:np_lints/np.yaml

View file

@ -7,4 +7,5 @@ environment:
sdk: '>=2.17.0 <3.0.0'
dev_dependencies:
lints: any
np_lints:
path: ../np_lints

View file

@ -1,30 +1 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
include: package:np_lints/np.yaml

View file

@ -16,7 +16,8 @@ dependencies:
dev_dependencies:
build_test: ^2.1.5
lints: any
np_lints:
path: ../np_lints
path: any
test: any
code_gen_tester:

View file

@ -1,7 +1 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
unawaited_futures: true
avoid_void_async: true
directives_ordering: true
include: package:np_lints/np.yaml

View file

@ -27,49 +27,13 @@ dependencies:
dev_dependencies:
build_runner: ^2.2.1
flutter_lints: any
np_codegen_build:
path: ../codegen_build
np_lints:
path: ../np_lints
test: any
to_string_build:
git:
url: https://gitlab.com/nkming2/dart-to-string
ref: to_string_build-1.0.0
path: to_string_build
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages

View file

@ -1,7 +1 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
unawaited_futures: true
avoid_void_async: true
directives_ordering: true
include: package:np_lints/np.yaml

View file

@ -14,42 +14,6 @@ dependencies:
logging: any
dev_dependencies:
flutter_lints: any
np_lints:
path: ../np_lints
test: any
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages

7
np_lints/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

7
np_lints/lib/np.yaml Normal file
View file

@ -0,0 +1,7 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
unawaited_futures: true
avoid_void_async: true
directives_ordering: true

10
np_lints/pubspec.yaml Normal file
View file

@ -0,0 +1,10 @@
name: np_lints
description: A starting point for Dart libraries or applications.
version: 1.0.0
publish_to: none
environment:
sdk: '>=2.19.6 <3.0.0'
dependencies:
flutter_lints: ^2.0.0

View file

@ -1,4 +1 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
include: package:np_lints/np.yaml

View file

@ -23,13 +23,13 @@ packages:
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
dependency: transitive
description:
name: flutter_lints
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "2.0.2"
js:
dependency: transitive
description:
@ -42,10 +42,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
version: "2.0.1"
logging:
dependency: "direct main"
description:
@ -70,6 +70,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.0"
np_lints:
dependency: "direct dev"
description:
path: "../np_lints"
relative: true
source: path
version: "1.0.0"
sky_engine:
dependency: transitive
description: flutter
@ -84,5 +91,5 @@ packages:
source: hosted
version: "2.1.4"
sdks:
dart: ">=2.17.0 <3.0.0"
dart: ">=2.19.6 <3.0.0"
flutter: ">=3.3.0"

View file

@ -13,7 +13,8 @@ dependencies:
logging: any
dev_dependencies:
flutter_lints: any
np_lints:
path: ../np_lints
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec