You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[code_builder] Scoped DartEmitter emits lint ignore after library annotations/directives #2404
When generating a Library that contains top-level annotations (such as @JS()) using DartEmitter.scoped, code_builder automatically injects // ignore_for_file: no_leading_underscores_for_library_prefixes. However, because it injects this comment at the head of the directives block rather than at the absolute head of the file, the lint comment appears after the library annotations and directive. dart_style then collapses the comment onto the same line as library;.
Reproduction:
import'package:code_builder/code_builder.dart';
voidmain() {
final lib =Library((l) {
l.annotations.add(refer('JS', 'dart:js_interop').call([literalString('vscode')]));
l.body.add(Method((m) => m..name ='foo'..external=true));
});
final emitter =DartEmitter.scoped();
print(lib.accept(emitter));
}
Suggested Fix:
Update DartEmitter.visitLibrary so that scoped lint ignores are injected at the very top of the emitted buffer before visiting library annotations and the library directive.
Activity
[js_interop_gen] Require `code_builder: ^4.12.0` and update golden he…
[js_interop_gen] Require `code_builder: ^4.12.0` and update golden he…
[js_interop_gen] Split union/intersection AST types and extract TypeT…