Skip to content

Commit

Permalink
Upgrade tslint to 5.9.1 (#683)
Browse files Browse the repository at this point in the history
* Fix max-line-length tslint config

The max-line-length rule was not being enforced because of an invalid configuration value. In order to supply configuration information other than "on" or "off", the rule must be an array value. While this was silently failing in older versions of tslint, the upgrade to tslint 5.9.0 causes this malformed value to fail with an exception.

After fixing the configuration of this rule, many lines of the existing codebase were in violation. Rather than reformat a bunch of files, I bumped the maximum line length from 120 to 170, and reformatted a handful of outlier lines that were even longer than this.

* Bump minimum tslint version to 5.9.1
  • Loading branch information
tomdale authored and aciccarello committed Jan 23, 2018
1 parent 32bf528 commit efe70aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
"grunt-tslint": "^5.0.1",
"istanbul": "^0.4.1",
"mocha": "^4.0.0",
"tslint": "^5.1.0"
"tslint": "^5.9.1"
},
"files": [
"bin",
Expand Down
7 changes: 6 additions & 1 deletion src/lib/converter/types/array.ts
Expand Up @@ -18,7 +18,12 @@ export class ArrayConverter extends ConverterTypeComponent implements TypeConver
*/
supportsType(context: Context, type: ts.TypeReference): boolean {
// Is there a better way to detect the {"type":"reference","name":"Array","typeArguments":{...}} types that are in fact arrays?
return !!(type.flags & ts.TypeFlags.Object) && !!type.symbol && type.symbol.name === 'Array' && !type.symbol.parent && !!type.typeArguments && type.typeArguments.length === 1;
return !!(type.flags & ts.TypeFlags.Object)
&& !!type.symbol
&& type.symbol.name === 'Array'
&& !type.symbol.parent
&& !!type.typeArguments
&& type.typeArguments.length === 1;
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/lib/utils/events.ts
Expand Up @@ -45,6 +45,10 @@ interface EventIteratee<T, U> {
(events: U, name: string, callback: Function, options: T): U;
}

interface EventTriggerer {
(events: EventHandler[], args: any[]): void;
}

interface OnApiOptions {
context: any;
ctx: any;
Expand Down Expand Up @@ -199,7 +203,7 @@ function onceMap(map: EventMap, name: string, callback: EventCallback, offer: Fu
/**
* Handles triggering the appropriate event callbacks.
*/
function triggerApi(objEvents: EventHandlers, name: string, callback: Function, args: any[], triggerer: {(events: EventHandler[], args: any[]): void} = triggerEvents): EventHandlers {
function triggerApi(objEvents: EventHandlers, name: string, callback: Function, args: any[], triggerer: EventTriggerer = triggerEvents): EventHandlers {
if (objEvents) {
const events = objEvents[name];
let allEvents = objEvents['all'];
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Expand Up @@ -11,7 +11,7 @@
"interface-name": [ true, "never-prefix" ],
"jsdoc-format": true,
"label-position": true,
"max-line-length": 120,
"max-line-length": [true, 170],
"member-access": false,
"member-ordering": false,
"no-any": false,
Expand Down

0 comments on commit efe70aa

Please sign in to comment.