simolus3 / web3dart

Ethereum library, written in Dart.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignore non_constant_identifier_names, camel_case_types in generated (.g.dart) files

vinicentus opened this issue · comments

I would like to propose that we automatically include the comment // ignore_for_file: non_constant_identifier_names, camel_case_types in the beginning of every file generated using pub run build_runner build. That way, dart doesn't complain about Name non-constant identifiers using lowerCamelCase and Name types using UpperCamelCase. The rationale behind this suggestion is that the smart contracts, written in another language and perhaps with other naming conventions, shouldn't have to conform to dart's standards, as long as they still work.
This would be especially useful in large projects with multiple contract classes.

If you think this suggestion makes sense, I can create a PR.

RELATED:
Naming can however become a problem, as is evident in #213. In that special case, functions outright won't be acessible from outside the file. Then we might need to actually rename a function (starting with _), or create a public wrapper funtion.

You can also ignore generated files with an analysis_options.yaml file:

analyzer:
  exclude: 
    - '**/*.g.dart'

Yes. That is much cleaner. This probably has to be added manually on a case-by-case basis though? So maybe it could be added to the documentation as an option?

This sounds like something the readme could point out, yes :) Do you want to open a PR for that?

Sure, can do that tomorrow

Created a PR