forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and de-duplicate documentation (palantir#2498)
- Removed a lot of documentation from the README that was duplicated in the Jekyll documentation site. - Spruced up some existing markdown docs.
- Loading branch information
Showing
18 changed files
with
241 additions
and
567 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
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 |
---|---|---|
@@ -1,10 +1,6 @@ | ||
##### Peer dependencies ##### | ||
##### Peer dependencies | ||
|
||
The `typescript` module is a peer dependency of TSLint, which allows you to update the compiler independently from the | ||
linter. This also means that `tslint` will have to use the same version of `tsc` used to actually compile your sources. | ||
The `typescript` package is a peer dependency of TSLint. This allows you to update the compiler independently from the linter. | ||
This also means that `tslint` will have to use the same version of `tsc` which is used to actually compile your sources. | ||
|
||
Breaking changes in the latest dev release of `typescript@next` might break something in the linter if we haven't built against that release yet. If this happens to you, you can try: | ||
|
||
1. picking up `tslint@next`, which may have some bugfixes not released in `tslint@latest` | ||
(see [release notes here](https://github.com/palantir/tslint/releases)). | ||
2. rolling back `typescript` to a known working version. | ||
Although the peer dependency allows installing the latest nightly releases of `typescript@next`, be aware that these might include breaking changes that cause the linter to malfunction. |
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
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
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
--- | ||
layout: page | ||
title: Formatters | ||
permalink: /formatters/ | ||
menu: main | ||
order: 2 | ||
--- | ||
|
||
_Formatters_ allow for transformation of lint results into various forms before outputting to stdout or a file. | ||
|
||
### Built-in formatters | ||
|
||
{% assign formatters = site.data.formatters | sort: "name" %} | ||
{% for formatter in formatters %} | ||
* [{{formatter.formatterName}}]({{formatter.formatterName}})</a> - {{formatter.description | markdownify | remove:"<p>" | remove: "</p>"}} | ||
{% endfor %} |
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
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
--- | ||
layout: page | ||
title: Rules | ||
permalink: /rules/ | ||
menu: main | ||
order: 2 | ||
--- | ||
|
||
_Rules_ encode logic for syntactic & semantic checks of TypeScript source code. | ||
|
||
### TypeScript Specific | ||
|
||
_These rules find errors related to TypeScript features_: | ||
|
||
{% include rule_list.html ruleType="typescript" %} | ||
|
||
### Functionality | ||
|
||
_These rules catch common errors in JS programming or otherwise confusing constructs that are prone to producing bugs_: | ||
|
||
{% include rule_list.html ruleType="functionality" %} | ||
|
||
### Maintainability | ||
|
||
_These rules make code maintenance easier_: | ||
|
||
{% include rule_list.html ruleType="maintainability" %} | ||
|
||
### Style | ||
|
||
_These rules enforce consistent style across your codebase_: | ||
|
||
{% include rule_list.html ruleType="style" %} |
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
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,90 @@ | ||
--- | ||
layout: page | ||
title: Configuration | ||
permalink: /usage/configuration/ | ||
--- | ||
|
||
### tslint.json | ||
|
||
When using [the CLI][0] or many [third-party tools][1], a file named `tslint.json` is used to | ||
configure which rules get run and each of their options. This configuration file may be comp | ||
|
||
`tslint.json` files can have the following fields specified: | ||
|
||
* `extends?: string | string[]`: | ||
The name of a built-in configuration preset (see built-in presets below), or a path or | ||
array of paths to other configuration files which are extended by this configuration. | ||
This value is handled using node module resolution semantics. | ||
For example, a value of `"tslint-config"` would tell TSLint to try and load the main file of a module | ||
named "tslint-config" as a configuration file. Specific files inside node modules can also be | ||
specified, eg. `"tslint-config/path/to/submodule"`. Relative paths to JSON files or JS modules | ||
are also supported, e.g. `"./tslint-config"`. | ||
* `rulesDirectory?: string | string[]`: | ||
A path or array of paths to a directories of [custom rules][2]. These may be relative or absolute paths. | ||
* `rules?: { [name: string]: RuleSetting }`: A map of rule names to their configuration settings. | ||
- These rules are applied to `.ts` and `.tsx` files. | ||
- Each rule is associated with an object containing: | ||
- `options?: any`: An array of values that are specific to a rule. | ||
- `severity?: "default" | "error" | "warning" | "off"`: Severity level. Level "error" will cause exit code 2. | ||
- A boolean value may be specified instead of the above object, and is equivalent to setting no options with default severity. | ||
- Any rules specified in this block will override those configured in any base configuration being extended. | ||
- [Check out the full rules list here][3]. | ||
* `jsRules?: any`: Same format as `rules`. These rules are applied to `.js` and `.jsx` files. | ||
* `defaultSeverity?: "error" | "warning" | "off"`: The severity level used when a rule specifies a default warning level. If undefined, "error" is used. This value is not inherited and is only applied to rules in this file. | ||
|
||
`tslint.json` configuration files may have JavaScript-style `// single-line` and `/* multi-line */` comments in them (even though this is technically invalid JSON). If this confuses your syntax highlighter, you may want to switch it to JavaScript format. | ||
|
||
An example `tslint.json` file might look like this: | ||
|
||
```json | ||
{ | ||
"extends": "tslint:recommended", | ||
"rulesDirectory": ["path/to/custom/rules/directory/", "another/path/"], | ||
"rules": { | ||
"max-line-length": { | ||
"options": [120] | ||
}, | ||
"new-parens": true, | ||
"no-arg": true, | ||
"no-bitwise": true, | ||
"no-conditional-assignment": true, | ||
"no-consecutive-blank-lines": false, | ||
"no-console": { | ||
"options": [ | ||
"debug", | ||
"info", | ||
"log", | ||
"time", | ||
"timeEnd", | ||
"trace", | ||
] | ||
} | ||
}, | ||
"jsRules": { | ||
"max-line-length": { | ||
"options": [120] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Rule Severity | ||
|
||
The severity level of each rule can can be configured to `default`, `error`, `warning`/`warn`, or `off`/`none`. If no severity level is specified, `default` is used. The `defaultSeverity` top-level option replaces the severity level for each rule that uses severity level `default` in the current file. Valid values for `defaultSeverity` include `error`, `warning`/`warn`, and `off`/`none`. | ||
|
||
### Configuration presets | ||
|
||
TSLint ships with a handful of built-in configurations presets. You may inspect their source [here](https://github.com/palantir/tslint/tree/master/src/configs). | ||
|
||
__`tslint:recommended`__ is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will _not_ have breaking changes across minor or patch releases. | ||
|
||
__`tslint:latest`__ extends `tslint:recommended` and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, `tslint:recommended` will be updated to be identical to `tslint:latest`. | ||
|
||
__`tslint:all`__ turns on all rules to their strictest settings. This will use type checking, so it must be combined with the `--project` option. | ||
(Exceptions are [`"ban"`](https://palantir.github.io/tslint/rules/ban/), [`"import-blacklist"`](https://palantir.github.io/tslint/rules/import-blacklist/), and [`"file-header"`](https://palantir.github.io/tslint/rules/file-header/), which have no sensible defaults, and deprecated rules.) | ||
|
||
|
||
[0]: {{site.baseurl | append: "/usage/cli"}} | ||
[1]: {{site.baseurl | append: "/usage/third-party-tools"}} | ||
[2]: {{site.baseurl | append: "/usage/custom-rules"}} | ||
[3]: {{site.baseurl | append: "/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
Oops, something went wrong.