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

Enable, a basic version of, the ESLint no-use-before-define rule #12893

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Given how our existing code-base is written, we simply can't (and probably don't want to) enable all of this ESLint rule. The reason is that we have a lot of code, especially related to functions, which is fine at runtime but might to a static analyzer look like a problem.
However, even in its most basic version this ESLint rule can help catch some outright bugs; see PR #12891.

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/no-use-before-define

@Snuffleupagus
Copy link
Collaborator Author

/botio lint

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_lint from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/04f838fa5b5325a/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_lint from @Snuffleupagus received. Current queue size: 0

Live output at: http://3.101.106.178:8877/3f5140f265da1ab/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/04f838fa5b5325a/output.txt

Total script time: 2.42 mins

  • Lint: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/3f5140f265da1ab/output.txt

Total script time: 3.21 mins

  • Lint: FAILED

@calixteman
Copy link
Contributor

Maybe we could run at least such checkers on the changed lines in a patch.

@Snuffleupagus
Copy link
Collaborator Author

Snuffleupagus commented Jan 23, 2021

Maybe we could run at least such checkers on the changed lines in a patch.

I don't think ESLint is easily able to do that. Anyway, this patch on its own is sufficient to catch the bug.

@timvandermeij
Copy link
Contributor

Looks good to me with a rebase onto the current master to see if the failure disappears.

Given how our existing code-base is written, we simply can't (and probably don't want to) enable *all* of this ESLint rule. The reason is that we have a lot of code, especially related to functions, which is fine at runtime but might to a static analyzer *look* like a problem.
However, even in its most *basic* version this ESLint rule can help catch some outright bugs; see PR 12891.

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/no-use-before-define
@Snuffleupagus Snuffleupagus force-pushed the eslint-no-use-before-define branch from 18b5355 to 61ceae6 Compare January 23, 2021 15:23
@Snuffleupagus
Copy link
Collaborator Author

Looks good to me with a rebase onto the current master to see if the failure disappears.

As expected, it did :-)

@timvandermeij timvandermeij merged commit 7102e4a into mozilla:master Jan 23, 2021
@timvandermeij
Copy link
Contributor

Thank you!

@Snuffleupagus Snuffleupagus deleted the eslint-no-use-before-define branch January 23, 2021 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants