Skip to content

Commit

Permalink
docs: add some comments, update and fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yisraelx committed Apr 11, 2019
1 parent 753a29c commit c18b8f3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
[![Travis build](https://travis-ci.org/yisraelx/karma-tslint.svg?branch=master)](https://travis-ci.org/yisraelx/karma-tslint)
[![Version](https://img.shields.io/npm/v/karma-tslint.svg)](https://www.npmjs.com/package/karma-tslint)
[![MIT License](https://img.shields.io/npm/l/karma-tslint.svg)](https://github.com/yisraelx/karma-tslint/blob/master/LICENSE)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![TypeScript](https://img.shields.io/badge/100%25-TypeScript-blue.svg)](https://www.typescriptlang.org)
[![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

**Adapter for the [Tslint](https://palantir.github.io/tslint), linter for the [TypeScript](https://www.typescriptlang.org) language.**

> _Warning: [Tslint](https://palantir.github.io/tslint) soon will be deprecated ([Roadmap: TSLint → ESLint](https://github.com/palantir/tslint/issues/4534)),
[karma-tslint](https://github.com/yisraelx/karma-tslint) will continue to be updated accordingly._

## Install
```bash
$ npm install --save-dev karma-tslint
# and install peer dependencies
$ npm install --save-dev tslint
$ yarn add karma-tslint tslint --dev
```
Or
```bash
$ npm install karma-tslint tslint --save-dev
```

## Use
### Config

```typescript
// karma.conf.ts
Expand Down Expand Up @@ -69,7 +77,7 @@ __fix__
* undefined (default) - false

__project__ - for rules that need `typescript` program
* string - path to the tsconfig.json file or to the directory containing the tsconfig.json file
* string - path to 'tsconfig.json' file or to the directory containing the 'tsconfig.json' file
* undefined (default) - run without `typescript` program

### Karma plugins option
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "karma-tslint",
"version": "0.0.0-development",
"description": "Karma tslint plugin",
"description": "Adapter for the Tslint, linter for the TypeScript language.",
"main": "lib/index.js",
"typeings": "lib/index.d.ts",
"files": [
Expand Down
10 changes: 5 additions & 5 deletions src/tslint.preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface ITslintPreprocessorConfig {
/**
* For rules that need `typescript` program
*
* string - path to the tsconfig.json file or to the directory containing the tsconfig.json file
* string - path to the 'tsconfig.json' file or to the directory containing the 'tsconfig.json' file
* undefined (default) - run without `typescript` program
*/
project?: string;
Expand Down Expand Up @@ -123,7 +123,7 @@ export class TslintPreprocessor extends Linter {
private getConfiguration(filePath: string): Configuration.IConfigurationFile {
let {configuration} = this._config as any;

if (configuration === void 0) {
if (configuration === void 0) { // auto search for 'tslint.json' file.
configuration = Linter.findConfigurationPath(null, filePath);
}

Expand All @@ -134,9 +134,9 @@ export class TslintPreprocessor extends Linter {
configuration = 'tslint:recommended';
}

if (typeof configuration === 'string') {
if (typeof configuration === 'string') { // path of tslint.json file or tslint preset 'tslint:{all,latest,recommended}'.
configuration = Configuration.loadConfigurationFromPath(configuration as string);
} else if (typeof configuration === 'object') {
} else if (typeof configuration === 'object') { // tslint config object.
configuration = Configuration.parseConfigFile(configuration as any);
}

Expand All @@ -151,4 +151,4 @@ export class TslintPreprocessor extends Linter {
return result;
}

}
}

0 comments on commit c18b8f3

Please sign in to comment.