My Webpack config file is written in TS and type-checked on test/release.
With v4 of fork-ts-checker-webpack-plugin tsc started to complain about a not found declaration file for eslint
node_modules/fork-ts-checker-webpack-plugin/lib/issue/eslint/EsLintIssueFactory.d.ts:1:25 - error TS7016: Could not find a declaration file for module 'eslint'. '/MY_PROJECT_DIR/node_modules/eslint/lib/api.js' implicitly has an 'any' type.
Try `npm install @types/eslint` if it exists or add a new declaration (.d.ts) file containing `declare module 'eslint';`
1 import * as eslint from 'eslint';
~~~~~~~~
node_modules/fork-ts-checker-webpack-plugin/lib/issue/eslint/FileAwareEsLintMessage.d.ts:1:25 - error TS7016: Could not find a declaration file for module 'eslint'. '/MY_PROJECT_DIR/node_modules/eslint/lib/api.js' implicitly has an 'any' type.
Try `npm install @types/eslint` if it exists or add a new declaration (.d.ts) file containing `declare module 'eslint';`
1 import * as eslint from 'eslint';
type-checking should pass
tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"target": "es5",
"module": "commonjs",
"esModuleInterop": true,
"lib": ["es6", "dom", "es2016.array.include"],
"importHelpers": true,
"sourceMap": true,
"outDir": "./dist",
"jsx": "preserve",
"alwaysStrict": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"types": ["node", "jest", "jest-enzyme"],
"typeRoots": ["./typings", "./node_modules/@types"],
"baseUrl": ".",
"paths": {
"*": ["*", "typings/*"]
}
},
"include": [
"./src",
"./scripts",
"./config",
"./webpack.config.ts",
"./typings"
]
}
webpack.config.ts
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
export = {
// ... various webpack configuration
plugins: [
new ForkTsCheckerWebpackPlugin()
]
}
and then run
npx tsc
Thanks for the report. @piotr-oles how do you want to proceed with this? I'd suggest we don't want to make @types/eslint a dependency.
I suspect this is a side effect of moving to use import * as eslint from 'eslint'; style imports rather than targeted ones that only import the types being used.
If so, this could probably be fixed by switching back to the import { TYPE } from 'eslint'; style imports
Thanks @StefanoMagrassi , I'm working on the fix.
You are right @johnnyreilly , I will remove @types/eslint dependency to forbid using types from eslint. The PR will be soon 馃憤
:tada: This issue has been resolved in version 4.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket: