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

[eslint] disallow unused collections, enable no-inverted-boolean-check rule #4974

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dimaMachina
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Jun 13, 2024

⚠️ No Changeset found

Latest commit: 5441e84

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jun 13, 2024

🐋 This PR was built and pushed to the following Docker images (tag: 5441e847acb4266901b6b1ee34783062e52ccd5a):

Docker Bake metadata
{
"app": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/t3nrkkc19ghct4zxydxvhp4ge",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:70dc4e8731a8c111bc5c9e9be9d130e228eec930555d7cacf4274948f04c4d80",
    "size": 685
  },
  "containerimage.digest": "sha256:70dc4e8731a8c111bc5c9e9be9d130e228eec930555d7cacf4274948f04c4d80",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/app:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/app:no_unused_collections"
},
"composition-federation-2": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/zm95nzy49ncvwk8yyfltp2xj2",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:f828387f67f490459d7fe003017a539a7c9c8e2ea3de98bd755744ae3c60e93b",
    "size": 685
  },
  "containerimage.digest": "sha256:f828387f67f490459d7fe003017a539a7c9c8e2ea3de98bd755744ae3c60e93b",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/composition-federation-2:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/composition-federation-2:no_unused_collections"
},
"emails": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/rdstuxrdmur36qiuekme7syb5",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:8283f88339a39645b8c967d3842f7d80633e7ae3a36bb2861bb18795917bad5d",
    "size": 685
  },
  "containerimage.digest": "sha256:8283f88339a39645b8c967d3842f7d80633e7ae3a36bb2861bb18795917bad5d",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/emails:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/emails:no_unused_collections"
},
"policy": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/sb4tzwhavfpvov9uep9e78kur",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:1ea29ded5cf95c5ec43e15d4620d4f546195df22d2972a64a3b10f1ec2989e89",
    "size": 685
  },
  "containerimage.digest": "sha256:1ea29ded5cf95c5ec43e15d4620d4f546195df22d2972a64a3b10f1ec2989e89",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/policy:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/policy:no_unused_collections"
},
"rate-limit": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/nnzecfbm3k21bw47wy7rkcc27",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:85375008924739b51a369277a018c6d1f7041647dbda1ce492969fd8c1e30c91",
    "size": 685
  },
  "containerimage.digest": "sha256:85375008924739b51a369277a018c6d1f7041647dbda1ce492969fd8c1e30c91",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/rate-limit:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/rate-limit:no_unused_collections"
},
"schema": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/nglihfm9yo2j5xiq22ybnh6a5",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:f41276a2ab9b5138544020eb6988de9e9b78a7c3dc5ce93e2ab07902e2129410",
    "size": 685
  },
  "containerimage.digest": "sha256:f41276a2ab9b5138544020eb6988de9e9b78a7c3dc5ce93e2ab07902e2129410",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/schema:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/schema:no_unused_collections"
},
"server": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/thu2qm7nqkb6u9isoiw7t6ys0",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:8241f90011b29483759fb3bb4382eeb2755929d052472a0add925e164e487dda",
    "size": 685
  },
  "containerimage.digest": "sha256:8241f90011b29483759fb3bb4382eeb2755929d052472a0add925e164e487dda",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/server:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/server:no_unused_collections"
},
"storage": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/zjmmvm0qfn2rf8gs6kvrdp9b4",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:f313df8d112bf00b598410953f935c3cb0d85deba9c818f0fdffe50b92fa0c23",
    "size": 685
  },
  "containerimage.digest": "sha256:f313df8d112bf00b598410953f935c3cb0d85deba9c818f0fdffe50b92fa0c23",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/storage:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/storage:no_unused_collections"
},
"stripe-billing": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/i5utpudc3c2auo5ht7sdk4yik",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:e443d2cace333e1ebc2ce4ce3f426749cf112ddf30d27682ecdd36c73579276f",
    "size": 685
  },
  "containerimage.digest": "sha256:e443d2cace333e1ebc2ce4ce3f426749cf112ddf30d27682ecdd36c73579276f",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/stripe-billing:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/stripe-billing:no_unused_collections"
},
"tokens": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/gn5s97zat6vvf3p3rwlqmqx6k",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:77985d13415241da1917f7ca8b12584f5fc4bd6eac257e45f79cebd4e02604d3",
    "size": 685
  },
  "containerimage.digest": "sha256:77985d13415241da1917f7ca8b12584f5fc4bd6eac257e45f79cebd4e02604d3",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/tokens:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/tokens:no_unused_collections"
},
"usage": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/icqvsgiofrxad6t500ysuhhz3",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:a5ec1ddf269cd68f87c597b21d9321b5ca9fdaecdb4e447300f0975b74e7e117",
    "size": 685
  },
  "containerimage.digest": "sha256:a5ec1ddf269cd68f87c597b21d9321b5ca9fdaecdb4e447300f0975b74e7e117",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/usage:no_unused_collections"
},
"usage-estimator": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/w4dqr2qkmz4syhv1ir4jrrfaz",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:05050d0fe4c400d028c0012a607ae2b78a14aa832a364cb0cc990e55665a98c0",
    "size": 685
  },
  "containerimage.digest": "sha256:05050d0fe4c400d028c0012a607ae2b78a14aa832a364cb0cc990e55665a98c0",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage-estimator:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/usage-estimator:no_unused_collections"
},
"usage-ingestor": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/fns8uryaxq4rcesg74acmrd09",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:2bc5a19c9c34b87de335c287cf73ca1de6395f59bb640971eeef371f4d393c53",
    "size": 685
  },
  "containerimage.digest": "sha256:2bc5a19c9c34b87de335c287cf73ca1de6395f59bb640971eeef371f4d393c53",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage-ingestor:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/usage-ingestor:no_unused_collections"
},
"webhooks": {
  "buildx.build.ref": "builder-62d9f79e-8ce5-4475-8173-02384b79ed48/builder-62d9f79e-8ce5-4475-8173-02384b79ed480/g935oz0eqg5njvuer3dnvvqvz",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:188e56f1b55f30b1d54a5036ba0070efcb73438cecf1316080f98ad30db92bec",
    "size": 685
  },
  "containerimage.digest": "sha256:188e56f1b55f30b1d54a5036ba0070efcb73438cecf1316080f98ad30db92bec",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/webhooks:5441e847acb4266901b6b1ee34783062e52ccd5a,ghcr.io/kamilkisiela/graphql-hive/webhooks:no_unused_collections"
}
}

@kamilkisiela
Copy link
Owner

I'm not fine with adding more eslint rules to this codebase, we should aim to have the least amount possible and enable only those that have a real impact on users (like preventing bugs). This one is just about the "style" of code and I honestly don't care.

@dimaMachina
Copy link
Collaborator Author

dimaMachina commented Jun 14, 2024

sonarjs/no-unused-collection prevents mistakes when a collection is populated but its contents are never used
sonarjs/no-inverted-boolean-check removes extra boolean cast

@kamilkisiela
Copy link
Owner

kamilkisiela commented Jun 14, 2024

We can do a deal :D
I accept sonarjs/no-unused-collection but you remove sonarjs/no-inverted-boolean-check, because it's really just about style

.eslintrc.cjs Outdated
Comment on lines 125 to 126
'sonarjs/no-unused-collection': 'error',
'sonarjs/no-inverted-boolean-check': 'error',
Copy link
Owner

Choose a reason for hiding this comment

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

Make it a warning and I'll accept it. Unused code should not be an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants