Skip to content

Commit

Permalink
Move compiled rule to root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
xemlock committed Feb 16, 2019
1 parent 4e14c91 commit 13da507
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ yarn.lock

# Release
dist
**/*.js
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
rulesDirectory: "./dist",
rulesDirectory: ".",
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 13da507

Please sign in to comment.