Skip to content

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

Closed
@jsjoeio

Description

@jsjoeio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreRelated to maintenance or clean upenhancementSome improvement that isn't a feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions