Skip to content

Fix eslint #33002

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

Merged
merged 2 commits into from
Dec 27, 2024
Merged

Fix eslint #33002

merged 2 commits into from
Dec 27, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Dec 27, 2024

Fix #32982
Related #32869

  • eslint-plugin-github 5.1.x doesn't work well with eslint8
  • no-undef is still needed

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 27, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 27, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 27, 2024
@wxiaoguang wxiaoguang enabled auto-merge (squash) December 27, 2024 19:30
@wxiaoguang wxiaoguang merged commit ea198f9 into go-gitea:main Dec 27, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.24.0 milestone Dec 27, 2024
@wxiaoguang wxiaoguang deleted the fix-eslint branch December 27, 2024 19:42
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 30, 2024
* giteaofficial/main:
  Refactor pagination (go-gitea#33037)
  Test webhook email (go-gitea#33033)
  Fix review code comment avatar alignment (go-gitea#33031)
  Fix templating in pull request comparison (go-gitea#33025)
  Refactor tests (go-gitea#33021)
  [skip ci] Updated translations via Crowdin
  always show assignees on right (go-gitea#33006)
  fix toggle commit body button ui when latest commit message is long (go-gitea#32997)
  Fix and/or comment some legacy CSS problems (go-gitea#33015)
  Refactor comment history and fix content edit (go-gitea#33018)
  Fix bug on activities (go-gitea#33008)
  Refactor arch route handlers (go-gitea#32993)
  fix scoped label ui when contains emoji (go-gitea#33007)
  [skip ci] Updated translations via Crowdin
  De-emphasize signed commits (go-gitea#31160)
  Fix eslint (go-gitea#33002)
  Fix Agit pull request permission check (go-gitea#32999)
  Support for email addresses containing uppercase characters when activating user account (go-gitea#32998)
@@ -674,7 +674,7 @@ module.exports = {
'no-this-before-super': [2],
'no-throw-literal': [2],
'no-undef-init': [2],
'no-undef': [0],
'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do think it is correct to have it enabled at the moment, otherwise IDE (I am using GoLand) won't report errors, which makes difficult write correct code (for example, remove import $)

Copy link
Member

@silverwind silverwind Jan 14, 2025

Choose a reason for hiding this comment

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

Pretty sure that's a problem with your IDE. Definitely if the CLI error reporting is different from your IDE.

As for JetBrains IDEs: Isn't one supposed to use WebStorm or something for Typescript?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As for JetBrains IDEs: Isn't one supposed to use WebStorm or something for Typescript?

The lint result comes from eslint CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or, could you show how to correctly lint the "undefined $" errors? You could just remove the import $ from a JS file, and try to see whether there is any lint error (either from eslint or other tools)

Copy link
Member

Choose a reason for hiding this comment

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

What do you expect when removing import $? The global to work, so it not raises an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you expect when removing import $? The global to work, so it not raises an error?

It should raise an error, there is no global $

Copy link
Member

@silverwind silverwind Jan 14, 2025

Choose a reason for hiding this comment

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

Right, it should as there is no global defined here and env.jquery is also not set:

gitea/.eslintrc.cjs

Lines 51 to 54 in 6410c34

globals: {
__webpack_public_path__: true,
process: false, // https://github.com/webpack/webpack/issues/15833
},

I will check later why it does not error.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE/eslint doesn't report un-imported $ as undefined any more
5 participants