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.

Override does not work if rule is defined as "off" by default

See original GitHub issue

This works:

module.exports = {
  'root': true,
  plugins: [
    'example-internal',
  ],
  rules: {},
  overrides: [{
    files: '**/__tests__/*.js',
    rules: {
      'example-internal/no-focused-tests': 2,
    }
  }],
};

But this does not:

module.exports = {
  'root': true,
  plugins: [
    'example-internal',
  ],
  rules: {
    'example-internal/no-focused-tests': 0,
  },
  overrides: [{
    files: '**/__tests__/*.js',
    rules: {
      'example-internal/no-focused-tests': 2,
    }
  }],
};

I’ve pushed a minimum repro here.

Original bug report (outdated, see below discussion)

Based on these docs and discussion threads like this one, I would expect the following rule override to be supported:

'use strict';

module.exports = {
  'root': true,

  plugins: [
    'example-internal',
  ],

  rules: {
    // Off by default
    'example-internal/no-focused-tests': 0,
  },

  overrides: [
    {
      files: '**/__tests__/*.js',
      rules: {
        // On for tests
        'example-internal/no-focused-tests': 2,
      }
    }
  ],
};

Unfortunately my override does not seem to be working. I’ve pushed a minimum repro here. Am I overlooking something obvious?

FWIW, this relates to facebook/react/pull/11977.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Jan 9, 2018

Thanks, I’ll clone and investigate when I get home from work.

1reaction
bvaughncommented, Jan 9, 2018

That was my assumption as well, but it doesn’t hold.

Yes, also happens in latest. (Can be seen in my project currently.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

When override function with default value parameter, how to ...
The superclass is inside a framework. A project uses this framework, and want to override a function with default parameter value, but it...
Read more >
Using application-default with application override
Solved: According to product help for application-default: The selected applications are allowed or denied only on their default ports defined - 5732.
Read more >
12 Rules of Overriding in Java You Should Know
Rule #1:Only inherited methods can be overridden. Because overriding happens when a subclass re-implements a method inherited from a superclass, ...
Read more >
Working with Override Translation Rules - Oracle Help Center
The default view is the To Be Deployed view. If you create a new rule, the rule is displayed in the list with...
Read more >
Custom override rule - Akamai TechDocs
The custom override rule is always last in a configuration, unless you also have an advanced override rule. Advanced override always takes precedence...
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