Skip to content

Commit 724eb76

Browse files
author
Anatoly Ostrovsky
committed
Fix lint
1 parent 6271a7b commit 724eb76

File tree

7 files changed

+46
-55
lines changed

7 files changed

+46
-55
lines changed

@types/shared/hof.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,5 @@ export function pattern(struct: any): (arg0: any) => any;
104104
*/
105105
export const propEq: any;
106106
export function parse(name: any): any;
107-
export function all(fn1: any): (arr: any) => any;
108107
export function is(ctor: any): (obj: any) => boolean;
109108
export function val(v: any): () => any;

src/core/parse/parse.spec.js

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,37 +1787,36 @@ describe("parser", () => {
17871787
});
17881788

17891789
[0, false, "", NaN].forEach((falsyValue) => {
1790-
"should not overwrite $prop scope properties when assigning",
1791-
() => {
1792-
let scope;
1793-
1794-
scope = { a: falsyValue, c: falsyValue };
1795-
tryParseAndIgnoreException("a.b = 1");
1796-
tryParseAndIgnoreException('c["d"] = 2');
1797-
expect(scope).toEqual({ a: falsyValue, c: falsyValue });
1798-
1799-
scope = { a: { b: falsyValue, c: falsyValue } };
1800-
tryParseAndIgnoreException("a.b.c = 1");
1801-
tryParseAndIgnoreException('a.c["d"] = 2');
1802-
expect(scope).toEqual({ a: { b: falsyValue, c: falsyValue } });
1803-
1804-
// Helpers
1805-
//
1806-
// Normally assigning property on a primitive should throw exception in strict mode
1807-
// and silently fail in non-strict mode, IE seems to always have the non-strict-mode behavior,
1808-
// so if we try to use 'expect(() => {$parse('a.b=1')({a:false});).toThrow()' for testing
1809-
// the test will fail in case of IE because it will not throw exception, and if we just use
1810-
// '$parse('a.b=1')({a:false})' the test will fail because it will throw exception in case of Chrome
1811-
// so we use tryParseAndIgnoreException helper to catch the exception silently for all cases.
1812-
//
1813-
function tryParseAndIgnoreException(expression) {
1814-
try {
1815-
$parse(expression)(scope);
1816-
} catch (error) {
1817-
/* ignore exception */
1818-
}
1790+
it("should not overwrite $prop scope properties when assigning", () => {
1791+
let scope;
1792+
1793+
scope = { a: falsyValue, c: falsyValue };
1794+
tryParseAndIgnoreException("a.b = 1");
1795+
tryParseAndIgnoreException('c["d"] = 2');
1796+
expect(scope).toEqual({ a: falsyValue, c: falsyValue });
1797+
1798+
scope = { a: { b: falsyValue, c: falsyValue } };
1799+
tryParseAndIgnoreException("a.b.c = 1");
1800+
tryParseAndIgnoreException('a.c["d"] = 2');
1801+
expect(scope).toEqual({ a: { b: falsyValue, c: falsyValue } });
1802+
1803+
// Helpers
1804+
//
1805+
// Normally assigning property on a primitive should throw exception in strict mode
1806+
// and silently fail in non-strict mode, IE seems to always have the non-strict-mode behavior,
1807+
// so if we try to use 'expect(() => {$parse('a.b=1')({a:false});).toThrow()' for testing
1808+
// the test will fail in case of IE because it will not throw exception, and if we just use
1809+
// '$parse('a.b=1')({a:false})' the test will fail because it will throw exception in case of Chrome
1810+
// so we use tryParseAndIgnoreException helper to catch the exception silently for all cases.
1811+
//
1812+
function tryParseAndIgnoreException(expression) {
1813+
try {
1814+
$parse(expression)(scope);
1815+
} catch (error) {
1816+
/* ignore exception */
18191817
}
1820-
};
1818+
}
1819+
});
18211820
});
18221821
});
18231822

src/directive/events/event.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ describe("event directives", () => {
6060
});
6161

