Skip to content

Linter features for Flutter code #57238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 of 12 tasks
Hixie opened this issue Oct 16, 2015 · 7 comments
Open
5 of 12 tasks

Linter features for Flutter code #57238

Hixie opened this issue Oct 16, 2015 · 7 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-lint-request P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@Hixie
Copy link
Contributor

Hixie commented Oct 16, 2015

Flutter adds to the Dart style guide with:

https://github.com/flutter/engine/blob/master/sky/specs/style-guide.md

Many things in that list could be caught by a linter (or a code reformatter), such as:

  • Never use var.
  • Always type everything explicitly except arguments named _, __, ___, etc.
  • Don't use _ arguments.
  • Never use as.
  • Constructors always come first.
  • Default (unnamed) constructor should come first among the constructors.
  • Whitespace inside {}, [], () blocks should be symmetric at the start and end. (i.e. If a block starts with a newline, it ends with a newline. If it starts with two, it ends with two. If it starts with a space, it ends with a space. And so on.)
  • Don't call super if you have no arguments to pass up to the superclass.
  • Always put the body of an if on its own line.
  • Avoid braces around one-line code blocks (e.g. in if statements) unless there's a chain (with else) and one of the elements in the chain has a multi-line block. we've decided to be lax about this
  • Use a switch when examining an enum, not an if chain or ?: operator.
  • Only use => if both sides fit on the same line or if the expression is a single constructor call.
@pq pq added type-enhancement A request for a change that isn't a bug linter-lint-request labels Oct 16, 2015
This was referenced Oct 30, 2015
@pq
Copy link
Member

pq commented Dec 2, 2015

For reference, the wrapper bits we want to do away with (formerly skyanalyzer) are now here.

@pq
Copy link
Member

pq commented Jun 27, 2018

@Hixie : closing for staleness. Feel free to re-open or harvest into a fresh ticket.

Thanks!

@pq pq closed this as completed Jun 27, 2018
@Hixie
Copy link
Contributor Author

Hixie commented Jun 27, 2018

I don't understand. In what sense is it stale?

(I can't reopen.)

@pq pq reopened this Jun 27, 2018
@pq
Copy link
Member

pq commented Jun 27, 2018

Sorry, too brash. I was meaning possibly not up to date and maybe superseded by individual issues. Happy to keep it open. 👍

@Hixie
Copy link
Contributor Author

Hixie commented Jun 27, 2018

I've updated the list slightly but it's mostly still the same as before.

@pq
Copy link
Member

pq commented Jun 27, 2018

Awesome thanks!

it's mostly still the same as before.

(Though that is a little sad.)

@pq
Copy link
Member

pq commented Jan 25, 2019

See also: flutter/website#1985.

@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
@pq pq added the P3 A lower priority bug or feature request label Nov 20, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-lint-request P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants