dart-lang / site-www

Source for Dart website
https://dart.dev
Other
944 stars 684 forks source link

Issue Report: Dart Analyzer and Linter #5922

Closed Sushant2171993 closed 3 months ago

Sushant2171993 commented 3 months ago

Describe the problem

Issue Report: Dart Analyzer and Linter

The current line length limit of 80 characters enforced by the Dart analyzer and linter creates significant empty space on the screen, disrupting readability and efficient use of screen real estate. A more practical limit would be 120 characters, which balances readability and effective use of space.

Could we update the limit to 120 characters or implement a linter configuration that supports this adjustment?

For reference, see the official Dart documentation on line length limits: lines_longer_than_80_chars.

Expected fix

The current Dart lint rule lines_longer_than_80_chars limits line length to 80 characters. I am requesting a configuration option or a new lint rule, such as lines_longer_than_120_chars, to allow line lengths up to 120 characters for better formatting flexibility.

On which browser(s) did you experience this issue?

No response

Additional context

No response

I would like to fix this problem.

atsansone commented 3 months ago

@kenzieschmoll : Is this a dart-lang/tools issue?

parlough commented 3 months ago

Thanks for opening the issue and the suggestion!

Effective Dart will likely continue to recommend 80 characters and if you're interested in discussion around this suggestion or changes to the dart format tool, check out https://github.com/dart-lang/dart_style/issues/833 and/or https://github.com/dart-lang/dart_style/issues/918 where more discussion has and continues to take place.

As for the lint rule, unless dart format makes one or more of those adjustments, the linter is unlikely to add a separate rule for other lengths, as configuration of lints is unsupported currently and different teams may desire different character limits. So I'll close this issue in favor of further discussion there.

If the base analysis options set you rely on brings in this specific lint, you can always disable it in your analysis_options.yaml file like:

linter:
  rules:
    lines_longer_than_80_chars: false

If a larger limit configured in analysis and formatting is important to you or your team, consider third-party tools like Dart Code Metrics, which among many other features, includes a formatter with line length configuration.

Thanks again :)