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.

Overrides not applied

See original GitHub issue

Environment

  • ESLint Version: 4.18.2 and 4.19.1
  • Node Version: 6.11.3
  • ~npm~ Yarn Version: 1.5.1

What parser (default, Babel-ESLint, etc.) are you using?

babel-eslint

Configuration

project/.eslintrc

{
  "env": {
    "es6": true
  },
  "extends": "airbnb", // includes func-names, no-unused-expressions, prefer-arrow-callback
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 2018
  },
  "plugins": [
    "import"
  ],
  "root": true,
  "rules": {
    // …
  },
  "overrides": [
    {
      // for spec files
      "env": {
        "mocha": true,
      },
      "files": [
        "**/*.spec.js",
        "**/*.spec.jsx"
      ],
      "rules": {
        "func-names": "off",
        "no-unused-expressions": "off",
        "prefer-arrow-callback": [
          "error",
          "never"
        ]
      }
    }
  ],
  "settings": {
    "import/resolver": "webpack"
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

project/src/…/index.spec.jsx

describe('SomeComponent', function () {
  // …
});

What did you expect to happen?

Overrides to be applied

What actually happened? Please include the actual, raw output from ESLint.

Errors for all 3 rules in the override block

22:1   error    'describe' is not defined        no-undef
22:32  error    Unexpected function expression   prefer-arrow-callback
22:32  warning  Unexpected unnamed function      func-names

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
aladdin-addcommented, Jul 17, 2018

@zetaraku in your case, the env should be top-level.

{
  "files": [...],
  "env": {
   ...
  }
}

0reactions
donaldpipowitchcommented, Jan 24, 2019

For me it doesn’t seem to work when I write my config like this:

module.exports = {
  ...require('./some-shared-config'),
  overrides: [
    {
      files: [`*.js`],
      rules: {
        'no-console': 'off'
      }
    }
  ]
};

Adding overrides directly into './some-shared-config' works, but I’d expect it to behave in the same way 🤔

It looks like this doesn’t work either:

module.exports = {
  extends: './packages/ws/.eslintrc.js',
  overrides: [
    {
      files: [`*.js`],
      rules: {
        'no-console': 'off'
      }
    }
  ]
};

Update

It looks like I needed to rename my .eslintrc.js which I used as a base (e.g. .eslintrc.base.js).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local Overrides Not Working - Google Groups
Configure (enable) Local Overrides; From DevTools > Network panel, right click on webpage1.html and select 'Save for overrides' (only showing up for Canary)...
Read more >
React App and Chrome DevTools local overrides not working?
I have tried to do local overrides through the chrome dev tools on other non react sites, there it is working. Am I...
Read more >
Local overrides not working: "Changes to this file were not ...
I've been using local overrides in multiple Chromium browsers (Chrome, Brave, Edge, and Canary) to modify JS for a particular site for many ......
Read more >
Using Local Overrides in DevTools | A Faster Web
Not only does the overrides feature allow you to experiment with design ... If you're working on a site locally, these new features...
Read more >
Graphic overrides are not working for certain elements within ...
Graphic overrides are not working for certain elements within a Revit view · Issue: When trying to change the appearance of elements within...
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