TypeStrong / grunt-ts

A grunt task to manage your complete typescript development to production workflow
https://www.npmjs.com/package/grunt-ts
MIT License
330 stars 121 forks source link

Proposal: `linting` macro #349

Open nycdotnet opened 8 years ago

nycdotnet commented 8 years ago

Proposal: With the assumption that more will come with future versions, implement an option that will enable all of the TypeScript-provided linting options. This will be updated as new linting features are added to TypeScript, so it will be somewhat of a set-and-forget for users of grunt-ts as they upgrade. The linting option will be off by default. An explicit setting will override the setting that would have come from linting.

Setting linting: true will set the following for use with TypeScript 1.8:

noImplicitAny: true, 
suppressImplicitAnyIndexErrors: true // see note
isolatedModules: true, 
suppressExcessPropertyErrors: false,  
allowUnusedLabels: false, 
noImplicitReturns: true,  
noFallthroughCasesInSwitch: true, 
allowUnreachableCode: false,
forceConsistentCasingInFileNames: true,
noImplicitUseStrict: false

Note regarding suppressImplicitAnyIndexErrors - while technically this weakens the TypeScript type checking, it is also very practical in this author's opinion. It can be turned off with linting enabled by setting suppressImplicitAnyIndexErrors: false.

One issue is that this will need to be aware of the TypeScript version and only pass switches that are appropriate (for example, it is safe to pass noImplicitAny to TypeScript 1.6, but not allowUnusedLabels).