New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use eslint with Typescript? #1156
Comments
I have set in my
and then
and then in my
|
@andersnylund Thanks for your input. With the above configuration, I'm able to see typescript errors in the console. But still no eslint warnings. I could see many lint warnings by running |
This is my current config.
|
Tslint is being deprecated for ESLint sometime in 2019, and it's kind of mid November, so razzle should probably create a plan to switch to ESLint. |
Finally, I managed to get both Typescript errors & ESLint warnings on the console using the below config. const ForkTSCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const path = require('path')
module.exports = {
modify(defaultConfig, { target, dev }, webpack) {
const config = defaultConfig
config.resolve.extensions.push('.ts', '.tsx')
config.plugins.push(
new ForkTSCheckerWebpackPlugin({
checkSyntacticErrors: true,
eslint: true,
}))
config.module.rules.push({
test: /\.(ts|js)x?$/,
include: [path.resolve(__dirname, 'src')],
loader: 'babel-loader',
})
}
} And I have my |
Is this PR ready to use? |
@imagine10255 this is not a PR, but we have plans for this we will release new version of |
@nimaa77 Thanks, I am currently integrating typescript, is there any way to use it first? |
@nimaa77 any update? or any way to help? |
This is possible. We have github discussions enabled now. Please move this there :) Also new typescript plugin will use eslint. |
I've added razzle-eslint-plugin and have included it in my razzle.config.js like
The issue is that the console doesn't display any lint warnings for typescript files. If I manually run eslint from console I could see the lint errors, but not while running
razzle start
On checking
razzle-eslint-plugin
source I could see that the rules mention only js & jsx files to be checked as shown belowIf I add
ts|tsx
to the above config, I could promptly see the warnings. But it requires manually editing the file undenode_modules
which I would like to avoid. Is there a way I could extend the config from razzle.config.js? I tried pushing a new rule throughmodule.rules.push
but results in an errorThese relative modules were not found:
If this needs to be added to
razzle-eslint-plugin
I could raise a PR. Please suggestThe text was updated successfully, but these errors were encountered: