This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/build/ | ||
/docs/site/ | ||
/scripts/*.js | ||
/scripts/*.js.map | ||
/lib/ | ||
/test/executable/tslint.json | ||
node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
layout: post | ||
title: "TSLint 4.0 Released" | ||
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: | ||
* [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: | ||
* 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"`. | ||
* **[Recommended Rules Updated][12]** | ||
* [adjacent-overload-signatures][13] | ||
* [array-type][14] | ||
* [arrow-parens][15] | ||
* [max-classes-per-file][16] | ||
* [no-unsafe-finally][17] | ||
* [object-literal-key-quotes][18] (as needed) | ||
* [object-literal-shorthand][19] | ||
* [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 ## | ||
To create your own fixer, instantiate a `Fix` object and pass it in as an argument to `addFailure`. | ||
|
||
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]); | ||
|
||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING, fix)); | ||
``` | ||
|
||
[0]: https://github.com/palantir/tslint/releases | ||
[1]: https://github.com/palantir/tslint/blob/master/CHANGELOG.md | ||
[2]: {{ site.baseurl }}/rules/array-type | ||
[3]: {{ site.baseurl }}/rules/arrow-parens | ||
[4]: {{ site.baseurl }}/rules/no-unused-variable | ||
[5]: {{ site.baseurl }}/rules/no-var-keyword | ||
[6]: {{ site.baseurl }}/rules/ordered-imports | ||
[7]: {{ site.baseurl }}/rules/semicolon | ||
[8]: {{ site.baseurl }}/rules/trailing-comma | ||
[9]: https://raw.githubusercontent.com/palantir/tslint/master/src/configs/recommended.ts | ||
[10]: {{ site.baseurl }}/usage/third-party-tools/ | ||
[11]: https://github.com/palantir/tslint/pull/1720 | ||
[12]: https://github.com/palantir/tslint/pull/1717/files#diff-6e3940e8ec3d59837c4435f32975ed2c | ||
[13]: {{ site.baseurl }}/rules/adjacent-overload-signatures | ||
[14]: {{ site.baseurl }}/rules/array-type | ||
[15]: {{ site.baseurl }}/rules/arrow-parens | ||
[16]: {{ site.baseurl }}/rules/max-classes-per-file | ||
[17]: {{ site.baseurl }}/rules/no-unsafe-finally | ||
[18]: {{ site.baseurl }}/rules/object-literal-key-quotes | ||
[19]: {{ site.baseurl }}/rules/object-literal-shorthand | ||
[20]: {{ site.baseurl }}/rules/only-arrow-functions | ||
[21]: {{ site.baseurl }}/rules/ordered-imports | ||
[22]: {{ site.baseurl }}/rules/prefer-for-of | ||
[23]: {{ site.baseurl }}/rules/completed-docs | ||
[24]: {{ site.baseurl }}/rules/cyclomatic-complexity | ||
[25]: {{ site.baseurl }}/develop/custom-rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters