Errors specifically added in the code for testing purposes, but no warnings or errors are emitted in the output. The commented lines in the plugin are the attempts I made.
I also tried with the deprecated eslint-loader and it seems to work, I didn't analized the output. Calling eslint from command line works
Other tries:
- Changed the plugin order
- Removed other plugins
- npm clean-install
- upgraded all packages
- imported .eslintrc directly in plugin options with options.baseConfig
- used the webpack-format extensions array: ['.ts', '.tsx']
module.exports = {
target: 'node',
mode: 'production',
node: {
__dirname: false,
__filename: false,
},
entry: [path.resolve(__dirname, '..', '..', 'src', 'server', 'server.tsx')],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
output: {
path: path.resolve(__dirname, '..', '..', 'build'),
filename: 'server.js',
},
optimization: {
minimize: false,
},
externalsPresets: {
node: true,
},
plugins: [
new ESLintPlugin({
// files: 'src/**/*',
// context: 'src',
extensions: ['ts', 'tsx'],
emitError: true,
emitWarning: true,
}),
//...
],
module: {
rules: [
//...
{
test: /\.tsx?$/,
use: {
loader: 'babel-loader',
options: {
comments: true,
sourceMaps: false,
presets: ['@babel/preset-env', '@babel/react', '@babel/typescript'],
plugins: [
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
'@babel/transform-runtime',
],
},
},
},
//...
]
},
};
my .eslintrc
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
"prettier/react"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2020,
"sourceType": "module",
"tsconfigRootDir": "/"
},
"rules": {
"react/prop-types": 0,
"prettier/prettier": 1,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-module-boundary-types": 0
},
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true,
"node": true,
"es2020": true
}
}