question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modify overrides to also override/add globals

See original GitHub issue

The version of ESLint you are using. v4.19.1

The problem you want to solve. For test files within our lib directory, we’d like to specify mocha-specific globals like it and describe, but ideally we wouldn’t allow those globals in product code.

Your take on the correct solution to problem. It seems like overrides provides the perfect solution here – but as far as I can tell it only overrides rules right now, so we can’t use it to add globals. Can overrides easily be modified to define a new set of globals as well?

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, May 29, 2018

Hi @thomascmost, thanks for the issue.

At the very least, you should be able to use environments (env) to enable the Mocha environment, which enables the Mocha globals (although, unfortunately, you don’t get fine-grained control of what globals to allow and disallow-- you could use no-restricted-globals to work around that if needed).

That said, it would be nice to handle globals in overrides. I’ll mark this as a core enhancement request.

0reactions
mysticateacommented, Apr 5, 2019

overrides supports globals and other properties since v4.1.0.

  • A glob specific configuration works almost the same as any other ESLint config. Override blocks can contain any configuration options that are valid in a regular config, with the exception of extends, overrides, and root.

https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Override Add-on
This add-on allows you to override some of the settings of notifications directly when editing a post, page, or custom post type. You...
Read more >
Create overrides for a collection in your render layer | Maya ...
To create an override, middle-mouse drag and drop an attribute from the Attribute Editor to the Property Editor. You can also disable an ......
Read more >
Knowing When to Use Override and New Keywords - C# ...
The override modifier extends the base class virtual method, and the new modifier hides an accessible base class method.
Read more >
Installing & Configuring our Cancel Override Add-on
To set per membership cancel override, open the membership edit page in the MemberPress → Memberships page, scroll down to Membership Options, ...
Read more >
How to Override Existing React Components
The sub-components also receive sharedProps . The latter is a set of props concerning the component state, and these props are used to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found