Open pq opened 9 years ago
An easy way to tackle this would be to check that argument names start with lowercase. And a similar check for method names would help spot another sneaky case:
class MyClassNameBeforeRefactoring {
// oops, forgot to rename the constructor...
MyClassNameAfterRefactoring() {
// something important that will never happen
}
}
@ochafik for your case a rule for functions and methods like http://dart-lang.github.io/linter/lints/non_constant_identifier_names.html would be nice to catch this.
Looks like this will become irrelevant when the old typedef syntax becomes obsolete?
Yeah I think we've likely dodged this by recommending the new typedef format.
Discovered in the wild a number of cases like this:
typedef A(B);
typedef B(dynamic);
Both of them are essentially equivalent to
dynamic->dynamic
which is most likely not what the user has in mind. Instead, they likely mean:typedef A(B _);
typedef B(dynamic _);
As Paul Berry points out it's a nasty user trap in the language, especially for people coming from a C/C++ background where using a single identifier as a formal parameter denotes the type of the formal parameter. A proposed lint: