webhintio / rfcs

🛑 This repository is deprecated!! To request changes, new features, hints, etc. please open an issue in https://github.com/webhintio/hint
1 stars 1 forks source link

[Hint] TSConfig hints #9

Closed molant closed 5 years ago

molant commented 6 years ago

Originally reporte by @molant in https://github.com/webhintio/hint/issues/972

@molant

After talking with @bterlson today, here goes an initial list of rules for TypeScript we could implement:

One thing that came up during the conversation is to have a rule that will check that your bundle is the smallest one. This could actually be a mix of several checks, like importHelpers and no-comments and maybe other ones.

@sonarwhal/core I'm opening this issue so we can start the discussion, see if there's anything we can do initially, etc.

@bterlson if you know of someone else that could be interested in this kind of rules for TS please add them to the conversation.

@bterlson

/cc @danielrosenwasser @bowdenk7 @ryancavanaugh may have some feedback

@danielrosenwasser

  • I'd say that if you're targeting Webpack or Rollup, you should be using module: esnext. This is the easiest win for users by far.
  • Use --isolatedModules to help ensure TypeScript can support single-file emit (which Babel is limited to).

To address some of the above:

esModuleInterop should be true and allowSyntheticDefaultImports shouldn't be set.

Actually it depends.

  • allowSyntheticDefaultImports should be used when targeting module: esnext, which is most ideal when handing output to Webpack.
  • esModuleInterop is really only useful for AMD or CommonJS.

decorators should be false

Maybe. It's sort of a tough call given existing code.