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

chore(*): enable jshint eqeqeq #14287

Closed
Narretz opened this issue Mar 21, 2016 · 3 comments
Closed

chore(*): enable jshint eqeqeq #14287

Narretz opened this issue Mar 21, 2016 · 3 comments
Assignees
Milestone

Comments

@Narretz
Copy link
Contributor

Narretz commented Mar 21, 2016

Add jshint eqeqeq and eqnull rules, and fix all resulting errors.

@Narretz Narretz self-assigned this Mar 21, 2016
@Narretz Narretz added this to the 1.5.x milestone Mar 21, 2016
@Narretz
Copy link
Contributor Author

Narretz commented Mar 21, 2016

@lgalfaso So, in parse there's actually a comparison that seems to be == / != on purpose:

angular.js/src/ng/parse.js

Lines 1532 to 1543 in aa077e8

'binary==': function(left, right, context) {
return function(scope, locals, assign, inputs) {
var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
return context ? {value: arg} : arg;
};
},
'binary!=': function(left, right, context) {
return function(scope, locals, assign, inputs) {
var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
return context ? {value: arg} : arg;
};
},
Changing == to === for binary== makes this expectation fail:
expect(scope.$eval("1==true")).toBeTruthy();
, changing != to !== for binary!= does not. Can you take a look at this?

@gkalpak
Copy link
Member

gkalpak commented Mar 21, 2016

Seems like we are missing a test, e.g. expect(scope.$eval('1!="1"')).toBeFalsy().
Obviously we need to retain the ==/!= for binary== and binary!=.

@Narretz
Copy link
Contributor Author

Narretz commented Mar 21, 2016

That's right, thanks @gkalpak

Narretz added a commit to Narretz/angular.js that referenced this issue Mar 24, 2016
Add jshint "eqeqeq" and "eqnull" rules (to allow == null comparisons).
Only adds it to files under src/, because we these files are unit-tested.
Files in src/ngLocale are excluded, because the code is imported.

Closes angular#14287
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 25, 2016
Add jshint "eqeqeq" and "eqnull" rules (to allow == null comparisons).
Only adds it to files under src/, because we these files are unit-tested.
Files in src/ngLocale are excluded, because the code is imported.

Closes angular#14287
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 25, 2016
Add jshint "eqeqeq" and "eqnull" rules (to allow == null comparisons).
Only adds it to files under src/, because we these files are unit-tested.
Files in src/ngLocale are excluded, because the code is imported.

Closes angular#14287
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants