Skip to content

Add ESLint rule to limit use of global values to specific files #3856

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

Closed
jsjoeio opened this issue Jul 26, 2021 · 1 comment
Closed

Add ESLint rule to limit use of global values to specific files #3856

jsjoeio opened this issue Jul 26, 2021 · 1 comment
Labels
chore Related to maintenance or clean up enhancement Some improvement that isn't a feature
Milestone

Comments

@jsjoeio
Copy link
Contributor

jsjoeio commented Jul 26, 2021

Follow-up to the conversation between @code-asher and I here.

Premise

During the refactor of src/browser/pages/vscode.ts, we added a couple functions which take in global values i.e. Document and I opted for the _ approach to differentiate between the global vs passed in value.

While this works, it doesn't prevent developers from accidentally using the global values in that file.

Idea

Make it so globals can only be used in entry files and move the non-global code to other files that way it's clear you aren't supposed to use globals (and the compiler won't let you even if you try).

We're not sure if this is possible — maybe with ESLint?

But worth exploring to improve the codebase and prevent future bugs.

@jsjoeio jsjoeio added enhancement Some improvement that isn't a feature chore Related to maintenance or clean up labels Jul 26, 2021
@jsjoeio jsjoeio added this to the On Deck milestone Jul 26, 2021
@stale
Copy link

stale bot commented Jan 22, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.

@stale stale bot added the stale label Jan 22, 2022
@stale stale bot closed this as completed Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to maintenance or clean up enhancement Some improvement that isn't a feature
Projects
None yet
Development

No branches or pull requests

1 participant