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

Bugfix for fork-ts-checker-webpack-plugin and TypeScript 3.8 Type-Only Imports/Exports #309

Merged
merged 6 commits into from
Jan 29, 2021

Conversation

nelsonni
Copy link
Member

Description:

The addition of "importsNotUsedAsValues": "preserve" in tsconfig.json (following the example ESLint configuration for the fork-ts-checker-webpack-plugin module), introduced type errors for import/exports of TypeScript type definitions. Further details of the error is documented in issue #308.

Fixing this issue also revealed additional errors, including ESLint linting being applied to non-code files (.svg, .png, .json) with repeated errors for each such file within the Synectic codebase indicating:

src/assets/alt_folder.svg
[unknown]: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/assets/alt_folder.svg.
The extension for the file (.svg) is non-standard. It should be added to your existing "parserOptions.extraFileExtensions".

This error is documented in TypeStrong/fork-ts-checker-webpack-plugin#453, and requires fine-grain configuration of ESLint options used by the fork-ts-checker-webpack-plugin so that it does not aggressively lint all files.

This PR resolves #308, and signifies the following version changes:

  • MAJOR version increase
  • MINOR version increase
  • PATCH version increase

Changes:

This PR makes the following changes:

  • Converts all import statements for TypeScript type definition files (e.g. src/types.d.ts) to use TypeScript 3.8 import type statements.
  • Narrow ESLint file glob in fork-ts-checker-webpack-plugin configs to only .ts, .tsx, and .js files.
  • Remove ESLint import/named rule override for react-dnd/XYCoord, which was fixed in Defines the XYCoord interface in React-Dnd package react-dnd/react-dnd#1454.
  • Remove ESLint @typescript-eslint/no-var-requires rule override for webpack.renderer.config.js file, since updates to @typescript-eslint have now restricted the no-var-requires rule to only apply to TS files.
  • Increase TSConfig target to ES2018 (ECMAScript 2018 also known as ES9) for additional features such as asynchronous iterators, Promise.prototype.finally library, Unicode property escapes in regular expressions, RegExp lookbehind assertions, Object Rest/spread properties, RegExp named capture groups, and s 'dotAll' flag for regular expressions.

Checklist:

Before submitting this PR, I have verified that my code:

  • Resides on a fix/ or feature/ branch that was initially branched off from development.
  • Passes code linting (yarn lint) and unit testing (yarn test).
  • Successfully builds a distribution package (yarn package).

Additionally, I have verified that:

  • My name is listed in the Contributors section, or this PR includes a request to add my name.
  • I have read and am aware of the CONTRIBUTING guide for this project.

@nelsonni nelsonni added the bug Bug reports or bug fixes label Jan 29, 2021
@nelsonni nelsonni added this to the v1.0.0 milestone Jan 29, 2021
@nelsonni nelsonni self-assigned this Jan 29, 2021
@nelsonni nelsonni merged commit a5cf31a into development Jan 29, 2021
@nelsonni nelsonni deleted the fix/type-only-imports branch January 29, 2021 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports or bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant