From cf84661141d9ad60aa5e8dfa2e6057afc946cd3b Mon Sep 17 00:00:00 2001 From: Patrick Walters Date: Thu, 29 Sep 2016 00:37:33 -0500 Subject: [PATCH] chore(tslint): update lint rules * chore(tslint): update lint rules Before no lint rules were being enforced. Fixes #646. * chore(tslint): clean up lint errors Adjusted rules to not force trailing commas and not force sorting objects by the name property, which in our case is not ideal since the route is more important. * chore(tslint): fix broken tslint configuration - tslint v6.0.0 requires a different lint configuration (was currently broken). Fixed by moving options out of reporter for both skeletons. - Updated typescript-aspnetcore to clean linting errors - Added tslint.json to typescript-aspnetcore --- .../src/skeleton/build/tasks/lint.js | 10 +- .../src/skeleton/src/app.ts | 8 +- .../src/skeleton/src/blur-image.ts | 542 +++++++++--------- .../src/skeleton/src/child-router.ts | 8 +- .../src/skeleton/src/main.ts | 8 +- .../src/skeleton/src/users.ts | 6 +- .../src/skeleton/src/welcome.ts | 26 +- .../src/skeleton/tslint.json | 8 + skeleton-typescript/build/tasks/lint.js | 10 +- skeleton-typescript/src/app.ts | 6 +- skeleton-typescript/src/blur-image.ts | 4 +- skeleton-typescript/src/child-router.ts | 8 +- skeleton-typescript/src/main.ts | 8 +- skeleton-typescript/src/users.ts | 6 +- skeleton-typescript/src/welcome.ts | 26 +- skeleton-typescript/tslint.json | 5 +- 16 files changed, 350 insertions(+), 339 deletions(-) create mode 100644 skeleton-typescript-aspnetcore/src/skeleton/tslint.json diff --git a/skeleton-typescript-aspnetcore/src/skeleton/build/tasks/lint.js b/skeleton-typescript-aspnetcore/src/skeleton/build/tasks/lint.js index 96b06723e..d6d759933 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/build/tasks/lint.js +++ b/skeleton-typescript-aspnetcore/src/skeleton/build/tasks/lint.js @@ -1,11 +1,11 @@ var gulp = require('gulp'); var paths = require('../paths'); var tslint = require('gulp-tslint'); - + gulp.task('lint', function() { return gulp.src(paths.source) - .pipe(tslint()) - .pipe(tslint.report('prose', { + .pipe(tslint({ emitError: false - })); -}); \ No newline at end of file + })) + .pipe(tslint.report()); +}); diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/app.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/app.ts index bf2c411c4..9605769f3 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/app.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/app.ts @@ -1,9 +1,9 @@ -import {Router, RouterConfiguration} from 'aurelia-router' +import {Router, RouterConfiguration} from 'aurelia-router'; export class App { - router: Router; - - configureRouter(config: RouterConfiguration, router: Router) { + public router: Router; + + public configureRouter(config: RouterConfiguration, router: Router) { config.title = 'Aurelia'; config.map([ { route: ['', 'welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title: 'Welcome' }, diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/blur-image.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/blur-image.ts index 99820f649..86dfa831f 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/blur-image.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/blur-image.ts @@ -6,7 +6,7 @@ export class BlurImageCustomAttribute { this.element = element; } - valueChanged(newImage: HTMLImageElement) { + public valueChanged(newImage: HTMLImageElement) { if (newImage.complete) { drawBlur(this.element, newImage); } else { @@ -15,7 +15,7 @@ export class BlurImageCustomAttribute { } } -/* eslint-disable */ +/* tslint:disable */ /* This Snippet is using a modified Stack Blur js lib for blurring the header images. @@ -26,10 +26,10 @@ This Snippet is using a modified Stack Blur js lib for blurring the header image StackBlur - a fast almost Gaussian Blur For Canvas Version: 0.5 -Author: Mario Klingemann -Contact: mario@quasimondo.com -Website: http://www.quasimondo.com/StackBlurForCanvas -Twitter: @quasimondo +Author: Mario Klingemann +Contact: mario@quasimondo.com +Website: http://www.quasimondo.com/StackBlurForCanvas +Twitter: @quasimondo In case you find this class useful - especially in commercial projects - I am not totally unhappy for a small donation to my PayPal account @@ -82,281 +82,281 @@ var mul_table = [ var shg_table = [ - 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, - 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ]; + 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, + 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ]; var BLUR_RADIUS = 40; function stackBlurCanvasRGBA( canvas, top_x, top_y, width, height, radius ) { - if ( isNaN(radius) || radius < 1 ) return; - radius |= 0; - - var context = canvas.getContext("2d"); - var imageData; - - try { - imageData = context.getImageData( top_x, top_y, width, height ); - } catch(e) { - throw new Error("unable to access image data: " + e); - } - - var pixels = imageData.data; - - var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, - r_out_sum, g_out_sum, b_out_sum, a_out_sum, - r_in_sum, g_in_sum, b_in_sum, a_in_sum, - pr, pg, pb, pa, rbs; - - var div = radius + radius + 1; - var w4 = width << 2; - var widthMinus1 = width - 1; - var heightMinus1 = height - 1; - var radiusPlus1 = radius + 1; - var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2; - - var stackStart = new BlurStack(); - var stack = stackStart; - for ( i = 1; i < div; i++ ) - { - stack = stack.next = new BlurStack(); - if ( i == radiusPlus1 ) var stackEnd = stack; - } - stack.next = stackStart; - var stackIn = null; - var stackOut = null; - - yw = yi = 0; - - var mul_sum = mul_table[radius]; - var shg_sum = shg_table[radius]; - - for ( y = 0; y < height; y++ ) - { - r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0; - - r_out_sum = radiusPlus1 * ( pr = pixels[yi] ); - g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] ); - b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] ); - a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] ); - - r_sum += sumFactor * pr; - g_sum += sumFactor * pg; - b_sum += sumFactor * pb; - a_sum += sumFactor * pa; - - stack = stackStart; - - for( i = 0; i < radiusPlus1; i++ ) - { - stack.r = pr; - stack.g = pg; - stack.b = pb; - stack.a = pa; - stack = stack.next; - } - - for( i = 1; i < radiusPlus1; i++ ) - { - p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 ); - r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i ); - g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs; - b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs; - a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs; - - r_in_sum += pr; - g_in_sum += pg; - b_in_sum += pb; - a_in_sum += pa; - - stack = stack.next; - } - - - stackIn = stackStart; - stackOut = stackEnd; - for ( x = 0; x < width; x++ ) - { - pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum; - if ( pa != 0 ) - { - pa = 255 / pa; - pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa; - pixels[yi+1] = ((g_sum * mul_sum) >> shg_sum) * pa; - pixels[yi+2] = ((b_sum * mul_sum) >> shg_sum) * pa; - } else { - pixels[yi] = pixels[yi+1] = pixels[yi+2] = 0; - } - - r_sum -= r_out_sum; - g_sum -= g_out_sum; - b_sum -= b_out_sum; - a_sum -= a_out_sum; - - r_out_sum -= stackIn.r; - g_out_sum -= stackIn.g; - b_out_sum -= stackIn.b; - a_out_sum -= stackIn.a; - - p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2; - - r_in_sum += ( stackIn.r = pixels[p]); - g_in_sum += ( stackIn.g = pixels[p+1]); - b_in_sum += ( stackIn.b = pixels[p+2]); - a_in_sum += ( stackIn.a = pixels[p+3]); - - r_sum += r_in_sum; - g_sum += g_in_sum; - b_sum += b_in_sum; - a_sum += a_in_sum; - - stackIn = stackIn.next; - - r_out_sum += ( pr = stackOut.r ); - g_out_sum += ( pg = stackOut.g ); - b_out_sum += ( pb = stackOut.b ); - a_out_sum += ( pa = stackOut.a ); - - r_in_sum -= pr; - g_in_sum -= pg; - b_in_sum -= pb; - a_in_sum -= pa; - - stackOut = stackOut.next; - - yi += 4; - } - yw += width; - } - - - for ( x = 0; x < width; x++ ) - { - g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0; - - yi = x << 2; - r_out_sum = radiusPlus1 * ( pr = pixels[yi]); - g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]); - b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]); - a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]); - - r_sum += sumFactor * pr; - g_sum += sumFactor * pg; - b_sum += sumFactor * pb; - a_sum += sumFactor * pa; - - stack = stackStart; - - for( i = 0; i < radiusPlus1; i++ ) - { - stack.r = pr; - stack.g = pg; - stack.b = pb; - stack.a = pa; - stack = stack.next; - } - - yp = width; - - for( i = 1; i <= radius; i++ ) - { - yi = ( yp + x ) << 2; - - r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i ); - g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs; - b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs; - a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs; - - r_in_sum += pr; - g_in_sum += pg; - b_in_sum += pb; - a_in_sum += pa; - - stack = stack.next; - - if( i < heightMinus1 ) - { - yp += width; - } - } - - yi = x; - stackIn = stackStart; - stackOut = stackEnd; - for ( y = 0; y < height; y++ ) - { - p = yi << 2; - pixels[p+3] = pa = (a_sum * mul_sum) >> shg_sum; - if ( pa > 0 ) - { - pa = 255 / pa; - pixels[p] = ((r_sum * mul_sum) >> shg_sum ) * pa; - pixels[p+1] = ((g_sum * mul_sum) >> shg_sum ) * pa; - pixels[p+2] = ((b_sum * mul_sum) >> shg_sum ) * pa; - } else { - pixels[p] = pixels[p+1] = pixels[p+2] = 0; - } - - r_sum -= r_out_sum; - g_sum -= g_out_sum; - b_sum -= b_out_sum; - a_sum -= a_out_sum; - - r_out_sum -= stackIn.r; - g_out_sum -= stackIn.g; - b_out_sum -= stackIn.b; - a_out_sum -= stackIn.a; - - p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2; - - r_sum += ( r_in_sum += ( stackIn.r = pixels[p])); - g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1])); - b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2])); - a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3])); - - stackIn = stackIn.next; - - r_out_sum += ( pr = stackOut.r ); - g_out_sum += ( pg = stackOut.g ); - b_out_sum += ( pb = stackOut.b ); - a_out_sum += ( pa = stackOut.a ); - - r_in_sum -= pr; - g_in_sum -= pg; - b_in_sum -= pb; - a_in_sum -= pa; - - stackOut = stackOut.next; - - yi += width; - } - } - - context.putImageData( imageData, top_x, top_y ); + if ( isNaN(radius) || radius < 1 ) return; + radius |= 0; + + var context = canvas.getContext("2d"); + var imageData; + + try { + imageData = context.getImageData( top_x, top_y, width, height ); + } catch(e) { + throw new Error("unable to access image data: " + e); + } + + var pixels = imageData.data; + + var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, + r_out_sum, g_out_sum, b_out_sum, a_out_sum, + r_in_sum, g_in_sum, b_in_sum, a_in_sum, + pr, pg, pb, pa, rbs; + + var div = radius + radius + 1; + var w4 = width << 2; + var widthMinus1 = width - 1; + var heightMinus1 = height - 1; + var radiusPlus1 = radius + 1; + var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2; + + var stackStart = new BlurStack(); + var stack = stackStart; + for ( i = 1; i < div; i++ ) + { + stack = stack.next = new BlurStack(); + if ( i == radiusPlus1 ) var stackEnd = stack; + } + stack.next = stackStart; + var stackIn = null; + var stackOut = null; + + yw = yi = 0; + + var mul_sum = mul_table[radius]; + var shg_sum = shg_table[radius]; + + for ( y = 0; y < height; y++ ) + { + r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0; + + r_out_sum = radiusPlus1 * ( pr = pixels[yi] ); + g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] ); + b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] ); + a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] ); + + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + a_sum += sumFactor * pa; + + stack = stackStart; + + for( i = 0; i < radiusPlus1; i++ ) + { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack.a = pa; + stack = stack.next; + } + + for( i = 1; i < radiusPlus1; i++ ) + { + p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 ); + r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i ); + g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs; + b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs; + a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs; + + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + a_in_sum += pa; + + stack = stack.next; + } + + + stackIn = stackStart; + stackOut = stackEnd; + for ( x = 0; x < width; x++ ) + { + pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum; + if ( pa != 0 ) + { + pa = 255 / pa; + pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa; + pixels[yi+1] = ((g_sum * mul_sum) >> shg_sum) * pa; + pixels[yi+2] = ((b_sum * mul_sum) >> shg_sum) * pa; + } else { + pixels[yi] = pixels[yi+1] = pixels[yi+2] = 0; + } + + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + a_sum -= a_out_sum; + + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + a_out_sum -= stackIn.a; + + p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2; + + r_in_sum += ( stackIn.r = pixels[p]); + g_in_sum += ( stackIn.g = pixels[p+1]); + b_in_sum += ( stackIn.b = pixels[p+2]); + a_in_sum += ( stackIn.a = pixels[p+3]); + + r_sum += r_in_sum; + g_sum += g_in_sum; + b_sum += b_in_sum; + a_sum += a_in_sum; + + stackIn = stackIn.next; + + r_out_sum += ( pr = stackOut.r ); + g_out_sum += ( pg = stackOut.g ); + b_out_sum += ( pb = stackOut.b ); + a_out_sum += ( pa = stackOut.a ); + + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + a_in_sum -= pa; + + stackOut = stackOut.next; + + yi += 4; + } + yw += width; + } + + + for ( x = 0; x < width; x++ ) + { + g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0; + + yi = x << 2; + r_out_sum = radiusPlus1 * ( pr = pixels[yi]); + g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]); + b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]); + a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]); + + r_sum += sumFactor * pr; + g_sum += sumFactor * pg; + b_sum += sumFactor * pb; + a_sum += sumFactor * pa; + + stack = stackStart; + + for( i = 0; i < radiusPlus1; i++ ) + { + stack.r = pr; + stack.g = pg; + stack.b = pb; + stack.a = pa; + stack = stack.next; + } + + yp = width; + + for( i = 1; i <= radius; i++ ) + { + yi = ( yp + x ) << 2; + + r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i ); + g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs; + b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs; + a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs; + + r_in_sum += pr; + g_in_sum += pg; + b_in_sum += pb; + a_in_sum += pa; + + stack = stack.next; + + if( i < heightMinus1 ) + { + yp += width; + } + } + + yi = x; + stackIn = stackStart; + stackOut = stackEnd; + for ( y = 0; y < height; y++ ) + { + p = yi << 2; + pixels[p+3] = pa = (a_sum * mul_sum) >> shg_sum; + if ( pa > 0 ) + { + pa = 255 / pa; + pixels[p] = ((r_sum * mul_sum) >> shg_sum ) * pa; + pixels[p+1] = ((g_sum * mul_sum) >> shg_sum ) * pa; + pixels[p+2] = ((b_sum * mul_sum) >> shg_sum ) * pa; + } else { + pixels[p] = pixels[p+1] = pixels[p+2] = 0; + } + + r_sum -= r_out_sum; + g_sum -= g_out_sum; + b_sum -= b_out_sum; + a_sum -= a_out_sum; + + r_out_sum -= stackIn.r; + g_out_sum -= stackIn.g; + b_out_sum -= stackIn.b; + a_out_sum -= stackIn.a; + + p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2; + + r_sum += ( r_in_sum += ( stackIn.r = pixels[p])); + g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1])); + b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2])); + a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3])); + + stackIn = stackIn.next; + + r_out_sum += ( pr = stackOut.r ); + g_out_sum += ( pg = stackOut.g ); + b_out_sum += ( pb = stackOut.b ); + a_out_sum += ( pa = stackOut.a ); + + r_in_sum -= pr; + g_in_sum -= pg; + b_in_sum -= pb; + a_in_sum -= pa; + + stackOut = stackOut.next; + + yi += width; + } + } + + context.putImageData( imageData, top_x, top_y ); } function BlurStack() { - this.r = 0; - this.g = 0; - this.b = 0; - this.a = 0; - this.next = null; + this.r = 0; + this.g = 0; + this.b = 0; + this.a = 0; + this.next = null; } function drawBlur(canvas, image) { diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/child-router.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/child-router.ts index cf7457fd4..4b927ed02 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/child-router.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/child-router.ts @@ -1,10 +1,10 @@ -import {Router, RouterConfiguration} from 'aurelia-router' +import {Router, RouterConfiguration} from 'aurelia-router'; export class ChildRouter { - heading = 'Child Router'; - router: Router; + public heading = 'Child Router'; + public router: Router; - configureRouter(config: RouterConfiguration, router: Router) { + public configureRouter(config: RouterConfiguration, router: Router) { config.map([ { route: ['', 'welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title: 'Welcome' }, { route: 'users', name: 'users', moduleId: 'users', nav: true, title: 'Github Users' }, diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/main.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/main.ts index 7a08cfd0e..028355e93 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/main.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/main.ts @@ -6,11 +6,11 @@ export function configure(aurelia: Aurelia) { .standardConfiguration() .developmentLogging(); - //Uncomment the line below to enable animation. - //aurelia.use.plugin('aurelia-animator-css'); + // Uncomment the line below to enable animation. + // aurelia.use.plugin('aurelia-animator-css'); - //Anyone wanting to use HTMLImports to load views, will need to install the following plugin. - //aurelia.use.plugin('aurelia-html-import-template-loader') + // Anyone wanting to use HTMLImports to load views, will need to install the following plugin. + // aurelia.use.plugin('aurelia-html-import-template-loader') aurelia.start().then(() => aurelia.setRoot()); } diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/users.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/users.ts index bd761009d..2dbc76f4c 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/users.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/users.ts @@ -4,8 +4,8 @@ import 'fetch'; @autoinject export class Users { - heading = 'Github Users'; - users = []; + public heading = 'Github Users'; + public users = []; constructor(private http: HttpClient) { http.configure(config => { @@ -15,7 +15,7 @@ export class Users { }); } - activate() { + public activate() { return this.http.fetch('users') .then(response => response.json()) .then(users => this.users = users); diff --git a/skeleton-typescript-aspnetcore/src/skeleton/src/welcome.ts b/skeleton-typescript-aspnetcore/src/skeleton/src/welcome.ts index 2ddf74551..a4fe9c513 100644 --- a/skeleton-typescript-aspnetcore/src/skeleton/src/welcome.ts +++ b/skeleton-typescript-aspnetcore/src/skeleton/src/welcome.ts @@ -1,26 +1,26 @@ -//import {computedFrom} from 'aurelia-framework'; +// import {computedFrom} from 'aurelia-framework'; export class Welcome { - heading = 'Welcome to the Aurelia Navigation App!'; - firstName = 'John'; - lastName = 'Doe'; - previousValue = this.fullName; + public heading = 'Welcome to the Aurelia Navigation App!'; + public firstName = 'John'; + public lastName = 'Doe'; + private previousValue = this.fullName; - //Getters can't be directly observed, so they must be dirty checked. - //However, if you tell Aurelia the dependencies, it no longer needs to dirty check the property. - //To optimize by declaring the properties that this getter is computed from, uncomment the line below - //as well as the corresponding import above. - //@computedFrom('firstName', 'lastName') + // Getters can't be directly observed, so they must be dirty checked. + // However, if you tell Aurelia the dependencies, it no longer needs to dirty check the property. + // To optimize by declaring the properties that this getter is computed from, uncomment the line below + // as well as the corresponding import above. + // @computedFrom('firstName', 'lastName') get fullName() { return `${this.firstName} ${this.lastName}`; } - submit() { + public submit() { this.previousValue = this.fullName; alert(`Welcome, ${this.fullName}!`); } - canDeactivate() { + public canDeactivate() { if (this.fullName !== this.previousValue) { return confirm('Are you sure you want to leave?'); } @@ -28,7 +28,7 @@ export class Welcome { } export class UpperValueConverter { - toView(value) { + public toView(value) { return value && value.toUpperCase(); } } diff --git a/skeleton-typescript-aspnetcore/src/skeleton/tslint.json b/skeleton-typescript-aspnetcore/src/skeleton/tslint.json new file mode 100644 index 000000000..7e3e52ab4 --- /dev/null +++ b/skeleton-typescript-aspnetcore/src/skeleton/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "tslint:recommended", + "rules": { + "quotemark": [true, "single", "double"], + "trailing-comma": [true, {"multiline": "never", "singleline": "never"}], + "object-literal-sort-keys": false + } +} diff --git a/skeleton-typescript/build/tasks/lint.js b/skeleton-typescript/build/tasks/lint.js index 96b06723e..d6d759933 100644 --- a/skeleton-typescript/build/tasks/lint.js +++ b/skeleton-typescript/build/tasks/lint.js @@ -1,11 +1,11 @@ var gulp = require('gulp'); var paths = require('../paths'); var tslint = require('gulp-tslint'); - + gulp.task('lint', function() { return gulp.src(paths.source) - .pipe(tslint()) - .pipe(tslint.report('prose', { + .pipe(tslint({ emitError: false - })); -}); \ No newline at end of file + })) + .pipe(tslint.report()); +}); diff --git a/skeleton-typescript/src/app.ts b/skeleton-typescript/src/app.ts index d041767ea..9605769f3 100644 --- a/skeleton-typescript/src/app.ts +++ b/skeleton-typescript/src/app.ts @@ -1,9 +1,9 @@ import {Router, RouterConfiguration} from 'aurelia-router'; export class App { - router: Router; - - configureRouter(config: RouterConfiguration, router: Router) { + public router: Router; + + public configureRouter(config: RouterConfiguration, router: Router) { config.title = 'Aurelia'; config.map([ { route: ['', 'welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title: 'Welcome' }, diff --git a/skeleton-typescript/src/blur-image.ts b/skeleton-typescript/src/blur-image.ts index 99820f649..12248a1b2 100644 --- a/skeleton-typescript/src/blur-image.ts +++ b/skeleton-typescript/src/blur-image.ts @@ -6,7 +6,7 @@ export class BlurImageCustomAttribute { this.element = element; } - valueChanged(newImage: HTMLImageElement) { + public valueChanged(newImage: HTMLImageElement) { if (newImage.complete) { drawBlur(this.element, newImage); } else { @@ -15,7 +15,7 @@ export class BlurImageCustomAttribute { } } -/* eslint-disable */ +/* tslint:disable */ /* This Snippet is using a modified Stack Blur js lib for blurring the header images. diff --git a/skeleton-typescript/src/child-router.ts b/skeleton-typescript/src/child-router.ts index cf7457fd4..4b927ed02 100644 --- a/skeleton-typescript/src/child-router.ts +++ b/skeleton-typescript/src/child-router.ts @@ -1,10 +1,10 @@ -import {Router, RouterConfiguration} from 'aurelia-router' +import {Router, RouterConfiguration} from 'aurelia-router'; export class ChildRouter { - heading = 'Child Router'; - router: Router; + public heading = 'Child Router'; + public router: Router; - configureRouter(config: RouterConfiguration, router: Router) { + public configureRouter(config: RouterConfiguration, router: Router) { config.map([ { route: ['', 'welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title: 'Welcome' }, { route: 'users', name: 'users', moduleId: 'users', nav: true, title: 'Github Users' }, diff --git a/skeleton-typescript/src/main.ts b/skeleton-typescript/src/main.ts index 7a08cfd0e..028355e93 100644 --- a/skeleton-typescript/src/main.ts +++ b/skeleton-typescript/src/main.ts @@ -6,11 +6,11 @@ export function configure(aurelia: Aurelia) { .standardConfiguration() .developmentLogging(); - //Uncomment the line below to enable animation. - //aurelia.use.plugin('aurelia-animator-css'); + // Uncomment the line below to enable animation. + // aurelia.use.plugin('aurelia-animator-css'); - //Anyone wanting to use HTMLImports to load views, will need to install the following plugin. - //aurelia.use.plugin('aurelia-html-import-template-loader') + // Anyone wanting to use HTMLImports to load views, will need to install the following plugin. + // aurelia.use.plugin('aurelia-html-import-template-loader') aurelia.start().then(() => aurelia.setRoot()); } diff --git a/skeleton-typescript/src/users.ts b/skeleton-typescript/src/users.ts index bd761009d..2dbc76f4c 100644 --- a/skeleton-typescript/src/users.ts +++ b/skeleton-typescript/src/users.ts @@ -4,8 +4,8 @@ import 'fetch'; @autoinject export class Users { - heading = 'Github Users'; - users = []; + public heading = 'Github Users'; + public users = []; constructor(private http: HttpClient) { http.configure(config => { @@ -15,7 +15,7 @@ export class Users { }); } - activate() { + public activate() { return this.http.fetch('users') .then(response => response.json()) .then(users => this.users = users); diff --git a/skeleton-typescript/src/welcome.ts b/skeleton-typescript/src/welcome.ts index 2ddf74551..a4fe9c513 100644 --- a/skeleton-typescript/src/welcome.ts +++ b/skeleton-typescript/src/welcome.ts @@ -1,26 +1,26 @@ -//import {computedFrom} from 'aurelia-framework'; +// import {computedFrom} from 'aurelia-framework'; export class Welcome { - heading = 'Welcome to the Aurelia Navigation App!'; - firstName = 'John'; - lastName = 'Doe'; - previousValue = this.fullName; + public heading = 'Welcome to the Aurelia Navigation App!'; + public firstName = 'John'; + public lastName = 'Doe'; + private previousValue = this.fullName; - //Getters can't be directly observed, so they must be dirty checked. - //However, if you tell Aurelia the dependencies, it no longer needs to dirty check the property. - //To optimize by declaring the properties that this getter is computed from, uncomment the line below - //as well as the corresponding import above. - //@computedFrom('firstName', 'lastName') + // Getters can't be directly observed, so they must be dirty checked. + // However, if you tell Aurelia the dependencies, it no longer needs to dirty check the property. + // To optimize by declaring the properties that this getter is computed from, uncomment the line below + // as well as the corresponding import above. + // @computedFrom('firstName', 'lastName') get fullName() { return `${this.firstName} ${this.lastName}`; } - submit() { + public submit() { this.previousValue = this.fullName; alert(`Welcome, ${this.fullName}!`); } - canDeactivate() { + public canDeactivate() { if (this.fullName !== this.previousValue) { return confirm('Are you sure you want to leave?'); } @@ -28,7 +28,7 @@ export class Welcome { } export class UpperValueConverter { - toView(value) { + public toView(value) { return value && value.toUpperCase(); } } diff --git a/skeleton-typescript/tslint.json b/skeleton-typescript/tslint.json index a5240ac18..7e3e52ab4 100644 --- a/skeleton-typescript/tslint.json +++ b/skeleton-typescript/tslint.json @@ -1,5 +1,8 @@ { + "extends": "tslint:recommended", "rules": { - + "quotemark": [true, "single", "double"], + "trailing-comma": [true, {"multiline": "never", "singleline": "never"}], + "object-literal-sort-keys": false } }