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

chore: report and fix unused ESLint disable directives #12548

Merged

Conversation

HonkingGoose
Copy link
Collaborator

@HonkingGoose HonkingGoose commented Nov 8, 2021

Changes:

  • Use --report-unused-disable-directives 1 to make ESLint complain when we leave non-functional directives in the code

Context:

I've deliberately not fixed any ESLint errors, so that you can check the GitHub Action logs to see what the output is.

I'll take suggestions from you if the directive is really no longer used via GitHub review suggestions. 😉

Please read the ESLint documentation as well, to see if this is suitable for us.

ESLint log (current at time of opening PR)
gitpod /workspace/renovate $ yarn eslint
yarn run v1.22.17
$ eslint --ext .js,.mjs,.ts lib/ test/ tools/ --report-unused-disable-directives

/workspace/renovate/lib/config/decrypt.spec.ts
  58:35  error  Unused eslint-disable directive (no problems were reported from 'no-template-curly-in-string')

/workspace/renovate/lib/config/global.ts
  32:28  error  Unused eslint-disable directive (no problems were reported from 'no-param-reassign')

/workspace/renovate/lib/datasource/git-refs/index.ts
  25:3  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')
  57:3  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')

/workspace/renovate/lib/datasource/git-tags/index.ts
  21:3  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')
  51:3  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')

/workspace/renovate/lib/datasource/jenkins-plugins/get.ts
  104:3  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-shadow')

/workspace/renovate/lib/manager/bundler/extract.ts
  144:11  error  Unused eslint-disable directive (no problems were reported from 'no-loop-func')
  170:11  error  Unused eslint-disable directive (no problems were reported from 'no-loop-func')

/workspace/renovate/lib/manager/gradle/deep/build-gradle.spec.ts
  648:103  error  Unused eslint-disable directive (no problems were reported from 'no-template-curly-in-string')

/workspace/renovate/lib/manager/npm/extract/index.ts
  52:3  error  Unused eslint-disable directive (no problems were reported from 'no-underscore-dangle')

/workspace/renovate/lib/platform/azure/index.spec.ts
  50:3  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-unused-vars')

/workspace/renovate/lib/platform/azure/index.ts
  722:9  error  Unused eslint-disable directive (no problems were reported from 'no-return-await')

/workspace/renovate/lib/platform/azure/util.ts
  126:3  error  Unused eslint-disable directive (no problems were reported from 'promise/avoid-new')

/workspace/renovate/lib/platform/bitbucket/index.ts
  585:1  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-unused-vars')

/workspace/renovate/lib/util/regex.ts
  3:1  error  Unused eslint-disable directive (no problems were reported from 'import/no-cycle')

/workspace/renovate/lib/versioning/index.spec.ts
  115:9  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')
  120:9  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')

/workspace/renovate/lib/versioning/loose/utils.spec.ts
  34:7  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')
  39:7  error  Unused eslint-disable directive (no problems were reported from 'class-methods-use-this')

/workspace/renovate/lib/workers/global/config/parse/env.ts
  132:3  error  Unused eslint-disable directive (no problems were reported from 'no-param-reassign')

/workspace/renovate/lib/workers/repository/error.ts
  203:3  error  Unused eslint-disable directive (no problems were reported from 'no-undef')

/workspace/renovate/lib/workers/repository/init/vulnerability.ts
  177:17  error  Unused eslint-disable directive (no problems were reported from 'no-loop-func')

/workspace/renovate/lib/workers/repository/updates/generate.ts
   95:5   error  Unused eslint-disable directive (no problems were reported from 'no-param-reassign')
  238:56  error  Unused eslint-disable directive (no problems were reported)
  241:54  error  Unused eslint-disable directive (no problems were reported)

/workspace/renovate/tools/check-re2.mjs
  7:51  error  Unused eslint-disable directive (no problems were reported from 'import/no-extraneous-dependencies')

✖ 27 problems (27 errors, 0 warnings)

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Footnotes

  1. https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives

viceice
viceice previously approved these changes Nov 8, 2021
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

Those should be fixed 🙃

@viceice
Copy link
Member

viceice commented Nov 8, 2021

We can't make suggestions to arbitrary files. Are those issues auto-fixable?

@HonkingGoose
Copy link
Collaborator Author

We can't make suggestions to arbitrary files.

I'll go fix them myself then, so you can see what ESLint wants us/me to change. 😉

Are those issues auto-fixable?

Not with our current ESLint 😞, but we can with ESLint 8! 🥳 🎈

"eslint": "7.32.0",

Quote from ESLint 8 release notes on their blog 1

Autofix can now remove unused disable directives when --fix and --report-unused-disable-directives are used together.

Footnotes

  1. https://eslint.org/blog/2021/10/eslint-v8.0.0-released#highlights

@viceice
Copy link
Member

viceice commented Nov 8, 2021

ok, so leave as is for now, I'll try to upgrade eslint first.

@viceice viceice marked this pull request as draft November 8, 2021 11:22
@HonkingGoose

This comment has been minimized.

@HonkingGoose HonkingGoose added the status:blocked Issue is blocked by another issue or external requirement label Nov 8, 2021
@viceice
Copy link
Member

viceice commented Nov 8, 2021

ref #12550

@HonkingGoose

This comment has been minimized.

@HonkingGoose HonkingGoose marked this pull request as ready for review November 8, 2021 16:53
@HonkingGoose HonkingGoose removed the status:blocked Issue is blocked by another issue or external requirement label Nov 8, 2021
@HonkingGoose HonkingGoose changed the title chore: report unused ESLint disable directives chore: report and fix unused ESLint disable directives Nov 8, 2021
@viceice viceice merged commit ab01819 into renovatebot:main Nov 8, 2021
@HonkingGoose HonkingGoose deleted the chore/report-unused-eslint-directives branch November 8, 2021 19:57
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 29.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2021
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