Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Reload .eslintrc when it's changed #43

Closed
dashed opened this issue Jun 5, 2015 · 14 comments
Closed

Reload .eslintrc when it's changed #43

dashed opened this issue Jun 5, 2015 · 14 comments

Comments

@dashed
Copy link

dashed commented Jun 5, 2015

Minor nitpick.

When using webpack with watch: true, and editing .eslintrc, I'd have to restart webpack for the new .eslintrc changes to take effect.

@frontsideair
Copy link

I'd like to see that too.

@MoOx
Copy link
Contributor

MoOx commented Feb 24, 2016

PR are always welcome

@slightlytyler
Copy link

Have also run into an issue where I need similar functionality to accommodate https://github.com/apollographql/eslint-plugin-graphql. In my case I need to force eslint-loader to reload .eslintrc on every build. I see #151 and am wondering which of the cases described in this issue are satisfied by it. If my case is not covered I'll gladly contribute to that PR or another

@peternewnham
Copy link
Contributor

#151 still requires webpack to be restarted when changes are made to the rules so doesn't address this issue.

It also needs to be considered that there could be multiple .eslintrc files located anywhere in the project (see #123 and configFile option) and rules could also be applied directly to the eslint-loader options.

@sudo-suhas
Copy link
Contributor

@MoOx I would like to work on this. Could you please help me figure out the approach?

@MoOx
Copy link
Contributor

MoOx commented Sep 19, 2017

I guess you should somehow watch for the file being used, and reload it in memory. Nothing is made to support this so you will need to handle this from scratch I guess.

@sudo-suhas
Copy link
Contributor

With eslint, there may not be just one eslint config file right? Would also need to invalidate cache when the config is modified.

@MoOx
Copy link
Contributor

MoOx commented Sep 19, 2017

I guess so. Not an easy problem to solve and might open up to lots of bugs. Not sure if that's a good idea. If you work on your config, you should probably more play with eslint cli & files directly.

@sudo-suhas
Copy link
Contributor

This is what I have so far.

  • Get the eslint config files using globby and the pattern ["**/.eslintrc.*", "package.json", "!node_modules/**/*"].
  • Hash these files using hash-files and use it as part of the cacheIdentifier. However, this module is a little broken as the glob file resolution does not work correctly(hence the need for globby). Maybe I could use hasha instead.

However, this isn't enough as the eslint.CLIEngine seems to cache the config as well. How do you suggest I handle this?

@sudo-suhas
Copy link
Contributor

@MoOx Could you please help me out a little?

@langri-sha
Copy link

Worth considering is that ESLint can also be configured via package.json. See Using Configuration Files.

@MoOx
Copy link
Contributor

MoOx commented Nov 21, 2017

@sudo-suhas sorry I don't know where to start with this. The codebase is pretty small so you should try to understand it, check automated tests and see how you can tackle the problem. Feel free to ask questions if you need some detailed informations about a specific problem/ piece of code.

@ricardogobbosouza
Copy link
Collaborator

Use nodemon for this.
Ex: nodemon --watch .eslintrc.js --exec webpack

@DanielSchaffer
Copy link

@ricardogobbosouza that's not ideal - you lose all the benefits you get from running Webpack in watch mode

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants