Linting

Many editors support the concept of "linting" - a grammar check for computer programs.Linting can be done in a programmer's editor and/or through automation.

For TypeScript there is a package called tslint, (npm install —save-dev
tslint
) which can be plugged into many editors. tslint can also beconfigured with a tslint.json file.

Webpack can run tslint before it attempts to run tsc. This is done by installing tslint-loader (npm install —save-dev tslint-loader)which plugs into webpack like so:

  1. // ...
  2. module: {
  3. preLoaders: [
  4. { test: /\.ts$/, loader: 'tslint' }
  5. ],
  6. loaders: [
  7. { test: /\.ts$/, loader: 'ts', exclude: /node_modules/ },
  8. // ...
  9. ]
  10. // ...
  11. }

原文: https://angular-2-training-book.rangle.io/handout/features/linting.html