dart-lang / code_builder

A fluent API for generating valid Dart source code
https://pub.dev/packages/code_builder
BSD 3-Clause "New" or "Revised" License
423 stars 66 forks source link

feat: merge simplePrefixing allocator ignore with other file ignores #448

Open Leptopoda opened 5 months ago

Leptopoda commented 5 months ago

Using Allocator.simplePrefixing() with a library decalaration resulted in bad formatted code:

Library((b) => b
  ..docs.add(
    '/// My favorite library.',
  )
  ..body.add(Field((b) => b
    ..name = 'test'
    ..modifier = FieldModifier.final$
    ..assignment = Code.scope((a) => '${a($LinkedHashMap)}()'))))

was generating:

/// My favorite library.
library; // ignore_for_file: no_leading_underscores_for_library_prefixes

import 'dart:collection' as _i1;

final test = _i1.LinkedHashMap();

This PR merges the no_leading_underscores_for_library_prefixes ignore with the other file level ignores for better readable code.


Contribution guidelines:
- See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/wiki/External-Package-Maintenance#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.