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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

'no-undefined': [0],
'no-underscore-dangle': [0],
'no-unexpected-multiline': [2],
Expand Down
170 changes: 8 additions & 162 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"eslint": "8.57.0",
"eslint-import-resolver-typescript": "3.7.0",
"eslint-plugin-array-func": "4.0.0",
"eslint-plugin-github": "5.1.4",
"eslint-plugin-github": "5.0.2",
"eslint-plugin-import-x": "4.6.1",
"eslint-plugin-no-jquery": "3.1.0",
"eslint-plugin-no-use-extend-native": "0.5.0",
Expand Down
Loading