Skip to content

Commit

Permalink
Enable extending by providing an empty config preset
Browse files Browse the repository at this point in the history
  • Loading branch information
ajafff committed May 14, 2017
1 parent 3fac62a commit 28f1f8d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/node_modules
*.js
!/rules/index.js
/coverage/
/.nyc_output
3 changes: 3 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"rules/*.js",
"src/*.js"
],
"exclude": [
"rules/index.js"
],
"extension": [
".js"
],
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@ Install from npm to your devDependencies (https://www.npmjs.com/package/tslint-
npm install --save-dev tslint-consistent-codestyle
```

Configure tslint to use the tslint-consistent-codestyle folder:
Configure tslint to use `tslint-consistent-codestyle`:

Add the following path to the `rulesDirectory` setting in your `tslint.json` file:
This package provides an empty configuration preset that just contains the `rulesDirectory`. That means you can easily use the rules in this package, but don't get any predefined configuration. To use it, just add it to the `extends` array in your `tslint.json`:

```javascript
{
"rulesDirectory": ["./node_modules/tslint-consistent-codestyle/rules"]
"extends": ["tslint-consistent-codestyle"]
"rules": {
...
}
}
```

As of `[email protected]` you can also use `tslint-consistent-codestyle` as `rulesDirectory`:

```javascript
{
"rulesDirectory": ["tslint-consistent-codestyle"]
"rules": {
...
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"main": "rules/index.js",
"scripts": {
"test": "tslint --test test/rules/*/*",
"build": "tsc -p .",
"build": "rm -rf {src,rules}/*.js; tsc -p .",
"prepublish": "npm run verify",
"lint": "tslint '{rules,src}/**/*.ts'",
"lint:fix": "tslint --fix '{rules,src}/**/*.ts'",
Expand Down
1 change: 0 additions & 1 deletion rules/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions rules/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// this file exists for tslint to resolve the rules directory
export = {rulesDirectory: '.'};

0 comments on commit 28f1f8d

Please sign in to comment.