analysis_options.yaml for test folder not working
Starting from 0.2.0 version. analysis_options.yaml file inside test folder is ignored by linter.
This could potentially be a fix. Need to test it out thoroughly and submit it to dart_custom_lint if it works OK.
In short -- looks like with recent changes, custom_lint requires .dart_tool/package_config.json to be present alongside each analysis_options.yaml file. This basically limits it to a single analysis_options.yaml file in the root of the package. Nested analysis options are ignored.
The diff below removes the check for .dart_tool presence, making custom_lint parse all available analysis options as context roots, and correctly process them.
% git status | head -n1
On branch main
% git rev-parse HEAD
e45d95fabd22cb171dc7baa279ef08bb17c3cfa2
% git diff
diff --git a/packages/custom_lint/lib/src/workspace.dart b/packages/custom_lint/lib/src/workspace.dart
index 4d7ae3e..26a10b7 100644
--- a/packages/custom_lint/lib/src/workspace.dart
+++ b/packages/custom_lint/lib/src/workspace.dart
@@ -424,7 +424,7 @@ Iterable<String> _findRoots(String path) sync* {
return false;
}
- return file.parent.packageConfig.existsSync();
+ return true;
}).map((file) => file.parent.path);
}
EDIT (thx @solid-vovabeloded) we should look for .dart_tool recursively in parent dirs instead of returning true.