diff --git a/gulpfile.js b/gulpfile.js index 3876759aad..4af66b12a9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -37,6 +37,7 @@ var replace = require('gulp-replace'); var insert = require('gulp-insert'); var uglify = require('gulp-uglify'); var shouldLog = require('./tools/build/logging'); +var tslint = require('gulp-tslint'); require('./tools/check-environment')({ requiredNpmVersion: '>=2.9.0', @@ -246,6 +247,19 @@ gulp.task('enforce-format', function() { }); }); +gulp.task('lint', ['build.tools'], function() { + // https://github.com/palantir/tslint#supported-rules + var tslintConfig = { + "rules": { + "requireReturnType": true + } + }; + + return gulp.src(['modules/angular2/src/**/*.ts', '!modules/angular2/src/test_lib/**']) + .pipe(tslint({configuration: tslintConfig, rulesDirectory: 'dist/tools/tslint'})) + .pipe(tslint.report('prose')); +}); + // ------------ // check circular dependencies in Node.js context gulp.task('build/checkCircularDependencies', function (done) { @@ -592,7 +606,7 @@ gulp.task('pre-test-checks', function(done) { }); gulp.task('post-test-checks', function(done) { - runSequence('enforce-format', sequenceComplete(done)); + runSequence('lint', 'enforce-format', sequenceComplete(done)); }); diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index 5d7cb778b9..fb95a15b65 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -6730,6 +6730,260 @@ } } }, + "gulp-tslint": { + "version": "3.1.0-beta", + "dependencies": { + "gulp-util": { + "version": "3.0.6", + "dependencies": { + "array-differ": { + "version": "1.0.0" + }, + "array-uniq": { + "version": "1.0.2" + }, + "beeper": { + "version": "1.1.0" + }, + "chalk": { + "version": "1.0.0", + "dependencies": { + "ansi-styles": { + "version": "2.0.1" + }, + "escape-string-regexp": { + "version": "1.0.3" + }, + "has-ansi": { + "version": "1.0.3", + "dependencies": { + "ansi-regex": { + "version": "1.1.1" + }, + "get-stdin": { + "version": "4.0.1" + } + } + }, + "supports-color": { + "version": "1.3.1" + } + } + }, + "dateformat": { + "version": "1.0.11", + "dependencies": { + "get-stdin": { + "version": "4.0.1" + }, + "meow": { + "version": "3.3.0", + "dependencies": { + "camelcase-keys": { + "version": "1.0.0", + "dependencies": { + "camelcase": { + "version": "1.1.0" + }, + "map-obj": { + "version": "1.0.1" + } + } + } + } + } + } + }, + "lodash._reescape": { + "version": "3.0.0" + }, + "lodash._reevaluate": { + "version": "3.0.0" + }, + "lodash._reinterpolate": { + "version": "3.0.0" + }, + "lodash.template": { + "version": "3.6.1", + "dependencies": { + "lodash._basecopy": { + "version": "3.0.1" + }, + "lodash._basetostring": { + "version": "3.0.0" + }, + "lodash._basevalues": { + "version": "3.0.0" + }, + "lodash._isiterateecall": { + "version": "3.0.9" + }, + "lodash.escape": { + "version": "3.0.0" + }, + "lodash.keys": { + "version": "3.1.1", + "dependencies": { + "lodash._getnative": { + "version": "3.9.0" + }, + "lodash.isarguments": { + "version": "3.0.3" + }, + "lodash.isarray": { + "version": "3.0.3" + } + } + }, + "lodash.restparam": { + "version": "3.6.1" + }, + "lodash.templatesettings": { + "version": "3.1.0" + } + } + }, + "multipipe": { + "version": "0.1.2", + "dependencies": { + "duplexer2": { + "version": "0.0.2", + "dependencies": { + "readable-stream": { + "version": "1.1.13", + "dependencies": { + "core-util-is": { + "version": "1.0.1" + }, + "isarray": { + "version": "0.0.1" + }, + "string_decoder": { + "version": "0.10.31" + }, + "inherits": { + "version": "2.0.1" + } + } + } + } + } + } + }, + "object-assign": { + "version": "3.0.0" + }, + "replace-ext": { + "version": "0.0.1" + }, + "through2": { + "version": "2.0.0", + "dependencies": { + "readable-stream": { + "version": "2.0.1", + "dependencies": { + "core-util-is": { + "version": "1.0.1" + }, + "inherits": { + "version": "2.0.1" + }, + "isarray": { + "version": "0.0.1" + }, + "process-nextick-args": { + "version": "1.0.1" + }, + "string_decoder": { + "version": "0.10.31" + }, + "util-deprecate": { + "version": "1.0.1" + } + } + } + } + }, + "vinyl": { + "version": "0.5.0", + "dependencies": { + "clone": { + "version": "1.0.2" + }, + "clone-stats": { + "version": "0.0.1" + } + } + } + } + }, + "map-stream": { + "version": "0.1.0" + }, + "rcloader": { + "version": "0.1.4", + "dependencies": { + "lodash": { + "version": "3.9.3" + }, + "rcfinder": { + "version": "0.1.8", + "dependencies": { + "lodash": { + "version": "2.4.2" + } + } + } + } + }, + "through": { + "version": "2.3.7" + }, + "tslint": { + "version": "2.3.0-beta", + "dependencies": { + "findup-sync": { + "version": "0.1.3", + "dependencies": { + "glob": { + "version": "3.2.11", + "dependencies": { + "inherits": { + "version": "2.0.1" + }, + "minimatch": { + "version": "0.3.0", + "dependencies": { + "lru-cache": { + "version": "2.6.4" + }, + "sigmund": { + "version": "1.0.1" + } + } + } + } + } + } + }, + "optimist": { + "version": "0.6.1", + "dependencies": { + "wordwrap": { + "version": "0.0.3" + }, + "minimist": { + "version": "0.0.10" + } + } + }, + "underscore.string": { + "version": "2.3.3" + } + } + } + } + }, "gulp-typescript": { "version": "2.6.0", "dependencies": { @@ -9721,10 +9975,6 @@ } } } - }, - "typescript": { - "version": "1.5.0", - "resolved": "git://github.com/alexeagle/TypeScript.git#be9a7edff73ac2592e508732c771c85357041385" } } }, diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 76f5ce4f5a..19b5d69ad1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3355,11 +3355,12 @@ }, "clang-format": { "version": "1.0.25", - "from": "clang-format@*", + "from": "clang-format@1.0.25", + "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.25.tgz", "dependencies": { "resolve": { "version": "1.1.6", - "from": "resolve@>=1.1.6 <2.0.0", + "from": "https://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.6.tgz" } } @@ -3750,7 +3751,7 @@ }, "dgeni-packages": { "version": "0.10.15", - "from": "dgeni-packages@0.10.15", + "from": "https://registry.npmjs.org/dgeni-packages/-/dgeni-packages-0.10.15.tgz", "resolved": "https://registry.npmjs.org/dgeni-packages/-/dgeni-packages-0.10.15.tgz", "dependencies": { "catharsis": { @@ -6896,94 +6897,95 @@ "gulp-clang-format": { "version": "1.0.21", "from": "gulp-clang-format@1.0.21", + "resolved": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.21.tgz", "dependencies": { "gulp-util": { "version": "3.0.6", - "from": "gulp-util@>=3.0.4 <4.0.0", + "from": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.6.tgz", "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.6.tgz", "dependencies": { "array-differ": { "version": "1.0.0", - "from": "array-differ@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz" }, "array-uniq": { "version": "1.0.2", - "from": "array-uniq@>=1.0.2 <2.0.0", + "from": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz" }, "beeper": { "version": "1.1.0", - "from": "beeper@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz" }, "chalk": { "version": "1.0.0", - "from": "chalk@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", "dependencies": { "ansi-styles": { "version": "2.0.1", - "from": "ansi-styles@>=2.0.1 <3.0.0", + "from": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz" }, "escape-string-regexp": { "version": "1.0.3", - "from": "escape-string-regexp@>=1.0.2 <2.0.0", + "from": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" }, "has-ansi": { "version": "1.0.3", - "from": "has-ansi@>=1.0.3 <2.0.0", + "from": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", "dependencies": { "ansi-regex": { "version": "1.1.1", - "from": "ansi-regex@>=1.1.0 <2.0.0", + "from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" }, "get-stdin": { "version": "4.0.1", - "from": "get-stdin@>=4.0.1 <5.0.0", + "from": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" } } }, "supports-color": { "version": "1.3.1", - "from": "supports-color@>=1.3.0 <2.0.0", + "from": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" } } }, "dateformat": { "version": "1.0.11", - "from": "dateformat@>=1.0.11 <2.0.0", + "from": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz", "dependencies": { "get-stdin": { "version": "4.0.1", - "from": "get-stdin@>=4.0.1 <5.0.0", + "from": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" }, "meow": { "version": "3.3.0", - "from": "meow@*", + "from": "https://registry.npmjs.org/meow/-/meow-3.3.0.tgz", "resolved": "https://registry.npmjs.org/meow/-/meow-3.3.0.tgz", "dependencies": { "camelcase-keys": { "version": "1.0.0", - "from": "camelcase-keys@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz", "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz", "dependencies": { "camelcase": { "version": "1.1.0", - "from": "camelcase@>=1.0.1 <2.0.0", + "from": "https://registry.npmjs.org/camelcase/-/camelcase-1.1.0.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.1.0.tgz" }, "map-obj": { "version": "1.0.1", - "from": "map-obj@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz" } } @@ -6994,116 +6996,116 @@ }, "lodash._reescape": { "version": "3.0.0", - "from": "lodash._reescape@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz" }, "lodash._reevaluate": { "version": "3.0.0", - "from": "lodash._reevaluate@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz" }, "lodash._reinterpolate": { "version": "3.0.0", - "from": "lodash._reinterpolate@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz" }, "lodash.template": { "version": "3.6.1", - "from": "lodash.template@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.1.tgz", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.1.tgz", "dependencies": { "lodash._basecopy": { "version": "3.0.1", - "from": "lodash._basecopy@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz" }, "lodash._basetostring": { "version": "3.0.0", - "from": "lodash._basetostring@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz" }, "lodash._basevalues": { "version": "3.0.0", - "from": "lodash._basevalues@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz" }, "lodash._isiterateecall": { "version": "3.0.9", - "from": "lodash._isiterateecall@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz" }, "lodash.escape": { "version": "3.0.0", - "from": "lodash.escape@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.0.0.tgz", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.0.0.tgz" }, "lodash.keys": { "version": "3.1.1", - "from": "lodash.keys@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.1.tgz", "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.1.tgz", "dependencies": { "lodash._getnative": { "version": "3.9.0", - "from": "lodash._getnative@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.0.tgz", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.0.tgz" }, "lodash.isarguments": { "version": "3.0.3", - "from": "lodash.isarguments@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.0.3.tgz", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.0.3.tgz" }, "lodash.isarray": { "version": "3.0.3", - "from": "lodash.isarray@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.3.tgz", "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.3.tgz" } } }, "lodash.restparam": { "version": "3.6.1", - "from": "lodash.restparam@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz" }, "lodash.templatesettings": { "version": "3.1.0", - "from": "lodash.templatesettings@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.0.tgz", "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.0.tgz" } } }, "multipipe": { "version": "0.1.2", - "from": "multipipe@>=0.1.2 <0.2.0", + "from": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "dependencies": { "duplexer2": { "version": "0.0.2", - "from": "duplexer2@0.0.2", + "from": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", "dependencies": { "readable-stream": { "version": "1.1.13", - "from": "readable-stream@>=1.1.9 <1.2.0", + "from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", "dependencies": { "core-util-is": { "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", + "from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" }, "isarray": { "version": "0.0.1", - "from": "isarray@0.0.1", + "from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, "string_decoder": { "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", + "from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" }, "inherits": { "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", + "from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" } } @@ -7114,52 +7116,52 @@ }, "object-assign": { "version": "3.0.0", - "from": "object-assign@>=3.0.0 <4.0.0", + "from": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz" }, "replace-ext": { "version": "0.0.1", - "from": "replace-ext@0.0.1", + "from": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz" }, "through2": { "version": "2.0.0", - "from": "through2@>=2.0.0 <3.0.0", + "from": "https://registry.npmjs.org/through2/-/through2-2.0.0.tgz", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.0.tgz", "dependencies": { "readable-stream": { "version": "2.0.1", - "from": "readable-stream@>=2.0.0 <2.1.0", + "from": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz", "dependencies": { "core-util-is": { "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", + "from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" }, "inherits": { "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", + "from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, "isarray": { "version": "0.0.1", - "from": "isarray@0.0.1", + "from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, "process-nextick-args": { "version": "1.0.1", - "from": "process-nextick-args@>=1.0.0 <1.1.0", + "from": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.1.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.1.tgz" }, "string_decoder": { "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", + "from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" }, "util-deprecate": { "version": "1.0.1", - "from": "util-deprecate@>=1.0.1 <1.1.0", + "from": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.1.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.1.tgz" } } @@ -7168,17 +7170,17 @@ }, "vinyl": { "version": "0.5.0", - "from": "vinyl@>=0.5.0 <0.6.0", + "from": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.0.tgz", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.0.tgz", "dependencies": { "clone": { "version": "1.0.2", - "from": "clone@>=1.0.0 <2.0.0", + "from": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz" }, "clone-stats": { "version": "0.0.1", - "from": "clone-stats@>=0.0.1 <0.0.2", + "from": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" } } @@ -7187,37 +7189,37 @@ }, "pkginfo": { "version": "0.3.0", - "from": "pkginfo@>=0.3.0 <0.4.0", + "from": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz", "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz" }, "stream-equal": { "version": "0.1.5", - "from": "stream-equal@>=0.1.5 <0.2.0", + "from": "https://registry.npmjs.org/stream-equal/-/stream-equal-0.1.5.tgz", "resolved": "https://registry.npmjs.org/stream-equal/-/stream-equal-0.1.5.tgz", "dependencies": { "readable-stream": { "version": "1.0.33", - "from": "readable-stream@>=1.0.2 <1.1.0", + "from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", "dependencies": { "core-util-is": { "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", + "from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" }, "isarray": { "version": "0.0.1", - "from": "isarray@0.0.1", + "from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, "string_decoder": { "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", + "from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" }, "inherits": { "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", + "from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" } } @@ -10408,6 +10410,400 @@ } } }, + "gulp-tslint": { + "version": "3.1.0-beta", + "from": "gulp-tslint@>=3.1.0-beta <4.0.0", + "resolved": "https://registry.npmjs.org/gulp-tslint/-/gulp-tslint-3.1.0-beta.tgz", + "dependencies": { + "gulp-util": { + "version": "3.0.6", + "from": "gulp-util@>=3.0.4 <3.1.0", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.6.tgz", + "dependencies": { + "array-differ": { + "version": "1.0.0", + "from": "array-differ@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz" + }, + "array-uniq": { + "version": "1.0.2", + "from": "array-uniq@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz" + }, + "beeper": { + "version": "1.1.0", + "from": "beeper@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz" + }, + "chalk": { + "version": "1.0.0", + "from": "chalk@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", + "dependencies": { + "ansi-styles": { + "version": "2.0.1", + "from": "ansi-styles@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz" + }, + "escape-string-regexp": { + "version": "1.0.3", + "from": "escape-string-regexp@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" + }, + "has-ansi": { + "version": "1.0.3", + "from": "has-ansi@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "dependencies": { + "ansi-regex": { + "version": "1.1.1", + "from": "ansi-regex@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "get-stdin": { + "version": "4.0.1", + "from": "get-stdin@>=4.0.1 <5.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" + } + } + }, + "supports-color": { + "version": "1.3.1", + "from": "supports-color@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" + } + } + }, + "dateformat": { + "version": "1.0.11", + "from": "dateformat@>=1.0.11 <2.0.0", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz", + "dependencies": { + "get-stdin": { + "version": "4.0.1", + "from": "get-stdin@*", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" + }, + "meow": { + "version": "3.3.0", + "from": "meow@*", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.3.0.tgz", + "dependencies": { + "camelcase-keys": { + "version": "1.0.0", + "from": "camelcase-keys@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz", + "dependencies": { + "camelcase": { + "version": "1.1.0", + "from": "camelcase@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.1.0.tgz" + }, + "map-obj": { + "version": "1.0.1", + "from": "map-obj@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz" + } + } + } + } + } + } + }, + "lodash._reescape": { + "version": "3.0.0", + "from": "lodash._reescape@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz" + }, + "lodash._reevaluate": { + "version": "3.0.0", + "from": "lodash._reevaluate@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz" + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "from": "lodash._reinterpolate@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz" + }, + "lodash.template": { + "version": "3.6.1", + "from": "lodash.template@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.1.tgz", + "dependencies": { + "lodash._basecopy": { + "version": "3.0.1", + "from": "lodash._basecopy@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz" + }, + "lodash._basetostring": { + "version": "3.0.0", + "from": "lodash._basetostring@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz" + }, + "lodash._basevalues": { + "version": "3.0.0", + "from": "lodash._basevalues@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz" + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "from": "lodash._isiterateecall@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz" + }, + "lodash.escape": { + "version": "3.0.0", + "from": "lodash.escape@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.0.0.tgz" + }, + "lodash.keys": { + "version": "3.1.1", + "from": "lodash.keys@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.1.tgz", + "dependencies": { + "lodash._getnative": { + "version": "3.9.0", + "from": "lodash._getnative@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.0.tgz" + }, + "lodash.isarguments": { + "version": "3.0.3", + "from": "lodash.isarguments@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.0.3.tgz" + }, + "lodash.isarray": { + "version": "3.0.3", + "from": "lodash.isarray@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.3.tgz" + } + } + }, + "lodash.restparam": { + "version": "3.6.1", + "from": "lodash.restparam@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz" + }, + "lodash.templatesettings": { + "version": "3.1.0", + "from": "lodash.templatesettings@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.0.tgz" + } + } + }, + "multipipe": { + "version": "0.1.2", + "from": "multipipe@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "dependencies": { + "duplexer2": { + "version": "0.0.2", + "from": "duplexer2@0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "dependencies": { + "readable-stream": { + "version": "1.1.13", + "from": "readable-stream@>=1.1.9 <1.2.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.1 <2.1.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + } + } + } + } + } + } + }, + "object-assign": { + "version": "3.0.0", + "from": "object-assign@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz" + }, + "replace-ext": { + "version": "0.0.1", + "from": "replace-ext@0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz" + }, + "through2": { + "version": "2.0.0", + "from": "through2@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.0.tgz", + "dependencies": { + "readable-stream": { + "version": "2.0.1", + "from": "readable-stream@>=2.0.0 <2.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz", + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "from": "core-util-is@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.1 <2.1.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "process-nextick-args": { + "version": "1.0.1", + "from": "process-nextick-args@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.1.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "util-deprecate": { + "version": "1.0.1", + "from": "util-deprecate@>=1.0.1 <1.1.0", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.1.tgz" + } + } + } + } + }, + "vinyl": { + "version": "0.5.0", + "from": "vinyl@>=0.5.0 <0.6.0", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.0.tgz", + "dependencies": { + "clone": { + "version": "1.0.2", + "from": "clone@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz" + }, + "clone-stats": { + "version": "0.0.1", + "from": "clone-stats@>=0.0.1 <0.0.2", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" + } + } + } + } + }, + "map-stream": { + "version": "0.1.0", + "from": "map-stream@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz" + }, + "rcloader": { + "version": "0.1.4", + "from": "rcloader@>=0.1.4 <0.2.0", + "resolved": "https://registry.npmjs.org/rcloader/-/rcloader-0.1.4.tgz", + "dependencies": { + "lodash": { + "version": "3.9.3", + "from": "lodash@>=3.0.1 <4.0.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.9.3.tgz" + }, + "rcfinder": { + "version": "0.1.8", + "from": "rcfinder@>=0.1.6 <0.2.0", + "resolved": "https://registry.npmjs.org/rcfinder/-/rcfinder-0.1.8.tgz", + "dependencies": { + "lodash": { + "version": "2.4.2", + "from": "lodash@>=2.4.1 <2.5.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz" + } + } + } + } + }, + "through": { + "version": "2.3.7", + "from": "through@>=2.3.7 <2.4.0", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.7.tgz" + }, + "tslint": { + "version": "2.3.0-beta", + "from": "tslint@>=2.3.0-beta <2.4.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-2.3.0-beta.tgz", + "dependencies": { + "findup-sync": { + "version": "0.1.3", + "from": "findup-sync@>=0.1.2 <0.2.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "dependencies": { + "glob": { + "version": "3.2.11", + "from": "glob@>=3.2.9 <3.3.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "dependencies": { + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "minimatch": { + "version": "0.3.0", + "from": "minimatch@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "dependencies": { + "lru-cache": { + "version": "2.6.4", + "from": "lru-cache@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.4.tgz" + }, + "sigmund": { + "version": "1.0.1", + "from": "sigmund@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" + } + } + } + } + } + } + }, + "optimist": { + "version": "0.6.1", + "from": "optimist@>=0.6.0 <0.7.0", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "dependencies": { + "wordwrap": { + "version": "0.0.3", + "from": "wordwrap@>=0.0.2 <0.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" + }, + "minimist": { + "version": "0.0.10", + "from": "minimist@>=0.0.1 <0.1.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" + } + } + }, + "underscore.string": { + "version": "2.3.3", + "from": "underscore.string@>=2.3.3 <2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz" + } + } + } + } + }, "gulp-typescript": { "version": "2.6.0", "from": "https://registry.npmjs.org/gulp-typescript/-/gulp-typescript-2.6.0.tgz", @@ -15023,11 +15419,6 @@ } } } - }, - "typescript": { - "version": "1.5.0", - "from": "git://github.com/alexeagle/TypeScript.git#be9a7edff73ac2592e508732c771c85357041385", - "resolved": "git://github.com/alexeagle/TypeScript.git#be9a7edff73ac2592e508732c771c85357041385" } } }, diff --git a/package.json b/package.json index 74bcd9fc2a..d567d1410a 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "gulp-sourcemaps": "1.3.*", "gulp-template": "^3.0.0", "gulp-traceur": "0.17.*", + "gulp-tslint": "^3.1.0-beta", "gulp-typescript": "^2.6.0", "gulp-uglify": "^1.2.0", "gulp-webserver": "^0.8.7", diff --git a/tools/tslint/requireReturnTypeRule.ts b/tools/tslint/requireReturnTypeRule.ts new file mode 100644 index 0000000000..1c3b33fbf3 --- /dev/null +++ b/tools/tslint/requireReturnTypeRule.ts @@ -0,0 +1,61 @@ +/// +/// + +export class Rule extends Lint.Rules.AbstractRule { + public static FAILURE_STRING = "missing type declaration"; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + const typedefWalker = new TypedefWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(typedefWalker); + } +} + +class TypedefWalker extends Lint.RuleWalker { + hasReturnStatement: boolean; + + public visitFunctionDeclaration(node: ts.FunctionDeclaration) { + this.hasReturnStatement = false; + super.visitFunctionDeclaration(node); + if (this.hasReturnStatement) { + this.handleCallSignature(node); + } + } + public visitFunctionExpression(node: ts.FunctionExpression) { + let orig = this.hasReturnStatement; + super.visitFunctionExpression(node); + this.hasReturnStatement = orig; + } + public visitMethodDeclaration(node: ts.MethodDeclaration) { + this.hasReturnStatement = false; + super.visitMethodDeclaration(node); + if (this.hasReturnStatement) { + this.handleCallSignature(node); + } + } + public visitReturnStatement(node: ts.ReturnStatement) { + if (node.expression) { + this.hasReturnStatement = true; + } + super.visitReturnStatement(node); + } + + private handleCallSignature(node: ts.SignatureDeclaration) { + const location = (node.parameters != null) ? node.parameters.end : null; + // set accessors can't have a return type. + if (node.kind !== ts.SyntaxKind.SetAccessor) { + this.checkTypeAnnotation(location, node.type, node.name); + } + } + + private checkTypeAnnotation(location: number, typeAnnotation: ts.TypeNode, name?: ts.Node) { + if (typeAnnotation == null) { + let ns = ""; + if (name != null && name.kind === ts.SyntaxKind.Identifier) { + ns = (name).text; + } + if (ns.charAt(0) === '_') return; + let failure = this.createFailure(location, 1, "expected " + ns + " to have a return type"); + this.addFailure(failure); + } + } +}