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

Commit 735f136

Browse files
committed
[WIP] lint benchmarks
1 parent 056cb26 commit 735f136

File tree

15 files changed

+42
-18
lines changed

15 files changed

+42
-18
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ src/angular.bind.js
99
src/ngParseExt/ucd.js
1010
i18n/closure/**
1111
tmp/**
12-
13-
# TODO start linting those files?
14-
benchmarks/**

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ module.exports = function(grunt) {
119119
all: {
120120
src: [
121121
'*.js',
122+
'benchmarks/**/*.js',
122123
'docs/**/*.js',
123124
'lib/**/*.js',
124125
'scripts/**/*.js',

benchmarks/.eslintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"globals": {
3+
"window": false,
4+
5+
"angular": false,
6+
"benchmarkSteps": false
7+
}
8+
}

benchmarks/event-delegation-bp/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
var app = angular.module('eventDelegationBenchmark', []);
24

35
app.directive('noopDir', function() {
@@ -13,7 +15,7 @@ app.directive('noopDir', function() {
1315
app.directive('nativeClick', ['$parse', function($parse) {
1416
return {
1517
compile: function($element, $attrs) {
16-
var expr = $parse($attrs.tstEvent);
18+
$parse($attrs.tstEvent);
1719
return function($scope, $element) {
1820
$element[0].addEventListener('click', function() {
1921
console.log('clicked');
@@ -26,13 +28,12 @@ app.directive('nativeClick', ['$parse', function($parse) {
2628
app.directive('dlgtClick', function() {
2729
return {
2830
compile: function($element, $attrs) {
29-
var evt = $attrs.dlgtClick;
3031
// We don't setup the global event listeners as the costs are small and one time only...
3132
}
3233
};
3334
});
3435

35-
app.controller('DataController', function($rootScope) {
36+
app.controller('DataController', function DataController($rootScope) {
3637
this.ngRepeatCount = 1000;
3738
this.rows = [];
3839
var self = this;

benchmarks/event-delegation-bp/bp.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [{
46
id: 'angular',
57
src: '/build/angular.js'
6-
},{
8+
}, {
79
src: 'app.js'
810
}]
911
});

benchmarks/largetable-bp/app.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
var app = angular.module('largetableBenchmark', []);
24

35
app.config(function($compileProvider) {
@@ -12,7 +14,7 @@ app.filter('noop', function() {
1214
};
1315
});
1416

15-
app.controller('DataController', function($scope, $rootScope) {
17+
app.controller('DataController', function DataController($scope, $rootScope) {
1618
var totalRows = 1000;
1719
var totalColumns = 20;
1820

@@ -21,7 +23,9 @@ app.controller('DataController', function($scope, $rootScope) {
2123
$scope.numberOfBindings = totalRows * totalColumns * 2 + totalRows + 1;
2224
$scope.numberOfWatches = '?';
2325

26+
/* @this DataController */
2427
function iGetter() { return this.i; }
28+
/* @this DataController */
2529
function jGetter() { return this.j; }
2630

2731
for (var i = 0; i < totalRows; i++) {
@@ -64,14 +68,13 @@ app.controller('DataController', function($scope, $rootScope) {
6468
});
6569
});
6670

67-
var fn = function() { return 'x';};
68-
6971

7072
app.directive('baselineBindingTable', function() {
7173
return {
7274
restrict: 'E',
7375
link: function($scope, $element) {
7476
var i, j, row, cell, comment;
77+
var document = window.document;
7578
var template = document.createElement('span');
7679
template.setAttribute('ng-repeat', 'foo in foos');
7780
template.classList.add('ng-scope');
@@ -106,6 +109,7 @@ app.directive('baselineInterpolationTable', function() {
106109
restrict: 'E',
107110
link: function($scope, $element) {
108111
var i, j, row, cell, comment;
112+
var document = window.document;
109113
var template = document.createElement('span');
110114
template.setAttribute('ng-repeat', 'foo in foos');
111115
template.classList.add('ng-scope');

benchmarks/largetable-bp/bp.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [{

benchmarks/ng-options-bp/bp.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [{

benchmarks/orderby-bp/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
'use strict';
2+
13
var app = angular.module('orderByBenchmark', []);
24

3-
app.controller('DataController', function($rootScope, $scope) {
5+
app.controller('DataController', function DataController($rootScope, $scope) {
46
this.ngRepeatCount = 5000;
57
this.rows = [];
68
var self = this;

benchmarks/orderby-bp/bp.conf.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [
46
{
57
"id": "jquery",
68
"src": "jquery-noop.js"
7-
},{
9+
}, {
810
id: 'angular',
911
src: '/build/angular.js'
10-
},{
12+
}, {
1113
src: 'app.js'
1214
}]
1315
});

benchmarks/parsed-expressions-bp/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
var app = angular.module('parsedExpressionBenchmark', []);
24

35
app.config(function($compileProvider) {

benchmarks/parsed-expressions-bp/bp.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [{

benchmarks/select-ng-value-bp/bp.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = function(config) {
24
config.set({
35
scripts: [{

src/ngMock/.eslintrc.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"rules": {
3-
"eqeqeq": "off" // TODO enable?
4-
},
52
"globals": {
63
"window": false,
74

src/ngMock/angular-mocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ function MockHttpExpectation(method, url, data, headers, keys) {
19201920
this.headers = headers;
19211921

19221922
this.match = function(m, u, d, h) {
1923-
if (method != m) return false;
1923+
if (method !== m) return false;
19241924
if (!this.matchUrl(u)) return false;
19251925
if (angular.isDefined(d) && !this.matchData(d)) return false;
19261926
if (angular.isDefined(h) && !this.matchHeaders(h)) return false;
@@ -2895,7 +2895,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
28952895
};
28962896

28972897
module.$$beforeEach = function() {
2898-
if (injectorState.shared && currentSpec && currentSpec != this) {
2898+
if (injectorState.shared && currentSpec && currentSpec !== this) {
28992899
var state = currentSpec;
29002900
currentSpec = this;
29012901
angular.forEach(["$injector","$modules","$providerInjector", "$injectorStrict"], function(k) {

0 commit comments

Comments
 (0)