Skip to content
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

Typed linting error where types are lost after some edits and re-lints #264

Open
imirkin opened this issue Aug 30, 2024 · 0 comments
Open

Comments

@imirkin
Copy link

imirkin commented Aug 30, 2024

Bug report

After ESLintPlugin has been running for a while, with a bunch of files changed, I will start to get errors like

'any' overrides all other types in this union type @typescript-eslint/no-redundant-type-constituents

The union type in question is like foo.A | null | undefined, where foo.A comes from a foo.d.ts file. This file is sometimes regenerated (protobuf.js-generated types). Once the type info is somehow lost, the loss tends to persist. This does not happen with all types in foo.d.ts, nor does it happen with all types in the edited file -- some random type(s) gets lost.

Expected Behavior

Editing files should not cause type errors to appear that were not there on load.

How Do We Reproduce?

Unfortunately I don't have a great repro here. It happens "after a while". This reads as identical to the issue mentioned in the typescript-eslint docs here about VSCode, which I'm guessing uses a somewhat different stack:

https://typescript-eslint.io/troubleshooting/typed-linting#editor-eslint-reports-become-out-of-date-after-file-changes

This is an Angular application (currently Angular 18.1, but this issue has been ongoing for some time now), with a custom builder (@angular-builders/custom-webpack:dev-server), and a webpack config which adds the ESLintPlugin in serve mode:

    config.plugins.push(
      new ESLintPlugin({
        files: ["src/**/*.ts", "src/**/*.html"],
        useEslintrc: false,
        failOnError: false,
        overrideConfigFile: "eslintrc-base.json"
      })
    );

These errors never happen on a regular build or lint run.

Please paste the results of npx webpack-cli info here, and mention other relevant information

  System:
    OS: Linux
    CPU: x64
  Binaries:
    Node: 20.15.1 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.7.0 - /usr/bin/npm
  Packages:
    compression-webpack-plugin: 11.1.0 => 11.1.0 
    eslint-webpack-plugin: 4.2.0 => 4.2.0 
    file-loader: 6.2.0 => 6.2.0 
    string-replace-loader: 3.1.0 => 3.1.0 
    tslint-webpack-plugin: 2.1.1 => 2.1.1 
    url-loader: 4.1.1 => 4.1.1 
    webpack: 5.91.0 => 5.91.0 
    webpack-dev-server: 5.0.4 => 5.0.4 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant