Skip to content
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

fix(cloud_firestore_odm): Update ignored lints in generated files #9683

Merged

Conversation

Rexios80
Copy link
Contributor

@Rexios80 Rexios80 commented Oct 5, 2022

Description

Changes:

  • Adds some missing lint rules to the ignore_for_file list: require_trailing_commas, prefer_single_quotes, prefer_double_quotes, use_super_parameters
  • Converts all double quotes in generated files to single quotes for consistency

Notes:

  • I would like to not exclude generated files from analysis, but this project's enforcement of implicit-dynamic seems to make that impossible without more changes that are outside the scope of this PR
    • Especially with this package, it's really easy to generate code with errors, and excluding generated files from analysis hides those. For example, freezed.g.dart was missing the import for package:cloud_firestore/cloud_firestore.dart, but the analyzer didn't make that obvious since the file was excluded from analysis.
    • Excluding generated files from analysis makes it impossible to enforce consistent style such as single vs double quotes. This doesn't matter for projects that use the generator, but since this is the generator it would be nice to enforce it.
    • Pana (the package analyzer) doesn't respect analysis exclusions, so you run the risk of having code pass analysis locally, but losing points on pub.dev
  • I have a tool that needs to know if a project requires flutter based on the pubspec, so I added it to the dependencies for cloud_firestore_odm_generator. If you would like me to remove it just let me know.

Related Issues

N/A

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@Rexios80 Rexios80 changed the title [cloud_firestore_odm] Fix generated odm lints [cloud_firestore_odm] fix: generated odm lints Oct 5, 2022
@Rexios80 Rexios80 changed the title [cloud_firestore_odm] fix: generated odm lints fix(cloud_firestore_odm) generated odm lints Oct 5, 2022
@Rexios80 Rexios80 changed the title fix(cloud_firestore_odm) generated odm lints fix(cloud_firestore_odm): generated odm lints Oct 5, 2022
@rrousselGit rrousselGit changed the title fix(cloud_firestore_odm): generated odm lints fix(cloud_firestore_odm): Update ignored lints in generated files Oct 6, 2022
@rrousselGit
Copy link
Contributor

You should be able to do this without modifying the ODM by configuring your build.yaml
The build.yaml allows adding custom lines of code at the top of the generated .g.dart files.

But these changes are reasonable, so I'll accept them.

Copy link
Contributor

@rrousselGit rrousselGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rrousselGit rrousselGit merged commit 3ab283b into firebase:master Oct 6, 2022
@firebase firebase locked and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants