Skip to content

Commit

Permalink
Update some code examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Jun 11, 2016
1 parent b0821e8 commit 66526f4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,26 @@ tslint accepts the following command-line options:
#### Library

```javascript
var fileName = "Specify file name";
const Linter = require("tslint");
const fs = require("fs");

var configuration = {
const fileName = "Specify file name";
const configuration = {
rules: {
"variable-name": true,
"quotemark": [true, "double"]
}
};

var options = {
const options = {
formatter: "json",
configuration: configuration,
rulesDirectory: "customRules/", // can be an array of directories
rulesDirectory: "customRules/",
formattersDirectory: "customFormatters/"
};

var Linter = require("tslint");
var fs = require("fs");
var contents = fs.readFileSync(fileName, "utf8");

var ll = new Linter(fileName, contents, options);
var result = ll.lint();
const fileContents = fs.readFileSync(fileName, "utf8");
const linter = new Linter(fileName, fileContents, options);
const result = linter.lint();
```

Core Rules
Expand Down

0 comments on commit 66526f4

Please sign in to comment.