Index: pkg/analyzer/lib/src/context/builder.dart |
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart |
index eef1373e1cc693f0f254f73485e4ffd71fe54d45..05421729840a748034c0dfa91208f933c66ed52c 100644 |
--- a/pkg/analyzer/lib/src/context/builder.dart |
+++ b/pkg/analyzer/lib/src/context/builder.dart |
@@ -25,6 +25,7 @@ import 'package:analyzer/src/generated/gn.dart'; |
import 'package:analyzer/src/generated/sdk.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/generated/workspace.dart'; |
+import 'package:analyzer/src/lint/registry.dart'; |
import 'package:analyzer/src/summary/summary_sdk.dart'; |
import 'package:analyzer/src/task/options.dart'; |
import 'package:args/args.dart'; |
@@ -410,6 +411,10 @@ class ContextBuilder { |
applyToAnalysisOptions(options, optionMap); |
if (builderOptions.argResults != null) { |
applyAnalysisOptionFlags(options, builderOptions.argResults); |
+ // If lints turned on but none specified, then enable default lints |
+ if (options.lint && options.lintRules.isEmpty) { |
+ options.lintRules = Registry.ruleRegistry.defaultRules; |
+ } |
} |
} |
return options; |