diff --git a/.gitignore b/.gitignore index fa1a127..307f131 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,4 @@ yarn.lock # Release dist +**/*.js diff --git a/README.md b/README.md index 3971b2a..dfa3e7c 100644 --- a/README.md +++ b/README.md @@ -14,19 +14,24 @@ Install with NPM or Yarn to your dev dependencies: npm install --save-dev tslint-whitespace-before-colon ``` -and enable it in your project's `tslint.json` file: +and include it in your project's `tslint.json` file. You can do it either by adding the package name to `extends` field: ```json -{ "extends": [ "tslint-whitespace-before-colon" - ], - "rules": { - "whitespace-before-colon": [true, "nospace"] - } -} + ] +``` + +or by adding the package location to `rulesDirectory` field: + +```json + "rulesDirectory": [ + "node_modules/tslint-whitespace-before-colon" + ] ``` +Both approaches are equivalent, use whichever suits your project the most. + ## Configuration Rule expects a single string option indicating the required number of spaces before colon: @@ -37,6 +42,16 @@ Rule expects a single string option indicating the required number of spaces bef If none of the above is provided, the rule will have no effect. +Example configuration: + +```json + "rules": { + "whitespace-before-colon": [true, "nospace"] + } +``` + +### Note + If a newline character (`"\n"`) is present, the rule validates regardless of the configured option, just as `typedef-whitespace` rule does. ## License diff --git a/index.js b/index.js index 66b37b9..3e54353 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ module.exports = { - rulesDirectory: "./dist", + rulesDirectory: ".", }; diff --git a/package.json b/package.json index e352780..26f247f 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "tslint-whitespace-before-colon", - "version": "0.1.0", + "version": "0.2.0", "description": "TSLint rule for determining if a space is required or not before the colon in object literals and destructuring assignments", "main": "index.js", "scripts": { - "build": "tsc --project tsconfig.json --outDir dist", + "build": "tsc --project tsconfig.json --outDir .", "prepublish": "npm run build", "test": "echo \"Error: no test specified\" && exit 1", "lint": "tslint --project tsconfig.json"