Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(*): silence ng-closure-runner warnings during grunt minall #15439

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Nov 26, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Chore/Refactor.

What is the current behavior? (You can also link to an open issue here)
During the grunt minall task, ng-closure-runner logs some warnings due to:

  1. Throwing errors that do not seem to be minErr instances.
  2. A @this annotation in a non-JSDoc comment.

What is the new behavior (if this is a feature change)?
No warnings during grunt minall.

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

* @param {*} error - The error object that will be returned.
* @returns {*} - The passed in error.
*/
function noMinErr(ignoredCode, ignoredTemplate, err) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not thrilled about having to pass the first two string arguments.
Alternatively, we could teach ng-closure-runner to ignore noMinErr instances (i.e. not treat them as minErr instances, but don't log a warning either).

@gkalpak gkalpak force-pushed the chore-minall-silence-warnings branch from d28ec11 to b425246 Compare February 20, 2018 13:31
@gkalpak
Copy link
Member Author

gkalpak commented Feb 20, 2018

For reference:

Before

Running "minall" task
...
build/angular.js:5038: WARNING - Throw expression is not a minErr instance.
          throw err;
          ^
build/angular.js:8763: WARNING - Throw expression is not a minErr instance.
            throw errors;
            ^
build/angular.js:12860: WARNING - Throw expression is not a minErr instance.
            throw e;
            ^
build/angular.js:14531: WARNING - Throw expression is not a minErr instance.
        throw e;
        ^
build/angular.js:18772: WARNING - Throw expression is not a minErr instance.
            throw e;
            ^
build/angular.js:30307: WARNING - Parse error. Non-JSDoc comment has annotations. Did you mean to start it with '/**'?
    forEach(options, /* @this */ function(option, key) {
                     ^
0 error(s), 6 warning(s)
>> build/angular.js minified into build/angular.min.js
...

After

Running "minall" task
...
>> build/angular.js minified into build/angular.min.js
...

@petebacondarwin
Copy link
Contributor

Did you check whether this ends up creating no error pages in the docs?

@gkalpak
Copy link
Member Author

gkalpak commented Feb 20, 2018

No 😕

@gkalpak
Copy link
Member Author

gkalpak commented Feb 20, 2018

AFAICT, it does not. It does create a no: {'': ''} entry in build/errors.json, but as long as there is no corresponding error doc, no entry is created in nav-data.json.

@petebacondarwin
Copy link
Contributor

That is true but you now get this in the build:

warn:    No error doc exists for min error: no:

@gkalpak
Copy link
Member Author

gkalpak commented Feb 21, 2018

Irony 😒
This is still better than what we get today (and I am sure we can silence that warning 😈).
The main question is: Do we like this approach?

@petebacondarwin
Copy link
Contributor

petebacondarwin commented Feb 21, 2018

Given that we are then creating workarounds for workarounds, I start to feel that it would be better to fix the ng-closure-runner tool instead. It could simply be a comment flag (or other device) to tell minerr to ignore that error throw.

@gkalpak gkalpak modified the milestones: Backlog, 1.7.x May 9, 2018
@gkalpak gkalpak self-assigned this May 9, 2018
@petebacondarwin petebacondarwin self-assigned this May 14, 2018
@gkalpak
Copy link
Member Author

gkalpak commented May 23, 2018

As discussed, it doesn't make sense to fix it in ng-closure-runner at this point.
I moved the jsdoc comment fix to #16575.

@gkalpak gkalpak closed this May 23, 2018
@gkalpak gkalpak deleted the chore-minall-silence-warnings branch May 23, 2018 19:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants