Closed pvcresin closed 4 years ago
Hi @pvcresin Try to use eslint-webpack-plugin
@ricardogobbosouza I'll give it a shot.
@ricardogobbosouza I tried, but I got another error and it doesn't work. https://github.com/pvcresin/eslint-webpack-error I'm getting an error in webpack.config.js.
yarn start
yarn run v1.22.4
$ webpack-dev-server --mode development
✖ 「wdm」: [ESLintError:
/Users/pvcresin/Desktop/eslint-plugin-error/webpack.config.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: webpack.config.js.
The file must be included in at least one of the projects provided
✖ 1 problem (1 error, 0 warnings)
] {
name: 'ESLintError'
}
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
I found an issue with a similar error, but it wasn't very helpful. https://github.com/typescript-eslint/typescript-eslint/issues/864
@pvcresin set extensions:
new ESLintPlugin({
extensions: ['ts', 'tsx'],
failOnError: true,
})
@ricardogobbosouza Thank you. The correct error was obtained!
$ webpack-dev-server --mode development
✖ 「wdm」: [ESLintError:
/Users/pvcresin/.Trash/eslint-plugin-error/src/main.ts
1:7 error 'a' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
] {
name: 'ESLintError'
}
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
https://github.com/pvcresin/eslint-webpack-error [Problem] I fixed the code and the error doesn't go away. And I can't get through to ts-loader.
const a = 100;
1:7 error 'a' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
] {
name: 'ESLintError'
}
And fix.
const a = 100;
console.log(a);
But stil...
1:7 error 'a' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
] {
name: 'ESLintError'
}
@ricardogobbosouza Am I using failOnError incorrectly? https://github.com/pvcresin/eslint-webpack-error Does failOnError mean that once it fails, I have to restart webpack-dev-server? Does that mean I can't check for ESLint errors every time I save a file?
@ricardogobbosouza I totally get it. I was wrong. It works!!
new ESLintPlugin({
extensions: ['ts', 'tsx'],
// failOnError: true,
}),
It's hard to read English... Thanks for the quick reply.
https://stackoverflow.com/questions/61617087/eslint-loader-failonerror-option-doesnt-work-with-ts-loader-and-webpack-dev-ser
I'm not sure this problem is with the eslint-loader. Let me know if I'm wrong.