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

Commit

Permalink
Merge master into next (#2296)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Mar 4, 2017
2 parents d691eaf + 1ade25a commit 041f297
Show file tree
Hide file tree
Showing 67 changed files with 1,299 additions and 922 deletions.
37 changes: 0 additions & 37 deletions .project

This file was deleted.

36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
Change Log
===

<!--
v5.0.0
---
* **BREAKING CHANGES**
* The severity level is now configurable, and defaults to severity "error"
* The following formatters have change output:
- msbuildFormatter - default was "warning"; it is now "error"
- pmdFormatter - default was priority 1; it is now "error" (priority 3). If set to "warning", it will output priority 4
* [enhancement] Enable WARN with new config file format (#629, #345)
* Valid values for `severity`: "error|warn|warning|none|off"
* Old style
* ```{
"extends": "tslint:latest",
"rules": {
"callable-types": true
}
}``
* New style, with `interface-name` generating warnings, and passing options to `max-line-length`
* ``` {
"extends": "tslint:latest",
"rules": {
"callable-types": true,
"interface-name": {
"severity": "warn"
},
"max-line-length": {
"options": 140,
"severity": "warning"
}
}
}``
-->

v4.5.1-dev.0
---

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- yarn
test:
override:
- case $CIRCLE_NODE_INDEX in [0-2]) yarn verify ;; 3) npm run clean && yarn compile && yarn add [email protected] && yarn test ;; esac:
- case $CIRCLE_NODE_INDEX in [0-1]) yarn verify ;; 2) npm run clean && yarn compile && yarn add [email protected] && yarn test ;; 3) npm run clean && yarn compile && yarn add typescript@next && yarn test ;; esac:
parallel: true
deployment:
npm-latest:
Expand Down
6 changes: 3 additions & 3 deletions docs/_data/formatters.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
"formatterName": "pmd",
"description": "Formats errors as through they were PMD output.",
"descriptionDetails": "Imitates the XML output from PMD. All errors have a priority of 1.",
"sample": "\n<pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"1\" rule=\"Missing semicolon\"></violation>\n </file>\n</pmd>",
"sample": "\n<pmd version=\"tslint\">\n <file name=\"myFile.ts\">\n <violation begincolumn=\"14\" beginline=\"1\" priority=\"3\" rule=\"Missing semicolon\"></violation>\n </file>\n</pmd>",
"consumer": "machine"
},
{
"formatterName": "prose",
"description": "The default formatter which outputs simple human-readable messages.",
"sample": "myFile.ts[1, 14]: Missing semicolon",
"sample": "ERROR: myFile.ts[1, 14]: Missing semicolon",
"consumer": "human"
},
{
Expand All @@ -56,7 +56,7 @@
"formatterName": "verbose",
"description": "The human-readable formatter which includes the rule name in messages.",
"descriptionDetails": "The output is the same as the prose formatter with the rule name included",
"sample": "(semicolon) myFile.ts[1, 14]: Missing semicolon",
"sample": "ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon",
"consumer": "human"
},
{
Expand Down
19 changes: 17 additions & 2 deletions docs/_includes/rule_list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<ul>
<ul class="rules-list">
{% assign rules = site.data.rules | where: "type",include.ruleType | sort: "name" %}
{% for rule in rules %}
<li><a href="{{rule.ruleName}}">{{rule.ruleName}}</a> - {{rule.description | markdownify | remove:"<p>" | remove: "</p>"}}</li>
<li>
<a href="{{rule.ruleName}}">
<div class="rule-features">
{% if rule.typescriptOnly %}
<span class="feature feature-sm feature-ts-only" title="This rule cannot be run against JavaScript files">TS Only</span>
{% endif %}
{% if rule.hasFix %}
<span class="feature feature-sm feature-fixer" title="This rule has the ability to auto-fix violations">Has Fixer</span>
{% endif %}
{% if rule.requiresTypeInfo %}
<span class="feature feature-sm feature-requires-type-info" title="This rule requires type information to run">Requires Type Info</span>
{% endif %}
</div>
<strong>{{rule.ruleName}}</strong> - {{rule.description | markdownify | remove:"<p>" | remove: "</p>"}}
</a>
</li>
{% endfor %}
</ul>
18 changes: 14 additions & 4 deletions docs/_layouts/rule.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@
<h5>Rationale</h5>
{{page.rationale | markdownify}}
{% endif %}
{% if page.requiresTypeInfo %}
<strong>Note:</strong>
<a href="https://github.com/palantir/tslint#type-checking">This rule requires type info to run</a>
{% endif %}

{% if page.typescriptOnly or page.hasFix or page.requiresTypeInfo %}
<h5>Notes: </h5>
<div class="rule-features">
{% if page.typescriptOnly %}
<span class="feature feature-ts-only" title="This rule cannot be run against JavaScript files">TS Only</span>
{% endif %}
{% if page.hasFix %}
<span class="feature feature-fixer" title="This rule has the ability to auto-fix violations">Has Fixer</span>
{% endif %}
{% if page.requiresTypeInfo %}
<a class="feature feature-requires-type-info" href="https://github.com/palantir/tslint#type-checking" title="This rule requires type information to run. Click to learn more.">Requires Type Info</a>
{% endif %}
</div>
{% endif %}

<h3>Config</h3>
{{page.optionsDescription | markdownify}}
Expand Down
103 changes: 103 additions & 0 deletions docs/_sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion docs/formatters/pmd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<pmd version="tslint">
<file name="myFile.ts">
<violation begincolumn="14" beginline="1" priority="1" rule="Missing semicolon"></violation>
<violation begincolumn="14" beginline="1" priority="3" rule="Missing semicolon"></violation>
</file>
</pmd>
consumer: machine
Expand Down
2 changes: 1 addition & 1 deletion docs/formatters/prose/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
formatterName: prose
description: The default formatter which outputs simple human-readable messages.
sample: 'myFile.ts[1, 14]: Missing semicolon'
sample: 'ERROR: myFile.ts[1, 14]: Missing semicolon'
consumer: human
layout: formatter
title: 'Formatter: prose'
Expand Down
2 changes: 1 addition & 1 deletion docs/formatters/verbose/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
formatterName: verbose
description: The human-readable formatter which includes the rule name in messages.
descriptionDetails: The output is the same as the prose formatter with the rule name included
sample: '(semicolon) myFile.ts[1, 14]: Missing semicolon'
sample: 'ERROR: (semicolon) myFile.ts[1, 14]: Missing semicolon'
consumer: human
layout: formatter
title: 'Formatter: verbose'
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@
"glob": "^7.1.1",
"optimist": "~0.6.0",
"resolve": "^1.1.7",
"tsutils": "^1.1.0",
"update-notifier": "^2.0.0"
"tsutils": "^1.1.0"
},
"peerDependencies": {
"typescript": ">=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev"
"typescript": ">=2.0.0 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev"
},
"devDependencies": {
"@types/babel-code-frame": "^6.20.0",
Expand All @@ -62,7 +61,6 @@
"@types/node": "^6.0.56",
"@types/optimist": "0.0.29",
"@types/resolve": "0.0.4",
"@types/update-notifier": "^1.0.0",
"chai": "^3.5.0",
"github": "^8.1.1",
"js-yaml": "^3.7.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/assertMinCircleNodes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var requiredNodes = 4;
var nodes = parseInt(process.argv[2], 10);
if (requiredNodes != null && requiredNodes > nodes) {
console.error("ERROR: You must run CircleCI with 4 parallel nodes");
console.error("ERROR: You must run CircleCI with " + requiredNodes + " parallel nodes");
console.error(" This ensures that different environments are tested for TSLint compatibility");
console.error(" https://circleci.com/gh/<YOUR ACCOUNT>/tslint/edit#parallel-builds");
process.exit(1);
Expand Down
47 changes: 26 additions & 21 deletions src/configs/latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ export const rules = {
"no-angle-bracket-type-assertion": true,

// added in v4.1
"only-arrow-functions": [true,
"allow-declarations",
// the following option was added in 4.1
"allow-named-functions",
],
"only-arrow-functions": {
options: [
"allow-declarations",
// the following option was added in 4.1
"allow-named-functions",
],
},
"prefer-const": true,

// added in v4.2
Expand All @@ -38,13 +40,15 @@ export const rules = {

// added in v4.3
"import-spacing": true,
"space-before-function-paren": [true, {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never",
}],
"space-before-function-paren": {
options: {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never",
},
},
"typeof-compare": true,
"unified-signatures": true,

Expand All @@ -54,15 +58,16 @@ export const rules = {
"no-misused-new": true,

// added in v4.5
"ban-types": [
true,
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."],
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
["String", "Avoid using the `String` type. Did you mean `string`?"],
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
],
"ban-types": {
options: [
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."],
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
["String", "Avoid using the `String` type. Did you mean `string`?"],
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
],
},
"no-duplicate-super": true,
};
// tslint:enable object-literal-sort-keys
Expand Down
Loading

0 comments on commit 041f297

Please sign in to comment.