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.

[eslint] Rewired eslint is using wrong version of eslint and plugins

See original GitHub issue

Thanks for this super-helpful project! I really like how it’s designed and how extensible it is.

I ran into an interesting issue. I’ve found a work-around, but I’m opening this issue to see if this is something you’d like to have fixed here instead.

In my project, I want to use my own eslint configuration, which includes newer versions of some of the plugins that create-react-app uses.

When I run eslint directly, everything works fine. But when CRA runs eslint as part of its webpack pipeline, it runs the version of eslint (and therefore its plugins) that are down in node_modules/react-scripts/node_modules.

My work-around is to use the undocumented overrides parameter from #122 to re-resolve the location of eslint being passed to eslint-loader relative to my project:

const rewireEslint = require("react-app-rewire-eslint");

const overrideOptions = options => {
  options.eslintPath = require.resolve("eslint");
};

module.exports = function override(config, env) {
  config = rewireEslint(config, env, overrideOptions);
  return config;
}

Is this something that should be done in this package instead? Maybe with some protection to only do the replacement if there is a version of eslint installed locally?

If so, I can try to find some time to work on a PR for it. At the very least, the override option needs to be documented. I’ll try to work on a PR for that as well.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timarneycommented, Apr 24, 2018

@jlaustill the next version of this package is stale at the moment while react-scripts does it’s thing. That is to say don’t try using it yet.

@randycoulman seems this issue is also stale with no feedback from some folks who have been helping maintain that package. Going to close and leave it at the documentation update that was merged.

1reaction
timarneycommented, Mar 24, 2018

Merged the PR (for the docs) - will wait it see if anyone else comments. I don’t use this package myself so would rather get thoughts from people who do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My create-react-app is failing to compile due to ESLint error
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder. 2. Delete node_modules in your project folder. 3.
Read more >
Migrating to v7.0.0 - ESLint - Pluggable JavaScript Linter
Plugin resolution has been updated. In previous versions, ESLint resolved all plugins from the current working directory by default. Starting in ESLint v7.0.0, ......
Read more >
Migrating to v8.0.0 - ESLint - Pluggable JavaScript Linter
One important thing to double check is the Node.js version supported by your editor when using ESLint via editor integrations. If you are...
Read more >
Working with Plugins - ESLint - Pluggable JavaScript Linter
To use the rule in ESLint, you would use the unprefixed plugin name, followed by a slash, followed by the rule name. So...
Read more >
How to add a custom ESLint configuration to a Create React ...
To checkout the rules and plugins used in react-app ESLint config, click here. Why use a custom configuration? Mind you that most of...
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