Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
4.0 blog post formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Nov 19, 2016
1 parent 33019aa commit c2216ee
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions docs/_posts/2016-11-17-new-for-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ date: 2016-11-17 15:19:00
---

TSLint 4.0 has been released! With this release comes a few exciting [changes][0]. Some of the highlights:
* **Fixers** - Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we'll fix them for you. To use this feature, run `tslint` with the `--fix` option. Rules that support the `--fix` feature:

* **Fixers**. Do you dread turning on a new rule because of all of the new errors? For some of the most common issues, we'll fix them for you. To use this feature, run `tslint` with the `--fix` option. Rules that support the `--fix` feature:
* [array-type][2]
* [arrow-parens][3]
* [no-unused-variable][4] (for imports)
* [no-var-keyword][5]
* [ordered-imports][6]
* [semicolon][7]
* [trailing-comma][8]
* **Linting `.js` files** - *A much-requested feature from our community*. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a `jsRules` [section][9] to your `tslint.json` file, and TSLint will your JavaScript files.
* **TypeScript 2.0+ required** - This lets us deprecate/remove rules that are checked by the compiler. These rules now cause compilation errors:

* **Linting `.js` files**. *A much-requested feature from our community*. Simplify your toolset by running the same rules you know and love on your .js and .jsx files. Just add a `jsRules` [section][9] to your `tslint.json` file, and TSLint will your JavaScript files.

* **TypeScript 2.0+ required**. This lets us deprecate/remove rules that are checked by the compiler. These rules now cause compilation errors:
* no-duplicate-key
* no-unreachable
* no-unused-variable
* **Node.js API Change** - [Moved and renamed][11] some things to make more sense. Get it all when you use `import * as TSLint from "tslint"`.

* **Node.js API Change**. [Moved and renamed][11] some things to make more sense. Get it all when you use `import * as TSLint from "tslint"`.

* **[Recommended Rules Updated][12]**
* [adjacent-overload-signatures][13]
* [array-type][14]
Expand All @@ -30,10 +35,11 @@ TSLint 4.0 has been released! With this release comes a few exciting [changes][0
* [only-arrow-functions][20]
* [ordered-imports][21]
* [prefer-for-of][22]

* **Other rules you might find handy**:
* [completed-docs][23]
* [cyclomatic-complexity][24]

---

## Create your own fixer ##
Expand All @@ -42,11 +48,11 @@ To create your own fixer, instantiate a `Fix` object and pass it in as an argume
This snippet updates the [sample custom rule][25] by adding a fixer which replaces the offending import statement with an empty string:

```typescript
// create a fixer for this failure
const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
const fix = new Lint.Fix("no-imports", [replacement]);
// create a fixer for this failure
const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "");
const fix = new Lint.Fix("no-imports", [replacement]);

this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix));
```

[0]: https://github.com/palantir/tslint/releases
Expand Down

0 comments on commit c2216ee

Please sign in to comment.