From c2216ee5ce1a78e0242bd32be19ca0919aab2816 Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Fri, 18 Nov 2016 21:11:14 -0500 Subject: [PATCH] 4.0 blog post formatting fixes --- docs/_posts/2016-11-17-new-for-4.0.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/_posts/2016-11-17-new-for-4.0.md b/docs/_posts/2016-11-17-new-for-4.0.md index 454d20bfac7..29a1ca08595 100644 --- a/docs/_posts/2016-11-17-new-for-4.0.md +++ b/docs/_posts/2016-11-17-new-for-4.0.md @@ -5,7 +5,8 @@ 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) @@ -13,12 +14,16 @@ TSLint 4.0 has been released! With this release comes a few exciting [changes][0 * [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] @@ -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 ## @@ -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