webpack-contrib / eslint-loader

[DEPRECATED] A ESlint loader for webpack
MIT License
1.06k stars 121 forks source link

relative path is wrong when use eslint-loader in monorepo #335

Closed githoniel closed 4 years ago

githoniel commented 4 years ago

https://github.com/webpack-contrib/eslint-loader/blob/ed54da536155743dd4dd52d1cfd53e933aadae44/src/Linter.js#L21-L33

My project is using Lerna and fold structure is like below

- packages
  - @gem-mine
     - glaucus
     - glaucus-plugin-align
     - glaucus-plugin-hr

I will run webpack in @gem-mine/glaucus, so the process.cwd would be ${workspaceFolder}/packages/@gem-mine/glaucus.When I'm using file from 'glaucus-plugin-align' folder, eg glaucus-plugin-align/src/index.js, the resourcePath would be ${workspaceFolder}/packages/@gem-mine/glaucus-plugin-align/src/index/js.

The above code would think they are relative and then set resoucePath to plugin-align/src/index/js.

I'm using @typescript-eslint that it will restore fullPath to ${workspaceFolder}/packages/@gem-mine/glaucus/plugin-align/src/index/js and consider the file is missing....

ricardogobbosouza commented 4 years ago

Please use eslint-webpack-plugin. eslint-loader will be deprecated.