Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Grodien committed Oct 29, 2024
1 parent bea5da8 commit 61680fe
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DontUseSrcFolderImports extends DartLintRule {
context.registry.addImportDirective((importDirective) {
var importUri = importDirective.uri.stringValue;

if (importUri == null || !importUri.contains('src')) return;
if (importUri == null || !importUri.contains('/src/')) return;

var filePath = importDirective.element!.source.fullName;
if (!filePath.contains("/lib/")) return;
Expand All @@ -39,7 +39,11 @@ class DontUseSrcFolderImports extends DartLintRule {
if (fileParts[0].startsWith(importParts[0])) return;

// report a lint error with the `code` and the respective import directive
reporter.atNode(importDirective, _code);
reporter.atNode(importDirective, LintCode(
name: _code.name,
problemMessage: 'Don\'t use source folder imports for importing ${importDirective.uri.stringValue}',
errorSeverity: ErrorSeverity.ERROR,
));
});
}

Expand Down

0 comments on commit 61680fe

Please sign in to comment.