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

Commit e2303e5

Browse files
committed
[WIP] More changes
1 parent 9ba7ea8 commit e2303e5

File tree

132 files changed

+523
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+523
-308
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ bower_components/**
22
build/**
33
docs/bower_components/**
44
docs/app/assets/**
5+
docs/config/templates/**
56
node_modules/**
67
lib/htmlparser/**
8+
src/angular.bind.js
79
src/ngParseExt/ucd.js
810
i18n/closure/**
911
tmp/**

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// Best practices
4242
"accessor-pairs": "error",
4343
"array-callback-return": "error",
44-
"complexity": ["warn", 10],
44+
// "complexity": ["error", 10], // TODO enable?
4545
// "dot-notation": "error", // TODO enable?
4646
// "dot-location": ["error", "property"], // TODO enable?
4747
"eqeqeq": ["error", "allow-null"],

Gruntfile.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,18 @@ module.exports = function(grunt) {
119119
all: {
120120
src: [
121121
'*.js',
122+
'docs/**/*.js',
123+
'lib/**/*.js',
124+
'scripts/**/*.js',
122125
'src/**/*.js',
123126
'test/**/*.js',
124-
'i18n/**/*.js'
127+
'i18n/**/*.js',
128+
'!docs/app/assets/**',
129+
'!docs/bower_components/**',
130+
'!docs/config/templates/**',
131+
'!src/angular.bind.js',
132+
'!i18n/closure/**',
133+
'!src/ngParseExt/ucd.js'
125134
]
126135
}
127136
},

docs/app/src/.eslintrc.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// ngMocks
1212
"module": false,
13-
"inject": true
13+
"inject": true,
14+
15+
"lunr": false
1416
}
1517
}

docs/app/src/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ angular.module('DocsController', [])
2929

3030
path = path.replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
3131

32-
currentPage = $scope.currentPage = NG_PAGES[path];
32+
var currentPage = $scope.currentPage = NG_PAGES[path];
3333

