Cool linter
This is a custom linter package for dart/flutter code. It can set linter for exclude some of words. This words you can set in analysis_options.yaml by example below
Usage
1. Add dependency to pubspec.yaml
2. Add configuration to analysis_options.yaml
-
always_specify_types linter:
always_specify_types
This rule is like dart core linter rule, but you can choose which of this subrules want to use:
- typed_literal
- declared_identifier
- set_or_map_literal
- simple_formal_parameter
- type_name
- variable_declaration_list
Also you can choose exclude folders for this rule. See exclude_folders
-
regexp_exclude linter:
pattern
- RegExp-pattern, for example: Test123{1}, ^Test123$ and othersseverity
- [optional parameter]. It is console information level. May beWARNING
,INFO
,ERROR
. Default is WARNINGhint
- [optional parameter]. It is console information sentenceexclude_folders
- this folders linter will ignore. By default excluded folders are:
-
extended_rules. always_specify_stream_subscription linter:
Always use StreamSubscription
for Stream.listen();
CORRECT:
WARNING:
Attention!!!
You must restart your IDE for starting plugin
3. CLI
You can use linter as command line tool
dart bin/cool_linter_cli.dart analyze -tsc -d test/fix/result --regexp_path test/regexp/regexp_settings_cli.yaml
Available options
:
-d
- Folder to analyze-f
- Fix issues. Now only for prefer_trailing_comma rule-t
- Use always_specify_types_rule rule-s
- Use always_specify_stream_subscription rule-c
- Use prefer_trailing_comma rule-f
- Fix issues. Now only for prefer_trailing_comma rule--regexp_path
- Path to file with RegExp settings
Also you must specify --regexp_path
parameter if you want to regexp analyzer.
Example: --regexp_path <path to regexp settings .yaml file>
4. Result
Example of analysis_options.yaml