diff --git a/_data/rules.json b/_data/rules.json
index fd9cf439534..2c104d6be78 100644
--- a/_data/rules.json
+++ b/_data/rules.json
@@ -218,7 +218,7 @@
{
"ruleName": "completed-docs",
"description": "Enforces documentation for important items be filled out.",
- "optionsDescription": "\n `true` to enable for [\"classes\", \"functions\", \"methods\", \"properties\"],\n or an array with each item in one of two formats:\n\n* `string` to enable for that type\n* `object` keying types to when their documentation is required:\n * `\"methods\"` and `\"properties may specify:\n * `\"privacies\":\n * `\"all\"`\n * `\"private\"`\n * `\"protected\"`\n * `\"public\"`\n * `\"locations:\n * `\"all\"`\n * `\"instance\"`\n * `\"static\"`\n * All other types may specify `\"visibilities\"`:\n * `\"all\"`\n * `\"exported\"`\n * `\"internal\"`\n\nTypes that may be enabled are:\n\n * `\"classes\"`\n * `\"enums\"`\n * `\"functions\"`\n * `\"interfaces\"`\n * `\"methods\"`\n * `\"namespaces\"`\n * `\"properties\"`\n * `\"types\"`\n * `\"variables\"`",
+ "optionsDescription": "\n`true` to enable for [\"classes\", \"functions\", \"methods\", \"properties\"],\nor an array with each item in one of two formats:\n\n* `string` to enable for that type\n* `object` keying types to when their documentation is required:\n * `\"methods\"` and `\"properties may specify:\n * `\"privacies\":\n * `\"all\"`\n * `\"private\"`\n * `\"protected\"`\n * `\"public\"`\n * `\"locations:\n * `\"all\"`\n * `\"instance\"`\n * `\"static\"`\n * All other types may specify `\"visibilities\"`:\n * `\"all\"`\n * `\"exported\"`\n * `\"internal\"`\n\nTypes that may be enabled are:\n\n * `\"classes\"`\n * `\"enums\"`\n * `\"functions\"`\n * `\"interfaces\"`\n * `\"methods\"`\n * `\"namespaces\"`\n * `\"properties\"`\n * `\"types\"`\n * `\"variables\"`",
"options": {
"type": "array",
"items": {
@@ -1378,8 +1378,7 @@
},
{
"ruleName": "no-unused-variable",
- "deprecationMessage": "Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.",
- "description": "Disallows unused imports, variables, functions and private class members.",
+ "description": "Disallows unused imports, variables, functions and\n private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals\n options, but does not interrupt code compilation.",
"hasFix": true,
"optionsDescription": "\nThree optional arguments may be optionally provided:\n\n* `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n* `\"react\"` relaxes the rule for a namespace import named `React`\n(from either the module `\"react\"` or `\"react/addons\"`).\nAny JSX expression in the file will be treated as a usage of `React`\n(because it expands to `React.createElement `).\n* `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\nVariable names that match the pattern will be ignored.",
"options": {
diff --git a/_includes/rule_list.html b/_includes/rule_list.html
index dd990de3029..dd4ee71c380 100644
--- a/_includes/rule_list.html
+++ b/_includes/rule_list.html
@@ -1,6 +1,21 @@
-
+
\ No newline at end of file
diff --git a/_layouts/rule.html b/_layouts/rule.html
index de7b8ca3c8c..9299ab37db1 100644
--- a/_layouts/rule.html
+++ b/_layouts/rule.html
@@ -9,11 +9,21 @@
Rationale
{{page.rationale | markdownify}}
{% endif %}
-{% if page.requiresTypeInfo %}
- Note:
- This rule requires type info to run
-{% endif %}
+{% if page.typescriptOnly or page.hasFix or page.requiresTypeInfo %}
+ Notes:
+
+ {% if page.typescriptOnly %}
+
TS Only
+ {% endif %}
+ {% if page.hasFix %}
+
Has Fixer
+ {% endif %}
+ {% if page.requiresTypeInfo %}
+
Requires Type Info
+ {% endif %}
+
+{% endif %}
Config
{{page.optionsDescription | markdownify}}
diff --git a/_sass/_base.scss b/_sass/_base.scss
index 52b4aea6e1d..52e6af050e6 100644
--- a/_sass/_base.scss
+++ b/_sass/_base.scss
@@ -70,3 +70,106 @@ figcaption {
}
}
}
+
+
+/**
+ * Rules & Feature Badges
+ */
+ .rules-list {
+ list-style: none;
+ margin: 0 !important; //need to override the `main-content ul` selector
+
+ > li {
+ &:nth-child(odd) {
+ a {
+ background-color: rgba(0, 0, 0, .03);
+ }
+ }
+
+ a {
+ display: block;
+ border-left: 3px solid transparent;
+ text-decoration: none;
+ padding: .75rem;
+
+ &:hover {
+ background-color: rgba(0, 0, 0,.075);
+ border-left-color: #159957;
+ }
+ }
+ }
+ }
+
+ .rule-features {
+ //This is the container for a list of feature badges
+ display: -webkit-box;
+ display: -moz-box;
+ display: -ms-flexbox;
+ display: -webkit-flex;
+ display: flex;
+ }
+
+ .feature {
+ //This is the setup for the a feature badge
+ display: inline-block;
+ margin-right: 2px;
+ padding: 2px 4px;
+ font-weight: 700;
+ line-height: 1;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: baseline;
+ border: 1px solid transparent;
+ border-radius: .25rem;
+ cursor: help;
+
+ &:before {
+ //This is the setup for the icon that appears inside the badge
+ display: inline-block;
+ margin-right: 2px;
+ }
+
+ &.feature-sm {
+ //This class is added to make the feature badge smaller. This is used on the rules list
+ padding: 1px 3px;
+ font-size: 75%;
+ }
+
+ &.feature-ts-only {
+ //This feature badge is added to rules that are "TypeScript Only"
+ background-color: #FCF8E3;
+ border-color: #FAF2CC;
+ color: #8A6D3B;
+
+ &:before {
+ content: "\1F4C4"; //"page facing up" icon - http://www.fileformat.info/info/unicode/char/1F4C4/index.htm
+ }
+ }
+
+ &.feature-fixer {
+ //This feature badge is added to rules that have an auto-fixer
+ background-color: #DFF0D8;
+ border-color: #D0E9C6;
+ color: #3C763D;
+
+ &:before {
+ content: "\1f527"; //"wrench" icon - http://www.fileformat.info/info/unicode/char/1f527/index.htm
+ }
+ }
+
+ &.feature-requires-type-info {
+ //This feature badge is added to rules that require type information
+ background-color: #F2DEDE;
+ border-color: #EBCCCC;
+ color: #A94442;
+
+ &:before {
+ content: "\2139"; //"information source" icon - http://www.fileformat.info/info/unicode/char/2139/index.htm
+ //Surround it with a blue circle
+ border-radius: 50%;
+ background: #0078D7;
+ color: #FFF;
+ width: 1em;
+ }
+ }
+ }
diff --git a/develop/custom-rules/performance.md b/develop/custom-rules/performance.md
index 6b17c5cab45..51c4d6aba1a 100644
--- a/develop/custom-rules/performance.md
+++ b/develop/custom-rules/performance.md
@@ -97,7 +97,7 @@ Some examples:
`node.getStart()` scans the source to skip all the leading trivia. Although barely noticeable, this operation is not for free.
If you need the start position of a node more than once per function, consider caching it.
-`node.getWidth()` is most of the time used together with `node.getStart()` to get the node's span. Internally it uses `node.getStart() - node.getEnd()` which effectively doubles the calls to `node.getStart()`. Consider using `node.getEnd()` instead and calculate the width yourself if necessary.
+`node.getWidth()` is most of the time used together with `node.getStart()` to get the node's span. Internally it uses `node.getEnd() - node.getStart()` which effectively doubles the calls to `node.getStart()`. Consider using `node.getEnd()` instead and calculate the width yourself if necessary.
`node.getText()` calculates the start of the node and returns a substring until the end of the token.
Most of the time this not needed, because this substring is already contained in the node.
diff --git a/rules/completed-docs/index.html b/rules/completed-docs/index.html
index 248561f13b2..e8e0669b68a 100644
--- a/rules/completed-docs/index.html
+++ b/rules/completed-docs/index.html
@@ -3,8 +3,8 @@
description: Enforces documentation for important items be filled out.
optionsDescription: |-
- `true` to enable for ["classes", "functions", "methods", "properties"],
- or an array with each item in one of two formats:
+ `true` to enable for ["classes", "functions", "methods", "properties"],
+ or an array with each item in one of two formats:
* `string` to enable for that type
* `object` keying types to when their documentation is required:
diff --git a/rules/no-unused-variable/index.html b/rules/no-unused-variable/index.html
index 8d68ff2ebcd..c7be95430b1 100644
--- a/rules/no-unused-variable/index.html
+++ b/rules/no-unused-variable/index.html
@@ -1,7 +1,9 @@
---
ruleName: no-unused-variable
-deprecationMessage: Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.
-description: 'Disallows unused imports, variables, functions and private class members.'
+description: |-
+ Disallows unused imports, variables, functions and
+ private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals
+ options, but does not interrupt code compilation.
hasFix: true
optionsDescription: |-