{"id":13552342,"url":"https://github.com/jWinterDay/cool_linter","last_synced_at":"2025-04-03T03:31:23.102Z","repository":{"id":43634643,"uuid":"354534270","full_name":"jWinterDay/cool_linter","owner":"jWinterDay","description":"linter for dart code","archived":false,"fork":false,"pushed_at":"2024-08-29T07:55:28.000Z","size":1459,"stargazers_count":9,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-03T23:34:43.437Z","etag":null,"topics":["code-checker","dart","flutter","linter"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/cool_linter","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jWinterDay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-04T12:11:03.000Z","updated_at":"2024-08-29T07:55:32.000Z","dependencies_parsed_at":"2024-11-03T23:31:40.620Z","dependency_job_id":"b68346f6-4bd6-48a7-80eb-eeb1c009dee9","html_url":"https://github.com/jWinterDay/cool_linter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jWinterDay%2Fcool_linter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jWinterDay%2Fcool_linter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jWinterDay%2Fcool_linter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jWinterDay%2Fcool_linter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jWinterDay","download_url":"https://codeload.github.com/jWinterDay/cool_linter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246933421,"owners_count":20857047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-checker","dart","flutter","linter"],"created_at":"2024-08-01T12:02:02.455Z","updated_at":"2025-04-03T03:31:18.066Z","avatar_url":"https://github.com/jWinterDay.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"[![Pub Version](https://badgen.net/pub/v/cool_linter)](https://pub.dev/packages/cool_linter/)\n[![Dart SDK Version](https://badgen.net/pub/sdk-version/cool_linter)](https://pub.dev/packages/cool_linter/)\n[![Pub popularity](https://badgen.net/pub/popularity/cool_linter)](https://pub.dev/packages/cool_linter/score)\n\n# Cool linter\n\n  This is a custom linter [package](https://pub.dev/packages/cool_linter) for dart/flutter code. It can set linter for exclude some of words. This words you can set\n  in analysis_options.yaml by example below\n\n## Usage\n\n### 1. Add dependency to `pubspec.yaml`\n\n```yaml\ndev_dependencies:\n  cool_linter: ^1.2.0 # last version of plugin\n```\n\n###  2. Add configuration to `analysis_options.yaml`\n\n```yaml\nanalyzer:\n  plugins:\n    - cool_linter\n\ncool_linter:\n  extended_rules:\n    - always_specify_stream_subscription\n    - prefer_trailing_comma\n  always_specify_types:\n    - typed_literal\n    - declared_identifier\n    - set_or_map_literal\n    - simple_formal_parameter\n    - type_name\n    - variable_declaration_list\n  regexp_exclude:\n    -\n      pattern: Colors\n      hint: Use colors from design system instead!\n      severity: WARNING\n    -\n      pattern: Test123{1}\n      severity: ERROR\n  exclude_folders:\n    - test/**\n    - lib/ku/**\n```\n1. ### **always_specify_types linter**:\n  [always_specify_types](https://dart-lang.github.io/linter/lints/always_specify_types.html)\n  This rule is like dart core linter rule, but you can choose which of this subrules want to use:\n  * typed_literal\n  * declared_identifier\n  * set_or_map_literal\n  * simple_formal_parameter\n  * type_name\n  * variable_declaration_list\n\n  Also you can choose exclude folders for this rule. See `exclude_folders`\n\n2. ### **regexp_exclude linter**:\n  * `pattern` - RegExp-pattern, for example: Test123{1}, ^Test123$ and others\n  * `severity` - [optional parameter]. It is console information level. May be `WARNING`, `INFO`, `ERROR`. Default is WARNING\n  * `hint` - [optional parameter]. It is console information sentence\n  * `exclude_folders` - this folders linter will ignore. By default excluded folders are:\n\n  ```dart\n  '.dart_tool/**',\n  '.vscode/**',\n  'packages/**',\n  'ios/**',\n  'macos/**',\n  'web/**',\n  'linux/**',\n  'windows/**',\n  'go/**',\n  ```\n\n3. ### extended_rules. **always_specify_stream_subscription** linter:\n  Always use `StreamSubscription` for Stream.listen();\n\n  CORRECT:\n\n  ```dart\n  final Stream\u003cString\u003e stream2 = Stream\u003cString\u003e.value('value');\n  final StreamSubscription\u003cString\u003e sub = stream2.listen((_) {}); // OK\n  ```\n\n  WARNING:\n\n  ```dart\n  final Stream\u003cString\u003e stream1 = Stream\u003cString\u003e.value('value');\n  stream1.listen((String ttt) {}); // LINT\n  ```\n\n## :warning: Attention!!!\n###  You must restart your IDE for starting plugin\n\n# 3. CLI\nYou can use linter as command line tool\n```dart bin/cool_linter_cli.dart analyze -tsc -d test/fix/result --regexp_path test/regexp/regexp_settings_cli.yaml```\n\n[or using dart pub run](https://pub.dev/packages/cool_linter/install)\n\n:muscle: available autofix :muscle: for:\n  - **prefer_trailing_comma**\n  - **always_specify_types_rule**\n\nfor this subrules: ```declared_identifier``` ```simple_formal_parameter``` ```variable_declaration_list```\n\nfor others subrules feel free to provide me PRs\n\n`Available options`:\n* `-d` - Folder to analyze\n* `-f` - Fix issues. Now only for prefer_trailing_comma rule\n* `-t` - Use always_specify_types_rule rule\n* `-s` - Use always_specify_stream_subscription rule\n* `-c` - Use prefer_trailing_comma rule\n* `-f` - Fix issues. Now only for prefer_trailing_comma rule\n* `--regexp_path` - Path to file with RegExp settings\n\nAlso you must specify ```--regexp_path``` parameter if you want to regexp analyzer.\nExample: ```--regexp_path \u003cpath to regexp settings .yaml file\u003e```\n\n```yaml\nregexp_exclude:\n  -\n    pattern: Colors\n    hint: Use colors from design system instead!\n    severity: WARNING\n  -\n    pattern: \\sTestClass\\s\n    hint: Dont use TestClass\n    severity: ERROR\n  -\n    pattern: \\sTestClass2\\s\n    hint: Dont use TestClass2\n    severity: INFO\n```\n\n![Screenshot](images/cli_result.png)\n\n# 4. Result\nExample of analysis_options.yaml\n\n```yaml\nanalyzer:\n  plugins:\n    - cool_linter\n\ncool_linter:\n  extended_rules:\n    - always_specify_stream_subscription\n    - prefer_trailing_comma\n  always_specify_types:\n    - typed_literal\n    - declared_identifier\n    - set_or_map_literal\n    - simple_formal_parameter\n    - type_name\n    - variable_declaration_list\n  regexp_exclude:\n    -\n      pattern: Colors\n      hint: Use colors from design system instead!\n      severity: WARNING\n    -\n      pattern: Test123{1}\n      severity: ERROR\n  exclude_folders:\n    - test/**\n    - lib/ku/**\n```\n\n  ![Screenshot](images/linter1.png)\n  ![Screenshot](images/linter2.png)\n  ![Screenshot](images/linter3.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FjWinterDay%2Fcool_linter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FjWinterDay%2Fcool_linter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FjWinterDay%2Fcool_linter/lists"}