3434
if (currentPage) {
3535
$scope.partialPath = 'partials/' + path + '.html';

docs/app/src/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
angular.module('errors', ['ngSanitize'])
44

55
.filter('errorLink', ['$sanitize', function($sanitize) {
6-
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}<>]/g,
6+
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.;,\(\)\{\}<>]/g,
77
MAILTO_REGEXP = /^mailto:/,
88
STACK_TRACE_REGEXP = /:\d+:\d+$/;
99

docs/app/src/examples.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ angular.module('examples', [])
44

55
.directive('runnableExample', ['$templateCache', '$document', function($templateCache, $document) {
66
var exampleClassNameSelector = '.runnable-example-file';
7-
var doc = $document[0];
87
var tpl =
98
'<nav class="runnable-example-tabs" ng-if="tabs">' +
109
' <a ng-class="{active:$index==activeTabIndex}"' +
@@ -31,7 +30,7 @@ angular.module('examples', [])
3130
return function(scope, element) {
3231
var node = element[0];
3332
var examples = node.querySelectorAll(exampleClassNameSelector);
34-
var tabs = [], now = Date.now();
33+
var tabs = [];
3534
angular.forEach(examples, function(child, index) {
3635
tabs.push(child.getAttribute('name'));
3736
});
@@ -103,7 +102,7 @@ angular.module('examples', [])
103102
},
104103
controllerAs: 'plnkr',
105104
template: '<button ng-click="plnkr.open($event)" class="btn pull-right"> <i class="glyphicon glyphicon-edit">&nbsp;</i> Edit in Plunker</button> ',
106-
controller: [function() {
105+
controller: [function Ctrl() {
107106
var ctrl = this;
108107

109108
ctrl.example = {

docs/app/src/search.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ angular.module('search', [])
4343
$scope.hasResults = totalAreas > 0;
4444
$scope.results = results;
4545
});
46-
}
47-
else {
46+
} else {
4847
clearResults();
4948
}
5049
if (!$scope.$$phase) $scope.$apply();
@@ -98,7 +97,7 @@ angular.module('search', [])
9897
console.log('Using Local Search Index');
9998

10099
// Create the lunr index
101-
var index = lunr(function() {
100+
var index = lunr(/* @this */ function() {
102101
this.ref('path');
103102
this.field('titleWords', {boost: 50});
104103
this.field('members', { boost: 40});

docs/app/test/.eslintrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
"jasmine": true
66
},
77

8+
"rules": {
9+
// Some rules are not that important in tests and conflict with
10+
// Jasmine or would make it easier to write some tests; we disable
11+
// those ones here.
12+
"no-invalid-this": "off",
13+
"no-throw-literal": "off",
14+
"no-unused-vars": "off"
15+
},
16+
817
"globals": {
918
// AngularJS
1019
"angular": false,

docs/app/test/directivesSpec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
describe("code", function() {
24
var prettyPrintOne, oldPP;
35
var compile, scope;

docs/app/test/docsSpec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
describe("DocsController", function() {
24
var $scope;
35

docs/config/inline-tag-defs/type.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"use strict";
1+
'use strict';
22

3+
// eslint-disable-next-line new-cap
34
var encoder = new require('node-html-encoder').Encoder();
45

56
/**

docs/config/processors/error-docs.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
"use strict";
2-
3-
var _ = require('lodash');
4-
var path = require('canonical-path');
1+
'use strict';
52

63
/**
74
* @dgProcessor errorDocsProcessor

docs/config/processors/index-page.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22

33
var _ = require('lodash');
4-
var path = require('canonical-path');
54

65
/**
76
* @dgProcessor generateIndexPagesProcessor

docs/config/processors/pages-data.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
var _ = require('lodash');
44
var path = require('canonical-path');
@@ -158,7 +158,7 @@ module.exports = function generatePagesDataProcessor(log) {
158158

159159
// We are only interested in pages that are not landing pages
160160
var navPages = _.filter(pages, function(page) {
161-
return page.docType != 'componentGroup';
161+
return page.docType !== 'componentGroup';
162162
});
163163

164164
// Generate an object collection of pages that is grouped by area e.g.

docs/config/tag-defs/installation.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
name: 'installation'
35
};

docs/config/tag-defs/sortOrder.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
name: 'sortOrder',
35
transforms: function(doc, tag, value) {

docs/config/tag-defs/tutorial-step.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
name: 'step',
35
transforms: function(doc, tag, value) {

lib/grunt/plugins.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
'use strict';
22

3+
/* eslint-disable no-invalid-this */
4+
35
var bower = require('bower');
46
var util = require('./utils.js');
57
var shelljs = require('shelljs');
68

79
module.exports = function(grunt) {
810

911
grunt.registerMultiTask('min', 'minify JS files', function() {
10-
util.min.call(util, this.data, this.async());
12+
util.min(this.data, this.async());
1113
});
1214

1315

@@ -19,7 +21,7 @@ module.exports = function(grunt) {
1921

2022

2123
grunt.registerMultiTask('build', 'build JS files', function() {
22-
util.build.call(util, this.data, this.async());
24+
util.build(this.data, this.async());
2325
});
2426

2527

@@ -45,20 +47,20 @@ module.exports = function(grunt) {
4547

4648

4749
grunt.registerMultiTask('tests', '**Use `grunt test` instead**', function() {
48-
util.startKarma.call(util, this.data, true, this.async());
50+
util.startKarma(this.data, true, this.async());
4951
});
5052

5153

5254
grunt.registerMultiTask('autotest', 'Run and watch the unit tests with Karma', function() {
53-
util.startKarma.call(util, this.data, false, this.async());
55+
util.startKarma(this.data, false, this.async());
5456
});
5557

5658
grunt.registerTask('webdriver', 'Update webdriver', function() {
57-
util.updateWebdriver.call(util, this.async());
59+
util.updateWebdriver(this.async());
5860
});
5961

6062
grunt.registerMultiTask('protractor', 'Run Protractor integration tests', function() {
61-
util.startProtractor.call(util, this.data, this.async());
63+
util.startProtractor(this.data, this.async());
6264
});
6365

6466
grunt.registerTask('collect-errors', 'Combine stripped error files', function() {

lib/grunt/utils.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
'use strict';
22

33
var fs = require('fs');
4-
var path = require('path');
54
var shell = require('shelljs');
65
var grunt = require('grunt');
76
var spawn = require('child_process').spawn;
8-
var semver = require('semver');
9-
10-
var _ = require('lodash');
117

128
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
139

@@ -108,8 +104,8 @@ module.exports = {
108104
.replace(/:\s+/g, ':')
109105
.replace(/\s*\{\s*/g, '{')
110106
.replace(/\s*\}\s*/g, '}')
111-
.replace(/\s*\,\s*/g, ',')
112-
.replace(/\s*\;\s*/g, ';');
107+
.replace(/\s*,\s*/g, ',')
108+
.replace(/\s*;\s*/g, ';');
113109
}
114110
//escape for js
115111
css = css

lib/grunt/validate-angular-files.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function(grunt) {
2020
for (var section in combinedFiles) {
2121
var sectionFiles = combinedFiles[section];
2222

23-
if (section != 'angularLoader') {
23+
if (section !== 'angularLoader') {
2424
directories.push('src/' + section);
2525
}
2626

@@ -40,7 +40,7 @@ module.exports = function(grunt) {
4040
glob.sync(directory + '/**/*').forEach(function(filePath) {
4141
if (!fs.lstatSync(filePath).isDirectory()) {
4242
var fileName = path.basename(filePath);
43-
var isHiddenFile = fileName[0] == '.';
43+
var isHiddenFile = fileName[0] === '.';
4444
if (!isHiddenFile && !detectedFiles[filePath]) {
4545
grunt.log.error(filePath + ' exists in the local file structure but isn\'t used by any module.');
4646
errorsDetected = true;

lib/promises-aplus/promises-aplus-test-adapter.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
minErr,
1010
extend
1111
*/
12+
/* eslint-disable no-unused-vars */
1213

1314
var isFunction = function isFunction(value) {return typeof value === 'function';};
1415
var isPromiseLike = function isPromiseLike(obj) {return obj && isFunction(obj.then);};

lib/versions/version-info.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var process = require('process');
1111
var NO_REMOTE_REQUESTS = !!process.env['NG1_BUILD_NO_REMOTE_VERSION_REQUESTS'];
1212
var versionSource = NO_REMOTE_REQUESTS ? 'local' : 'remote';
1313

14-
var currentPackage, previousVersions, cdnVersion, gitRepoInfo;
14+
var currentPackage, previousVersions, cdnVersion;
1515

1616

1717
/**
@@ -211,7 +211,7 @@ var getSnapshotVersion = function() {
211211

212212

213213
exports.currentPackage = currentPackage = getPackage();
214-
exports.gitRepoInfo = gitRepoInfo = getGitRepoInfo();
214+
exports.gitRepoInfo = getGitRepoInfo();
215215
exports.previousVersions = previousVersions = getPreviousVersions();
216216
exports.cdnVersion = cdnVersion = getCdnVersion();
217217
exports.currentVersion = getTaggedVersion() || getSnapshotVersion();

scripts/npm/clean-shrinkwrap.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env node
22

3+
'use strict';
4+
35
/**
46
* this script is just a temporary solution to deal with the issue of npm outputting the npm
57
* shrinkwrap file in an unstable manner.

src/.eslintrc.json

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"globals": {
77
"window": false,
8+
"ArrayBuffer": false,
9+
"Uint8Array": false,
810

911
/* auto/injector.js */
1012
"createInjector": false,

src/Angular.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,10 @@ var trim = function(value) {
689689
// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
690690
// Prereq: s is a string.
691691
var escapeForRegexp = function(s) {
692-
return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
693-
replace(/\x08/g, '\\x08');
692+
return s
693+
.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1')
694+
// eslint-disable-next-line no-control-regex
695+
.replace(/\x08/g, '\\x08');
694696
};
695697

696698

@@ -1128,7 +1130,8 @@ var jq = function() {
11281130
var i, ii = ngAttrPrefixes.length, prefix, name;
11291131
for (i = 0; i < ii; ++i) {
11301132
prefix = ngAttrPrefixes[i];
1131-
if (el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
1133+
el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]');
1134+
if (el) {
11321135
name = el.getAttribute(prefix + 'jq');
11331136
break;
11341137
}
@@ -1298,7 +1301,7 @@ function startingTag(element) {
12981301
// turns out IE does not let you set .html() on elements which
12991302
// are not allowed to have children. So we just ignore it.
13001303
element.empty();
1301-
} catch (e) {}
1304+
} catch (e) { /* empty */ }
13021305
var elemHtml = jqLite('<div>').append(element).html();
13031306
try {
13041307
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :

src/apis.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ HashMap.prototype = {
7474
}
7575
};
7676

77-
var $$HashMapProvider = [function() {
77+
var $$HashMapProvider = [/* @this */function() {
7878
this.$get = [function() {
7979
return HashMap;
8080
}];

0 commit comments

Comments
 (0)