import_lint 0.1.1
import_lint: ^0.1.1 copied to clipboard
The Import Lint package defines import lint rules and report on lints found in Dart code.
Why import_lint? #
The Import Lint package defines import lint rules and report on lints found in Dart code.
π» Usage #
- You have lints configured in an
import_analysis_options.yaml
file at the root of your project.
- check_file_reg_exp: Regular expression for file names to apply lint.
- not_arrow_import_reg_exps: List of rules for regular expressions for files that are not allowed to be imported.
Example
rules:
use_case_rule:
check_file_reg_exp: ".*use_case.dart"
not_arrow_import_reg_exps: [".*use_case.dart"]
repository_rule:
check_file_reg_exp: ".*repository.dart"
not_arrow_import_reg_exps: [".*repository.dart", ".*use_case.dart"]
- Add import_lint as a dev_dependencies in pubspec.yamls.
dev_dependencies:
import_lint: ^0.1.1
- run import_linter
flutter pub run import_lint
or
dart pub run import_lint
Result #
- Passed
No issues found! π
- Failed Example
- lib
- repository
- test_one_repository.dart
import 'package:import_analyzer_test/repository/test_two_repository.dart';
import 'package:import_analyzer_test/use_case/test_one_use_case.dart';
class TestOneUseCase {}
- test_two_repository.dart
class TestOneRepository {}
- use_case
- test_one_use_case.dart
class TestOneUseCase {}
- test_two_use_case.dart
import 'package:import_analyzer_test/repository/test_one_repository.dart';
import 'package:import_analyzer_test/use_case/test_one_use_case.dart';
class TestTwoUseCase {}
use_case_rule β’ package:import_analyzer_test/use_case/test_two_use_case.dart β’ import 'package:import_analyzer_test/use_case/test_one_use_case.dart':2
repository_rule β’ package:import_analyzer_test/repository/test_one_repository.dart β’ import 'package:import_analyzer_test/repository/test_two_repository.dart':1
repository_rule β’ package:import_analyzer_test/repository/test_one_repository.dart β’ import 'package:import_analyzer_test/use_case/test_one_use_case.dart':2
β‘οΈ Features: #
- β Analyze import
- β Support RegExp
- β Ignore Line
- β Support Directory
- β Add Test