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

chore(*): switch from JSHint/JSCS to ESLint (+ other build-related changes) #14952

Closed
wants to merge 8 commits into from

Conversation

mgol
Copy link
Member

@mgol mgol commented Jul 26, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
A build-related refactor.

What is the current behavior? (You can also link to an open issue here)
Code is linted via JSHint+JSCS.

What is the new behavior (if this is a feature change)?
Code is linted via ESLint.

Does this PR introduce a breaking change?
No

Please check if the PR fulfills these requirements

Other information:
This is not ready (there are still many ESLint violations) but since the changes are rather large, I'd like to get some feedback now.

There are a couple of build-related commits; submitting them as separate PRs would be difficult as they modify package.json and shrinkwrap file. It makes sense to land them separately and all but the last commit are small so it shouldn't case lots of problems in reviewing.

"accessor-pairs": "error",
"array-callback-return": "error",
"complexity": ["warn", 10],
// "dot-notation": "error", // TODO enable?
Copy link
Member

Choose a reason for hiding this comment

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

I think there are places where we deliberately use bracket-notation. If there are many such places (that need a "manual" override), I would leave this disabled.

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 was thinking about moving all those TODO rules to a separate
.eslintrc-todo.json file, then discuss all the options, remove the one we
don't want to enable and the rest will stay there, waiting for someone to
fix the code and enable the rule.

Thoughts?

On Tue, Jul 26, 2016 at 1:32 PM, Georgios Kalpakas <[email protected]

wrote:

In .eslintrc.json
#14952 (comment):

  • "no-irregular-whitespace": "error",
  • "no-negated-in-lhs": "error",
  • "no-obj-calls": "error",
  • "no-regex-spaces": "error",
  • "no-sparse-arrays": "error",
  • "no-unreachable": "error",
  • "use-isnan": "error",
  • "no-unsafe-finally": "error",
  • "valid-typeof": "error",
  • "no-unexpected-multiline": "error",
  • // Best practices
  • "accessor-pairs": "error",
  • "array-callback-return": "error",
  • "complexity": ["warn", 10],
    +// "dot-notation": "error", // TODO enable?

I think there are places where we deliberately use bracket-notation. If
there are many such places (that need a "manual" override), I would leave
this disabled.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular.js/pull/14952/files/6f56b890138f16a67b5f61cb2238d75378a76497..22f65cbbbf36f1ae396038f457ca2266f5b52767#r72231300,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABrUnvg_rt1IyxEc7jYUKkY9aFjn3a20ks5qZfBkgaJpZM4JU90D
.

Michał Gołębiowski

Copy link
Member

Choose a reason for hiding this comment

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

SGTM

it('should not sanitize attributes other than src', inject(function($compile, $rootScope) {
/* jshint scripturl:true */
element = $compile('<img title="{{testUrl}}"></img>')($rootScope);
it('should not sanitize attributes other than src', inject(function($compile, $rootScope) { element = $compile('<img title="{{testUrl}}"></img>')($rootScope);
Copy link
Member

@gkalpak gkalpak Jul 26, 2016

Choose a reason for hiding this comment

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

Missing newline. (Below too.)

@gkalpak
Copy link
Member

gkalpak commented Jul 26, 2016

So far, this LGTM 👍

Except where otherwise noted, I like (eventually) enabling the rules marked as TODO enable?, but I think it is better to leave them disabled at first and discuss/enable them in follow-up PRs.

@gkalpak gkalpak added this to the 1.5.x milestone Jul 27, 2016
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@gkalpak
Copy link
Member

gkalpak commented Aug 5, 2016

Still LGTM2 😄

mgol added 8 commits August 5, 2016 19:37
… packages

The Travis build.sh script has to be updated as the previous way of
specifying parameters to the code run in Grunt tasks stopped working
with the newest Grunt.
The previous version depended on a vulnerable request version.

Ref angulargh-14961
This avoids warnings with newer versions of Bower.
If one uses nvm to manage Node.js versions, the .nvmrc file makes `nvm use`
switch to the version specified in .nvmrc. There are scripts that invoke
it automatically when cd'ing to directories containing .nvmrc so that you
never run build commands using a wrong Node version, see:
https://github.com/creationix/nvm/blob/v0.31.2/README.markdown#zsh
The engineStrict field is deprecated in npm 2 and removed in npm 3.
The "licenses" field is deprecated in favor of the "license" field... which
we already have specified.
Thanks to @Narretz for help in fixing style violations and to @gkalpak
for a very extensive review.
@mgol mgol closed this in c322032 Aug 5, 2016
@mgol mgol deleted the eslint-etc branch August 5, 2016 20:19
mgol added a commit to mgol/angular.js that referenced this pull request Aug 5, 2016
@mgol
Copy link
Member Author

mgol commented Aug 5, 2016

All commits except the ESLint one backported to v1.5.x. The last one is handled in PR #14993; please review.

mgol added a commit to mgol/angular.js that referenced this pull request Aug 5, 2016
mgol added a commit to mgol/angular.js that referenced this pull request Aug 5, 2016
mgol added a commit to mgol/angular.js that referenced this pull request Aug 5, 2016
gkalpak added a commit to gkalpak/angular.js that referenced this pull request Aug 6, 2016
Related to angular#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/`.
gkalpak pushed a commit that referenced this pull request Aug 8, 2016
Partially cherry-picked from c322032

Ref #14952

Closes #14993
mgol added a commit to mgol/angular.js that referenced this pull request Aug 8, 2016
This is a followup to the migration to ESLint.

Ref angular#14952
mgol added a commit to mgol/angular.js that referenced this pull request Aug 8, 2016
This is a followup to the migration to ESLint.

Ref angular#14952
@mgol mgol mentioned this pull request Aug 8, 2016
3 tasks
gkalpak pushed a commit that referenced this pull request Aug 8, 2016
This is a followup to the migration to ESLint.

Ref #14952

Closes #15006
gkalpak pushed a commit that referenced this pull request Aug 8, 2016
This is a followup to the migration to ESLint.

Ref #14952

Closes #15006
gkalpak added a commit that referenced this pull request Aug 8, 2016
Related to #14952. Fixed the following warnings/errors:

1. **Warning**: Closure Compiler complained about `/* @this */` (annotations in non-JSDoc comments).
   Fixed by changing `/* @this */` to `/** @this */`.

2. **Warning**: Dgeni complained 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 (e.g. CRLF on Windows).
   Fixed by disabling the `linebreak-style` rule for `build/docs/examples/`.

Closes #14997
gkalpak added a commit that referenced this pull request Aug 8, 2016
Related to #14952. Fixed the following warnings/errors:

1. **Warning**: Closure Compiler complained about `/* @this */` (annotations in non-JSDoc comments).
   Fixed by changing `/* @this */` to `/** @this */`.

2. **Warning**: Dgeni complained 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 (e.g. CRLF on Windows).
   Fixed by disabling the `linebreak-style` rule for `build/docs/examples/`.

Closes #14997
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.

6 participants