Fork-ts-checker-webpack-plugin: Improve eslint options documentation

Created on 19 Jun 2020  路  4Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

Hi 馃憢 ! Thanks for continuing to improve this plugin.

I discovered a place for potential improvement in the docs after upgrading from v4 to v5 that i suspect a number of folks may run into.

Current behavior

The minimal configuration recommended is as such:

new ForkTsCheckerWebpackPlugin({
      eslint: {
        files: './src/**/*' // required - same as command `eslint ./src/**/* --ext .ts,.tsx,.js,.jsx`
      }
    })

The current recommendation to use files: "./src/**/*" causes issues in common webpack project setups. The docs say:

same as command eslint ./src/**/* --ext .ts,.tsx,.js,.jsx

But i don't believe to be the case without explicitly specifying the extensions. Perhaps the recommendation should include the extensions by default?

The recommendation is also missing the enabled: true option. I expected the linter to be enabled when specifying the eslint object.

Expected behavior

The plugin provides some recommendations for projects that use CSS and other types of file loaders, and also includes enabled: true in the example if it's expected.

Steps to reproduce the issue

Import a .css file in a project with a CSS loader configured. Observe the error with the recommended files configuration:

ERROR in src/components/Foo/Foo.css
[unknown]: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/components/Foo/Foo.css.
The extension for the file (.css) is non-standard. You should add "parserOptions.extraFileExtensions" to your config.

Changing files to be configured as follows seems to solve the issue in my case:

files: "./src/**/*.{js,jsx,ts,tsx}"

Environment

  • fork-ts-checker-webpack-plugin: 5.0.3
  • typescript: 3.9.5
  • eslint: 7.3.0
  • webpack: 4.43.0
  • os: macOS 10.15.5
bug released

Most helpful comment

Thanks for reporting this issue. I've created a PR to fix it :)

All 4 comments

Thanks for the recommendation @ianschmitz! What do you think @piotr-oles ?

@johnnyreilly note that i edited my OP and included a note about the enabled property.

Thanks for reporting this issue. I've created a PR to fix it :)

:tada: This issue has been resolved in version 5.0.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings