为 flutter 和 dart 定义一个 linter 规则
Define a linter rule for flutter and dart
如您所知,有一些预定义的 linter 规则,但我想知道如何为 flutter 和 dart 定义自定义的 linter 规则?
您需要为分析服务器编写一个插件,但文档警告:
Note: The plugin support is not currently available for general use.
以防万一您想忽略它,请查看位于 https://pub.dev/packages/analyzer_plugin 的分析器文档和位于:https://pub.dev/packages/analyzer_plugin 的 linter 文档:
https://github.com/dart-lang/linter/blob/master/doc/WritingLints.MD
您需要添加 analyzer package to your dependencies and then make a analysis_options.yaml
file in the root of your project. in there you can import other analyzer rules like effective_dart or add the ones that you need from the lint rule list。
这是 analysis_options.yaml
的示例:
linter:
rules:
- camel_case_types
- empty_constructor_bodies
如您所知,有一些预定义的 linter 规则,但我想知道如何为 flutter 和 dart 定义自定义的 linter 规则?
您需要为分析服务器编写一个插件,但文档警告:
Note: The plugin support is not currently available for general use.
以防万一您想忽略它,请查看位于 https://pub.dev/packages/analyzer_plugin 的分析器文档和位于:https://pub.dev/packages/analyzer_plugin 的 linter 文档: https://github.com/dart-lang/linter/blob/master/doc/WritingLints.MD
您需要添加 analyzer package to your dependencies and then make a analysis_options.yaml
file in the root of your project. in there you can import other analyzer rules like effective_dart or add the ones that you need from the lint rule list。
这是 analysis_options.yaml
的示例:
linter:
rules:
- camel_case_types
- empty_constructor_bodies