From 78cc2e6d36a5e98d0947d267207b7b561ca55d0c Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Sat, 6 Aug 2016 18:24:14 +0300 Subject: [PATCH 1/2] chore(package): fix some warnings/errors Related to #14952. Fixed the following warnings/errors: 1. **Warning**: Closure Compiler complained about `/* @this */` (annotations in non-JSDoc cooments). Fixed by changing `/* @this */` to `/** @this */`. 2. **Warning**: Dgeni complaines about `/** @this */` (invalid tags found). Fixed by adding an empty `this` tag definition in `docs/config/tag-defs/`. 3. **Error**: ESLint complained about CRLF linebreaks in `build/docs/examples/`. These are generated by dgeni and (apparently) use the system's default linebreak (i.e. CRLF on Windows). Fixed by disabling the `linebreak-style` rule for `build/docs/examples/`. --- docs/app/src/search.js | 2 +- docs/config/index.js | 1 + docs/config/tag-defs/this.js | 5 +++++ docs/gulpfile.js | 4 ++++ src/apis.js | 2 +- src/auto/injector.js | 2 +- src/jqLite.js | 4 ++-- src/ng/animate.js | 6 +++--- src/ng/animateRunner.js | 4 ++-- src/ng/browser.js | 2 +- src/ng/compile.js | 6 +++--- src/ng/cookieReader.js | 2 +- src/ng/directive/input.js | 4 ++-- src/ng/directive/ngModel.js | 2 +- src/ng/directive/select.js | 2 +- src/ng/filter.js | 2 +- src/ng/forceReflow.js | 2 +- src/ng/http.js | 4 ++-- src/ng/interpolate.js | 2 +- src/ng/interval.js | 2 +- src/ng/jsonpCallbacks.js | 2 +- src/ng/location.js | 4 ++-- src/ng/q.js | 2 +- src/ng/raf.js | 2 +- src/ng/testability.js | 2 +- src/ng/timeout.js | 2 +- src/ngAnimate/animateCss.js | 2 +- src/ngAnimate/animateCssDriver.js | 2 +- src/ngAnimate/animateJs.js | 2 +- src/ngAnimate/animateJsDriver.js | 2 +- src/ngAnimate/animateQueue.js | 4 ++-- src/ngAnimate/animation.js | 2 +- src/ngCookies/cookieWriter.js | 2 +- src/ngCookies/cookies.js | 2 +- src/ngMock/angular-mocks.js | 2 +- src/ngScenario/Describe.js | 4 ++-- src/ngScenario/Runner.js | 8 ++++---- src/ngScenario/Scenario.js | 4 ++-- src/ngScenario/SpecRunner.js | 2 +- src/ngScenario/matchers.js | 20 ++++++++++---------- 40 files changed, 71 insertions(+), 61 deletions(-) create mode 100644 docs/config/tag-defs/this.js diff --git a/docs/app/src/search.js b/docs/app/src/search.js index 5a49b11bc104..79bae064fdd9 100644 --- a/docs/app/src/search.js +++ b/docs/app/src/search.js @@ -95,7 +95,7 @@ angular.module('search', []) } // Create the lunr index - var index = lunr(/* @this */ function() { + var index = lunr(/** @this */ function() { this.ref('path'); this.field('titleWords', {boost: 50}); this.field('members', { boost: 40}); diff --git a/docs/config/index.js b/docs/config/index.js index ad43a442121e..d0716012ad1c 100644 --- a/docs/config/index.js +++ b/docs/config/index.js @@ -55,6 +55,7 @@ module.exports = new Package('angularjs', [ parseTagsProcessor.tagDefinitions.push(require('./tag-defs/tutorial-step')); parseTagsProcessor.tagDefinitions.push(require('./tag-defs/sortOrder')); parseTagsProcessor.tagDefinitions.push(require('./tag-defs/installation')); + parseTagsProcessor.tagDefinitions.push(require('./tag-defs/this')); }) diff --git a/docs/config/tag-defs/this.js b/docs/config/tag-defs/this.js new file mode 100644 index 000000000000..60ec4ed4f7f6 --- /dev/null +++ b/docs/config/tag-defs/this.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + name: 'this' +}; diff --git a/docs/gulpfile.js b/docs/gulpfile.js index 67cdd922c249..33cc296088c8 100644 --- a/docs/gulpfile.js +++ b/docs/gulpfile.js @@ -126,8 +126,12 @@ gulp.task('eslint', ['doc-gen'], function() { // compatible with non-browser window implementations like jsdom, it's not necessary // in examples and may look weird to casual readers. examplesConfig.envs = ['browser']; + // Dgeni-generated files use the system's default linebreak style (i.e. CRLF on Windows) + examplesConfig.rules['linebreak-style'] = 'off'; var protractorConfig = getMergedEslintConfig('../docs/app/e2e/.eslintrc.json'); + // Dgeni-generated files use the system's default linebreak style (i.e. CRLF on Windows) + protractorConfig.rules['linebreak-style'] = 'off'; protractorConfig.rules['no-unused-vars'] = ['error', { vars: 'local', args: 'none', diff --git a/src/apis.js b/src/apis.js index d9bd34f90de5..457eb9d1c9b4 100644 --- a/src/apis.js +++ b/src/apis.js @@ -74,7 +74,7 @@ HashMap.prototype = { } }; -var $$HashMapProvider = [/* @this */function() { +var $$HashMapProvider = [/** @this */function() { this.$get = [function() { return HashMap; }]; diff --git a/src/auto/injector.js b/src/auto/injector.js index 352561afa4d9..1b00ecc13705 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -710,7 +710,7 @@ function createInjector(modulesToLoad, strictDi) { } function enforceReturnValue(name, factory) { - return /* @this */ function enforcedReturnValue() { + return /** @this */ function enforcedReturnValue() { var result = instanceInjector.invoke(factory, this); if (isUndefined(result)) { throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name); diff --git a/src/jqLite.js b/src/jqLite.js index f3ae97e6be38..54d42b033d41 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -262,7 +262,7 @@ function jqLiteWrapNode(node, wrapper) { // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. -var jqLiteContains = window.Node.prototype.contains || /* @this */ function(arg) { +var jqLiteContains = window.Node.prototype.contains || /** @this */ function(arg) { // eslint-disable-next-line no-bitwise return !!(this.compareDocumentPosition(arg) & 16); }; @@ -1068,7 +1068,7 @@ forEach({ // Provider for private $$jqLite service -/* @this */ +/** @this */ function $$jqLiteProvider() { this.$get = function $$jqLite() { return extend(JQLite, { diff --git a/src/ng/animate.js b/src/ng/animate.js index 207933928c6d..06c706e7c12b 100644 --- a/src/ng/animate.js +++ b/src/ng/animate.js @@ -53,13 +53,13 @@ function prepareAnimateOptions(options) { : {}; } -var $$CoreAnimateJsProvider = /* @this */ function() { +var $$CoreAnimateJsProvider = /** @this */ function() { this.$get = noop; }; // this is prefixed with Core since it conflicts with // the animateQueueProvider defined in ngAnimate/animateQueue.js -var $$CoreAnimateQueueProvider = /* @this */ function() { +var $$CoreAnimateQueueProvider = /** @this */ function() { var postDigestQueue = new HashMap(); var postDigestElements = []; @@ -177,7 +177,7 @@ var $$CoreAnimateQueueProvider = /* @this */ function() { * * To see the functional implementation check out `src/ngAnimate/animate.js`. */ -var $AnimateProvider = ['$provide', /* @this */ function($provide) { +var $AnimateProvider = ['$provide', /** @this */ function($provide) { var provider = this; this.$$registeredAnimations = Object.create(null); diff --git a/src/ng/animateRunner.js b/src/ng/animateRunner.js index 5b0d6615cdec..70dcf72e8e37 100644 --- a/src/ng/animateRunner.js +++ b/src/ng/animateRunner.js @@ -1,6 +1,6 @@ 'use strict'; -var $$AnimateAsyncRunFactoryProvider = /* @this */ function() { +var $$AnimateAsyncRunFactoryProvider = /** @this */ function() { this.$get = ['$$rAF', function($$rAF) { var waitQueue = []; @@ -31,7 +31,7 @@ var $$AnimateAsyncRunFactoryProvider = /* @this */ function() { }]; }; -var $$AnimateRunnerFactoryProvider = /* @this */ function() { +var $$AnimateRunnerFactoryProvider = /** @this */ function() { this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout', function($q, $sniffer, $$animateAsyncRun, $$isDocumentHidden, $timeout) { diff --git a/src/ng/browser.js b/src/ng/browser.js index c5102fd28a8a..ebed151bbcd6 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -353,7 +353,7 @@ function Browser(window, document, $log, $sniffer) { } -/* @this */ +/** @this */ function $BrowserProvider() { this.$get = ['$window', '$log', '$sniffer', '$document', function($window, $log, $sniffer, $document) { diff --git a/src/ng/compile.js b/src/ng/compile.js index f5b0d450edea..5c0385679360 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -958,7 +958,7 @@ var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE(); * @description */ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; -/* @this */ +/** @this */ function $CompileProvider($provide, $$sanitizeUriProvider) { var hasDirectives = {}, Suffix = 'Directive', @@ -1217,7 +1217,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { function factory($injector) { function makeInjectable(fn) { if (isFunction(fn) || isArray(fn)) { - return /* @this */ function(tElement, tAttrs) { + return /** @this */ function(tElement, tAttrs) { return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs}); }; } else { @@ -2146,7 +2146,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { if (eager) { return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); } - return /* @this */ function lazyCompilation() { + return /** @this */ function lazyCompilation() { if (!compiled) { compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); diff --git a/src/ng/cookieReader.js b/src/ng/cookieReader.js index 85bc165d1f6c..c1c4447a0146 100644 --- a/src/ng/cookieReader.js +++ b/src/ng/cookieReader.js @@ -51,7 +51,7 @@ function $$CookieReader($document) { $$CookieReader.$inject = ['$document']; -/* @this */ +/** @this */ function $$CookieReaderProvider() { this.$get = $$CookieReader; } diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 1658dc5580e6..ffc178e46dac 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1271,7 +1271,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { } }; - element.on('keydown', /* @this */ function(event) { + element.on('keydown', /** @this */ function(event) { var key = event.keyCode; // ignore @@ -1296,7 +1296,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { // For these event types, when native validators are present and the browser supports the type, // check for validity changes on various DOM events. if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) { - element.on(PARTIAL_VALIDATION_EVENTS, /* @this */ function(ev) { + element.on(PARTIAL_VALIDATION_EVENTS, /** @this */ function(ev) { if (!timeout) { var validity = this[VALIDITY_STATE_PROPERTY]; var origBadInput = validity.badInput; diff --git a/src/ng/directive/ngModel.js b/src/ng/directive/ngModel.js index d559d45cd05c..9dc344519de4 100644 --- a/src/ng/directive/ngModel.js +++ b/src/ng/directive/ngModel.js @@ -221,7 +221,7 @@ is set to `true`. The parse error is stored in `ngModel.$error.parse`. * */ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate', - /* @this */ function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) { + /** @this */ function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) { this.$viewValue = Number.NaN; this.$modelValue = Number.NaN; this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity. diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index dc0621de60b0..cae1184e2b0b 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -13,7 +13,7 @@ var noopNgModelController = { $setViewValue: noop, $render: noop }; * added `