6262
it("should expose event on form submit", () => {
63-
(app.innerHTML =
63+
app.innerHTML =
6464
'<form ng-submit="formSubmission($event)">' +
6565
'<input type="submit" />' +
66-
"</form>"),
67-
window.angular.bootstrap(app, ["myModule"]).invoke((_$rootScope_) => {
68-
$rootScope = _$rootScope_;
69-
});
66+
"</form>";
67+
window.angular.bootstrap(app, ["myModule"]).invoke((_$rootScope_) => {
68+
$rootScope = _$rootScope_;
69+
});
7070
element = app.querySelector("form");
7171
$rootScope.formSubmission = function (e) {
7272
if (e) {

src/directive/repeat/repeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function ngRepeatDirective($animate) {
8585
transclude: "element",
8686
priority: 1000,
8787
terminal: true,
88-
compile: ($element, $attr) => {
88+
compile: (_$element, $attr) => {
8989
const expression = $attr["ngRepeat"];
9090
const hasAnimate = !!$attr["animate"];
9191

src/router/template-factory.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ describe("templateFactory", () => {
7878
]);
7979
$injector.invoke(
8080
(_$templateFactory_, _$httpBackend_, _$sce_, $rootScope) => {
81-
($templateFactory = _$templateFactory_),
82-
($httpBackend = _$httpBackend_),
83-
($sce = _$sce_);
81+
$templateFactory = _$templateFactory_;
82+
$httpBackend = _$httpBackend_;
83+
$sce = _$sce_;
8484
$scope = $rootScope;
8585
},
8686
);
@@ -119,9 +119,9 @@ describe("templateFactory", () => {
119119
_$state_,
120120
_$compile_,
121121
) => {
122-
($templateFactory = _$templateFactory_),
123-
($httpBackend = _$httpBackend_),
124-
($sce = _$sce_);
122+
$templateFactory = _$templateFactory_;
123+
$httpBackend = _$httpBackend_;
124+
$sce = _$sce_;
125125
$scope = $rootScope;
126126
$stateRegistry = _$stateRegistry_;
127127
$stateService = _$state_;

src/shared/common.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isDate, isFunction, isRegExp, isString } from "./utils.js";
2-
import { all, curry } from "./hof.js";
2+
import { curry } from "./hof.js";
33

44
export function equals(o1, o2) {
55
if (o1 === o2) return true;
@@ -9,10 +9,10 @@ export function equals(o1, o2) {
99
t2 = typeof o2;
1010
if (t1 !== t2 || t1 !== "object") return false;
1111
const tup = [o1, o2];
12-
if (all(Array.isArray)(tup)) return _arraysEq(o1, o2);
13-
if (all(isDate)(tup)) return o1.getTime() === o2.getTime();
14-
if (all(isRegExp)(tup)) return o1.toString() === o2.toString();
15-
if (all(isFunction)(tup)) return true; // meh
12+
if (tup.every(Array.isArray)) return _arraysEq(o1, o2);
13+
if (tup.every(isDate)) return o1.getTime() === o2.getTime();
14+
if (tup.every(isRegExp)) return o1.toString() === o2.toString();
15+
if (tup.every(isFunction)) return true; // meh
1616
if ([isFunction, Array.isArray, isDate, isRegExp].some((fn) => !!fn(tup))) {
1717
return false;
1818
}

src/shared/hof.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ export const parse = (name) =>
9696
name.split(".").map((name) => (obj) => obj && obj[name]),
9797
);
9898

99-
/**
100-
* Check if all the elements of an array match a predicate function
101-
*
102-
* @param fn1 a predicate function `fn1`
103-
* @returns a function which takes an array and returns true if `fn1` is true for all elements of the array
104-
*/
105-
export const all = (fn1) => (arr) => arr.reduce((b, x) => b && !!fn1(x), true);
10699
/** Given a class, returns a Predicate function that returns true if the object is of that class */
107100
export const is = (ctor) => (obj) =>
108101
(obj != null && obj.constructor === ctor) || obj instanceof ctor;

0 commit comments

Comments
 (0)