mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
refactor(jshint): reduce duplication & test all JS files
This commit is contained in:
2
.jshintignore
Normal file
2
.jshintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/**
|
||||
lib/htmlparser/**
|
||||
5
.jshintrc
Normal file
5
.jshintrc
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": ".jshintrc-base",
|
||||
"node": true,
|
||||
"globals": {}
|
||||
}
|
||||
19
.jshintrc-base
Normal file
19
.jshintrc-base
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 200,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"indent": 2
|
||||
}
|
||||
11
Gruntfile.js
11
Gruntfile.js
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var files = require('./angularFiles').files;
|
||||
var util = require('./lib/grunt/utils.js');
|
||||
var versionInfo = require('./lib/versions/version-info');
|
||||
@@ -107,6 +109,9 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
jshintrc: true,
|
||||
},
|
||||
node: {
|
||||
files: { src: ['*.js', 'lib/**/*.js'] },
|
||||
},
|
||||
tests: {
|
||||
files: { src: 'test/**/*.js' },
|
||||
},
|
||||
@@ -260,7 +265,11 @@ module.exports = function(grunt) {
|
||||
compress: {
|
||||
build: {
|
||||
options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
|
||||
src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
|
||||
src: ['**'],
|
||||
cwd: 'build',
|
||||
expand: true,
|
||||
dot: true,
|
||||
dest: dist + '/'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
4
angularFiles.js
vendored
4
angularFiles.js
vendored
@@ -1,4 +1,6 @@
|
||||
angularFiles = {
|
||||
'use strict';
|
||||
|
||||
var angularFiles = {
|
||||
'angularSrc': [
|
||||
'src/minErr.js',
|
||||
'src/Angular.js',
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// TODO(vojta): pre-commit hook for validating messages
|
||||
// TODO(vojta): report errors, currently Q silence everything which really sucks
|
||||
|
||||
'use strict';
|
||||
|
||||
var child = require('child_process');
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
@@ -164,7 +166,7 @@ var writeChangelog = function(stream, commits, version) {
|
||||
hash: commit.hash,
|
||||
closes: []
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
stream.write(util.format(HEADER_TPL, version, version, currentDate()));
|
||||
@@ -172,7 +174,7 @@ var writeChangelog = function(stream, commits, version) {
|
||||
printSection(stream, 'Features', sections.feat);
|
||||
printSection(stream, 'Performance Improvements', sections.perf);
|
||||
printSection(stream, 'Breaking Changes', sections.breaks, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var getPreviousTag = function() {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* global describe: false, it: false, expect: false */
|
||||
|
||||
'use strict';
|
||||
|
||||
describe('changelog.js', function() {
|
||||
var ch = require('./changelog');
|
||||
|
||||
@@ -13,7 +17,7 @@ describe('changelog.js', function() {
|
||||
expect(msg.hash).toBe('9b1aff905b638aa274a5fc8f88662df446d374bd');
|
||||
expect(msg.subject).toBe('broadcast $destroy event on scope destruction');
|
||||
expect(msg.body).toBe('perf testing shows that in chrome this change adds 5-15% overhead\n' +
|
||||
'when destroying 10k nested scopes where each scope has a $destroy listener\n')
|
||||
'when destroying 10k nested scopes where each scope has a $destroy listener\n');
|
||||
expect(msg.component).toBe('scope');
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var cp = require('child_process');
|
||||
|
||||
@@ -146,7 +148,7 @@ then(allInSeries(function (branch) {
|
||||
return sha + (msg.toLowerCase().indexOf('fix') === -1 ? ' ' : ' * ') + msg;
|
||||
});
|
||||
branch.log = log.map(function (line) {
|
||||
return line.substr(41)
|
||||
return line.substr(41);
|
||||
});
|
||||
return branch;
|
||||
});
|
||||
|
||||
167
gdocs.js
167
gdocs.js
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var fs = require('fs');
|
||||
@@ -41,63 +43,63 @@ function help() {
|
||||
console.log('gdocs.js --login <username>');
|
||||
console.log('gdocs.js --fetch [<docs collection>]');
|
||||
process.exit(-1);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function fetch(collection, url){
|
||||
console.log('fetching a list of docs in collection ' + collection + '...');
|
||||
request('GET', url, {
|
||||
headers: {
|
||||
'Gdata-Version': '3.0',
|
||||
'Authorization': 'GoogleLogin auth=' + getAuthToken()
|
||||
}
|
||||
},
|
||||
function(chunk){
|
||||
var entries = chunk.split('<entry');
|
||||
entries.shift();
|
||||
entries.forEach(function(entry){
|
||||
var title = entry.match(/<title>(.*?)<\/title>/)[1];
|
||||
if (title.match(/\.ngdoc$/)) {
|
||||
var exportUrl = entry.match(/<content type='text\/html' src='(.*?)'\/>/)[1];
|
||||
download(collection, title, exportUrl);
|
||||
};
|
||||
});
|
||||
headers: {
|
||||
'Gdata-Version': '3.0',
|
||||
'Authorization': 'GoogleLogin auth=' + getAuthToken()
|
||||
}
|
||||
);
|
||||
},
|
||||
function(chunk){
|
||||
var entries = chunk.split('<entry');
|
||||
entries.shift();
|
||||
entries.forEach(function(entry){
|
||||
var title = entry.match(/<title>(.*?)<\/title>/)[1];
|
||||
if (title.match(/\.ngdoc$/)) {
|
||||
var exportUrl = entry.match(/<content type='text\/html' src='(.*?)'\/>/)[1];
|
||||
download(collection, title, exportUrl);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function download(collection, name, url) {
|
||||
console.log('Downloading:', name, '...');
|
||||
request('GET', url + '&exportFormat=txt',
|
||||
{
|
||||
headers: {
|
||||
'Gdata-Version': '3.0',
|
||||
'Authorization': 'GoogleLogin auth=' + getAuthToken()
|
||||
}
|
||||
},
|
||||
function(data){
|
||||
data = data.replace('\ufeff', '');
|
||||
data = data.replace(/\r\n/mg, '\n');
|
||||
|
||||
// strip out all text annotations
|
||||
data = data.replace(/\[[a-zA-Z]{1,2}\]/mg, '');
|
||||
|
||||
// strip out all docos comments
|
||||
data = data.replace(/^[^\s_]+:\n\S+[\S\s]*$/m, '');
|
||||
|
||||
// fix smart-quotes
|
||||
data = data.replace(/[“”]/g, '"');
|
||||
data = data.replace(/[‘’]/g, "'");
|
||||
|
||||
|
||||
data = data + '\n';
|
||||
|
||||
//this should be a bug in Google Doc API, hence need to remove this once the bug is fixed
|
||||
data = data.replace(/\n\n/g, '\n');
|
||||
|
||||
fs.writeFileSync('docs/content/' + collection + '/' + name, reflow(data, 100));
|
||||
{
|
||||
headers: {
|
||||
'Gdata-Version': '3.0',
|
||||
'Authorization': 'GoogleLogin auth=' + getAuthToken()
|
||||
}
|
||||
);
|
||||
},
|
||||
function(data){
|
||||
data = data.replace('\ufeff', '');
|
||||
data = data.replace(/\r\n/mg, '\n');
|
||||
|
||||
// strip out all text annotations
|
||||
data = data.replace(/\[[a-zA-Z]{1,2}\]/mg, '');
|
||||
|
||||
// strip out all docos comments
|
||||
data = data.replace(/^[^\s_]+:\n\S+[\S\s]*$/m, '');
|
||||
|
||||
// fix smart-quotes
|
||||
data = data.replace(/[“”]/g, '"');
|
||||
data = data.replace(/[‘’]/g, "'");
|
||||
|
||||
|
||||
data = data + '\n';
|
||||
|
||||
//this should be a bug in Google Doc API, hence need to remove this once the bug is fixed
|
||||
data = data.replace(/\n\n/g, '\n');
|
||||
|
||||
fs.writeFileSync('docs/content/' + collection + '/' + name, reflow(data, 100));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,34 +113,34 @@ function download(collection, name, url) {
|
||||
*/
|
||||
function login(username, password){
|
||||
request('POST', 'https://www.google.com/accounts/ClientLogin',
|
||||
{
|
||||
data: {
|
||||
Email: username,
|
||||
Passwd: password,
|
||||
accountType: 'GOOGLE',
|
||||
service: 'writely',
|
||||
'Gdata-version': '3.0'
|
||||
},
|
||||
headers: {
|
||||
'Content-type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
{
|
||||
data: {
|
||||
Email: username,
|
||||
Passwd: password,
|
||||
accountType: 'GOOGLE',
|
||||
service: 'writely',
|
||||
'Gdata-version': '3.0'
|
||||
},
|
||||
function(chunk){
|
||||
var token;
|
||||
chunk.split('\n').forEach(function(line){
|
||||
var parts = line.split('=');
|
||||
if (parts[0] == 'Auth') {
|
||||
token = parts[1];
|
||||
}
|
||||
});
|
||||
if (token) {
|
||||
fs.writeFileSync('tmp/gdocs.auth', token);
|
||||
console.log("logged in, token saved in 'tmp/gdocs.auth'");
|
||||
} else {
|
||||
console.log('failed to log in');
|
||||
}
|
||||
headers: {
|
||||
'Content-type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
);
|
||||
},
|
||||
function(chunk){
|
||||
var token;
|
||||
chunk.split('\n').forEach(function(line){
|
||||
var parts = line.split('=');
|
||||
if (parts[0] == 'Auth') {
|
||||
token = parts[1];
|
||||
}
|
||||
});
|
||||
if (token) {
|
||||
fs.writeFileSync('tmp/gdocs.auth', token);
|
||||
console.log("logged in, token saved in 'tmp/gdocs.auth'");
|
||||
} else {
|
||||
console.log('failed to log in');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getAuthToken() {
|
||||
@@ -152,17 +154,18 @@ function getAuthToken() {
|
||||
}
|
||||
|
||||
function request(method, url, options, response) {
|
||||
var url = url.match(/http(s?):\/\/(.+?)(\/.*)/);
|
||||
url = url.match(/http(s?):\/\/(.+?)(\/.*)/);
|
||||
var isHttps = url[1];
|
||||
var request = (isHttps ? https : http).request({
|
||||
var req = (isHttps ? https : http).request({
|
||||
host: url[2],
|
||||
port: (url[1] ? 443 : 80),
|
||||
path: url[3],
|
||||
method: method
|
||||
}, function(res){
|
||||
var data;
|
||||
switch (res.statusCode) {
|
||||
case 200:
|
||||
var data = [];
|
||||
data = [];
|
||||
res.setEncoding('utf8');
|
||||
res.on('end', function () { response(data.join('')); });
|
||||
res.on('close', function () { response(data.join('')); }); // https
|
||||
@@ -173,7 +176,7 @@ function request(method, url, options, response) {
|
||||
console.log('Eror: Login credentials expired! Please login.');
|
||||
break;
|
||||
default:
|
||||
var data = [];
|
||||
data = [];
|
||||
console.log('ERROR: ', res.statusCode);
|
||||
console.log('REQUEST URL: ', url[0]);
|
||||
console.log('REQUEST POST: ', options.data);
|
||||
@@ -186,14 +189,14 @@ function request(method, url, options, response) {
|
||||
}
|
||||
});
|
||||
for(var header in options.headers) {
|
||||
request.setHeader(header, options.headers[header]);
|
||||
req.setHeader(header, options.headers[header]);
|
||||
}
|
||||
if (options.data)
|
||||
request.write(encodeData(options.data));
|
||||
request.on('end', function() {
|
||||
req.write(encodeData(options.data));
|
||||
req.on('end', function() {
|
||||
console.log('end');
|
||||
});
|
||||
request.end();
|
||||
req.end();
|
||||
}
|
||||
|
||||
function encodeData(obj) {
|
||||
@@ -215,7 +218,9 @@ function askPassword(callback) {
|
||||
stdin.on("data", function(c) {
|
||||
c = c + "";
|
||||
switch (c) {
|
||||
case "\n": case "\r": case "\u0004":
|
||||
case "\n":
|
||||
case "\r":
|
||||
case "\u0004":
|
||||
stdio.setRawMode(false);
|
||||
stdin.pause();
|
||||
callback(password);
|
||||
@@ -227,7 +232,7 @@ function askPassword(callback) {
|
||||
password += c;
|
||||
break;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var sharedConfig = require('./karma-shared.conf');
|
||||
|
||||
module.exports = function(config) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var angularFiles = require('./angularFiles');
|
||||
var sharedConfig = require('./karma-shared.conf');
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var angularFiles = require('./angularFiles');
|
||||
var sharedConfig = require('./karma-shared.conf');
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var angularFiles = require('./angularFiles');
|
||||
var sharedConfig = require('./karma-shared.conf');
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(config, specificOptions) {
|
||||
config.set({
|
||||
frameworks: ['jasmine'],
|
||||
@@ -158,7 +160,7 @@ module.exports = function(config, specificOptions) {
|
||||
|
||||
// ignore web-server's 404s
|
||||
if (log.categoryName === 'web-server' && log.level.levelStr === config.LOG_WARN &&
|
||||
IGNORED_404.some(function(ignoredLog) {return msg.indexOf(ignoredLog) !== -1})) {
|
||||
IGNORED_404.some(function(ignoredLog) {return msg.indexOf(ignoredLog) !== -1;})) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var http = require('http');
|
||||
var BrowserStackTunnel = require('browserstacktunnel-wrapper');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var bower = require('bower');
|
||||
var util = require('./utils.js');
|
||||
var shelljs = require('shelljs');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var shell = require('shelljs');
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
var isFunction = function isFunction(value){return typeof value == 'function';}
|
||||
/* global qFactory: false */
|
||||
'use strict';
|
||||
|
||||
var isFunction = function isFunction(value){return typeof value == 'function';};
|
||||
|
||||
var $q = qFactory(process.nextTick, function noopExceptionHandler() {});
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var shell = require('shelljs');
|
||||
var semver = require('semver');
|
||||
var _ = require('lodash');
|
||||
|
||||
var currentPackage, previousVersions, cdnVersion;
|
||||
var currentPackage, previousVersions, cdnVersion, gitRepoInfo;
|
||||
|
||||
|
||||
/**
|
||||
@@ -154,14 +156,14 @@ var getCdnVersion = function() {
|
||||
}
|
||||
return cdnVersion;
|
||||
}, null);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the unstable snapshot version
|
||||
* @return {SemVer} The snapshot version
|
||||
*/
|
||||
var getSnapshotVersion = function() {
|
||||
version = _(previousVersions)
|
||||
var version = _(previousVersions)
|
||||
.filter(function(tag) {
|
||||
return semver.satisfies(tag, currentPackage.branchVersion);
|
||||
})
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
config.specs = [
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
|
||||
@@ -15,6 +17,8 @@ exports.config = {
|
||||
framework: 'jasmine',
|
||||
|
||||
onPrepare: function() {
|
||||
/* global angular: false, browser: false, jasmine: false */
|
||||
|
||||
// Disable animations so e2e tests run more quickly
|
||||
var disableNgAnimate = function() {
|
||||
angular.module('disableNgAnimate', []).run(function($animate) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
|
||||
@@ -6,6 +8,8 @@ exports.config = {
|
||||
framework: 'jasmine',
|
||||
|
||||
onPrepare: function() {
|
||||
/* global angular: false, browser: false, jasmine: false */
|
||||
|
||||
// Disable animations so e2e tests run more quickly
|
||||
var disableNgAnimate = function() {
|
||||
angular.module('disableNgAnimate', []).run(function($animate) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 200,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
/* auto/injector.js */
|
||||
@@ -109,7 +94,7 @@
|
||||
"version": false,
|
||||
"publishExternalAPI": false,
|
||||
|
||||
/* minerr.js */
|
||||
/* minErr.js */
|
||||
"minErr": false,
|
||||
|
||||
/* loader.js */
|
||||
|
||||
162
src/Angular.js
162
src/Angular.js
@@ -1,89 +1,87 @@
|
||||
'use strict';
|
||||
|
||||
/* We need to tell jshint what variables are being exported */
|
||||
/* global
|
||||
-angular,
|
||||
-msie,
|
||||
-jqLite,
|
||||
-jQuery,
|
||||
-slice,
|
||||
-push,
|
||||
-toString,
|
||||
-ngMinErr,
|
||||
-angularModule,
|
||||
-nodeName_,
|
||||
-uid,
|
||||
-REGEX_STRING_REGEXP,
|
||||
-VALIDITY_STATE_PROPERTY,
|
||||
|
||||
-lowercase,
|
||||
-uppercase,
|
||||
-manualLowercase,
|
||||
-manualUppercase,
|
||||
-nodeName_,
|
||||
-isArrayLike,
|
||||
-forEach,
|
||||
-sortedKeys,
|
||||
-forEachSorted,
|
||||
-reverseParams,
|
||||
-nextUid,
|
||||
-setHashKey,
|
||||
-extend,
|
||||
-int,
|
||||
-inherit,
|
||||
-noop,
|
||||
-identity,
|
||||
-valueFn,
|
||||
-isUndefined,
|
||||
-isDefined,
|
||||
-isObject,
|
||||
-isString,
|
||||
-isNumber,
|
||||
-isDate,
|
||||
-isArray,
|
||||
-isFunction,
|
||||
-isRegExp,
|
||||
-isWindow,
|
||||
-isScope,
|
||||
-isFile,
|
||||
-isBlob,
|
||||
-isBoolean,
|
||||
-trim,
|
||||
-isElement,
|
||||
-makeMap,
|
||||
-map,
|
||||
-size,
|
||||
-includes,
|
||||
-indexOf,
|
||||
-arrayRemove,
|
||||
-isLeafNode,
|
||||
-copy,
|
||||
-shallowCopy,
|
||||
-equals,
|
||||
-csp,
|
||||
-concat,
|
||||
-sliceArgs,
|
||||
-bind,
|
||||
-toJsonReplacer,
|
||||
-toJson,
|
||||
-fromJson,
|
||||
-startingTag,
|
||||
-tryDecodeURIComponent,
|
||||
-parseKeyValue,
|
||||
-toKeyValue,
|
||||
-encodeUriSegment,
|
||||
-encodeUriQuery,
|
||||
-angularInit,
|
||||
-bootstrap,
|
||||
-snake_case,
|
||||
-bindJQuery,
|
||||
-assertArg,
|
||||
-assertArgFn,
|
||||
-assertNotHasOwnProperty,
|
||||
-getter,
|
||||
-getBlockElements,
|
||||
-hasOwnProperty,
|
||||
/* global angular: true,
|
||||
msie: true,
|
||||
jqLite: true,
|
||||
jQuery: true,
|
||||
slice: true,
|
||||
push: true,
|
||||
toString: true,
|
||||
ngMinErr: true,
|
||||
angularModule: true,
|
||||
nodeName_: true,
|
||||
uid: true,
|
||||
REGEX_STRING_REGEXP: true,
|
||||
VALIDITY_STATE_PROPERTY: true,
|
||||
|
||||
lowercase: true,
|
||||
uppercase: true,
|
||||
manualLowercase: true,
|
||||
manualUppercase: true,
|
||||
nodeName_: true,
|
||||
isArrayLike: true,
|
||||
forEach: true,
|
||||
sortedKeys: true,
|
||||
forEachSorted: true,
|
||||
reverseParams: true,
|
||||
nextUid: true,
|
||||
setHashKey: true,
|
||||
extend: true,
|
||||
int: true,
|
||||
inherit: true,
|
||||
noop: true,
|
||||
identity: true,
|
||||
valueFn: true,
|
||||
isUndefined: true,
|
||||
isDefined: true,
|
||||
isObject: true,
|
||||
isString: true,
|
||||
isNumber: true,
|
||||
isDate: true,
|
||||
isArray: true,
|
||||
isFunction: true,
|
||||
isRegExp: true,
|
||||
isWindow: true,
|
||||
isScope: true,
|
||||
isFile: true,
|
||||
isBlob: true,
|
||||
isBoolean: true,
|
||||
trim: true,
|
||||
isElement: true,
|
||||
makeMap: true,
|
||||
map: true,
|
||||
size: true,
|
||||
includes: true,
|
||||
indexOf: true,
|
||||
arrayRemove: true,
|
||||
isLeafNode: true,
|
||||
copy: true,
|
||||
shallowCopy: true,
|
||||
equals: true,
|
||||
csp: true,
|
||||
concat: true,
|
||||
sliceArgs: true,
|
||||
bind: true,
|
||||
toJsonReplacer: true,
|
||||
toJson: true,
|
||||
fromJson: true,
|
||||
startingTag: true,
|
||||
tryDecodeURIComponent: true,
|
||||
parseKeyValue: true,
|
||||
toKeyValue: true,
|
||||
encodeUriSegment: true,
|
||||
encodeUriQuery: true,
|
||||
angularInit: true,
|
||||
bootstrap: true,
|
||||
snake_case: true,
|
||||
bindJQuery: true,
|
||||
assertArg: true,
|
||||
assertArgFn: true,
|
||||
assertNotHasOwnProperty: true,
|
||||
getter: true,
|
||||
getBlockElements: true,
|
||||
hasOwnProperty: true,
|
||||
*/
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
@@ -1,88 +1,87 @@
|
||||
'use strict';
|
||||
|
||||
/* global
|
||||
angularModule: true,
|
||||
version: true,
|
||||
/* global angularModule: true,
|
||||
version: true,
|
||||
|
||||
$LocaleProvider,
|
||||
$CompileProvider,
|
||||
$LocaleProvider,
|
||||
$CompileProvider,
|
||||
|
||||
htmlAnchorDirective,
|
||||
inputDirective,
|
||||
inputDirective,
|
||||
formDirective,
|
||||
scriptDirective,
|
||||
selectDirective,
|
||||
styleDirective,
|
||||
optionDirective,
|
||||
ngBindDirective,
|
||||
ngBindHtmlDirective,
|
||||
ngBindTemplateDirective,
|
||||
ngClassDirective,
|
||||
ngClassEvenDirective,
|
||||
ngClassOddDirective,
|
||||
ngCspDirective,
|
||||
ngCloakDirective,
|
||||
ngControllerDirective,
|
||||
ngFormDirective,
|
||||
ngHideDirective,
|
||||
ngIfDirective,
|
||||
ngIncludeDirective,
|
||||
ngIncludeFillContentDirective,
|
||||
ngInitDirective,
|
||||
ngNonBindableDirective,
|
||||
ngPluralizeDirective,
|
||||
ngRepeatDirective,
|
||||
ngShowDirective,
|
||||
ngStyleDirective,
|
||||
ngSwitchDirective,
|
||||
ngSwitchWhenDirective,
|
||||
ngSwitchDefaultDirective,
|
||||
ngOptionsDirective,
|
||||
ngTranscludeDirective,
|
||||
ngModelDirective,
|
||||
ngListDirective,
|
||||
ngChangeDirective,
|
||||
patternDirective,
|
||||
patternDirective,
|
||||
requiredDirective,
|
||||
requiredDirective,
|
||||
minlengthDirective,
|
||||
minlengthDirective,
|
||||
maxlengthDirective,
|
||||
maxlengthDirective,
|
||||
ngValueDirective,
|
||||
ngModelOptionsDirective,
|
||||
ngAttributeAliasDirectives,
|
||||
ngEventDirectives,
|
||||
htmlAnchorDirective,
|
||||
inputDirective,
|
||||
inputDirective,
|
||||
formDirective,
|
||||
scriptDirective,
|
||||
selectDirective,
|
||||
styleDirective,
|
||||
optionDirective,
|
||||
ngBindDirective,
|
||||
ngBindHtmlDirective,
|
||||
ngBindTemplateDirective,
|
||||
ngClassDirective,
|
||||
ngClassEvenDirective,
|
||||
ngClassOddDirective,
|
||||
ngCspDirective,
|
||||
ngCloakDirective,
|
||||
ngControllerDirective,
|
||||
ngFormDirective,
|
||||
ngHideDirective,
|
||||
ngIfDirective,
|
||||
ngIncludeDirective,
|
||||
ngIncludeFillContentDirective,
|
||||
ngInitDirective,
|
||||
ngNonBindableDirective,
|
||||
ngPluralizeDirective,
|
||||
ngRepeatDirective,
|
||||
ngShowDirective,
|
||||
ngStyleDirective,
|
||||
ngSwitchDirective,
|
||||
ngSwitchWhenDirective,
|
||||
ngSwitchDefaultDirective,
|
||||
ngOptionsDirective,
|
||||
ngTranscludeDirective,
|
||||
ngModelDirective,
|
||||
ngListDirective,
|
||||
ngChangeDirective,
|
||||
patternDirective,
|
||||
patternDirective,
|
||||
requiredDirective,
|
||||
requiredDirective,
|
||||
minlengthDirective,
|
||||
minlengthDirective,
|
||||
maxlengthDirective,
|
||||
maxlengthDirective,
|
||||
ngValueDirective,
|
||||
ngModelOptionsDirective,
|
||||
ngAttributeAliasDirectives,
|
||||
ngEventDirectives,
|
||||
|
||||
$AnchorScrollProvider,
|
||||
$AnimateProvider,
|
||||
$BrowserProvider,
|
||||
$CacheFactoryProvider,
|
||||
$ControllerProvider,
|
||||
$DocumentProvider,
|
||||
$ExceptionHandlerProvider,
|
||||
$FilterProvider,
|
||||
$InterpolateProvider,
|
||||
$IntervalProvider,
|
||||
$HttpProvider,
|
||||
$HttpBackendProvider,
|
||||
$LocationProvider,
|
||||
$LogProvider,
|
||||
$ParseProvider,
|
||||
$RootScopeProvider,
|
||||
$QProvider,
|
||||
$$QProvider,
|
||||
$$SanitizeUriProvider,
|
||||
$SceProvider,
|
||||
$SceDelegateProvider,
|
||||
$SnifferProvider,
|
||||
$TemplateCacheProvider,
|
||||
$TimeoutProvider,
|
||||
$$RAFProvider,
|
||||
$$AsyncCallbackProvider,
|
||||
$WindowProvider
|
||||
$AnchorScrollProvider,
|
||||
$AnimateProvider,
|
||||
$BrowserProvider,
|
||||
$CacheFactoryProvider,
|
||||
$ControllerProvider,
|
||||
$DocumentProvider,
|
||||
$ExceptionHandlerProvider,
|
||||
$FilterProvider,
|
||||
$InterpolateProvider,
|
||||
$IntervalProvider,
|
||||
$HttpProvider,
|
||||
$HttpBackendProvider,
|
||||
$LocationProvider,
|
||||
$LogProvider,
|
||||
$ParseProvider,
|
||||
$RootScopeProvider,
|
||||
$QProvider,
|
||||
$$QProvider,
|
||||
$$SanitizeUriProvider,
|
||||
$SceProvider,
|
||||
$SceDelegateProvider,
|
||||
$SnifferProvider,
|
||||
$TemplateCacheProvider,
|
||||
$TimeoutProvider,
|
||||
$$RAFProvider,
|
||||
$$AsyncCallbackProvider,
|
||||
$WindowProvider
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
/* global
|
||||
|
||||
-JQLitePrototype,
|
||||
-addEventListenerFn,
|
||||
-removeEventListenerFn,
|
||||
-BOOLEAN_ATTR,
|
||||
-ALIASED_ATTR
|
||||
/* global JQLitePrototype: true,
|
||||
addEventListenerFn: true,
|
||||
removeEventListenerFn: true,
|
||||
BOOLEAN_ATTR: true,
|
||||
ALIASED_ATTR: true,
|
||||
*/
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
/* global
|
||||
|
||||
-VALID_CLASS,
|
||||
-INVALID_CLASS,
|
||||
-PRISTINE_CLASS,
|
||||
-DIRTY_CLASS,
|
||||
-UNTOUCHED_CLASS,
|
||||
-TOUCHED_CLASS
|
||||
/* global VALID_CLASS: true,
|
||||
INVALID_CLASS: true,
|
||||
PRISTINE_CLASS: true,
|
||||
DIRTY_CLASS: true,
|
||||
UNTOUCHED_CLASS: true,
|
||||
TOUCHED_CLASS: true,
|
||||
*/
|
||||
|
||||
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
/* global currencyFilter: true,
|
||||
dateFilter: true,
|
||||
filterFilter: true,
|
||||
jsonFilter: true,
|
||||
limitToFilter: true,
|
||||
lowercaseFilter: true,
|
||||
numberFilter: true,
|
||||
orderByFilter: true,
|
||||
uppercaseFilter: true,
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc provider
|
||||
* @name $filterProvider
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"maxlen": false, /* ngAnimate docs contain wide tables */
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
{
|
||||
"extends": "../../.jshintrc-base",
|
||||
"bitwise": false, /* locale files use bitwise operators */
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": false, /* locale files are generated from a 3rd party library that has long lines */
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false,
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false,
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false,
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false,
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 100,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../../.jshintrc-base",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"angular": false,
|
||||
|
||||
@@ -1,22 +1,6 @@
|
||||
{
|
||||
"bitwise": true,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"trailing": true,
|
||||
"maxlen": 200,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"globalstrict": true,
|
||||
"laxbreak": true,
|
||||
"loopfunc": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"extends": "../.jshintrc-base",
|
||||
"browser": true,
|
||||
"indent": 2,
|
||||
"globals": {
|
||||
/* auto/injector.js */
|
||||
"createInjector": false,
|
||||
@@ -39,7 +23,6 @@
|
||||
"uppercase": false,
|
||||
"manualLowercase": false,
|
||||
"manualUppercase": false,
|
||||
"nodeName_": false,
|
||||
"isArrayLike": false,
|
||||
"forEach": false,
|
||||
"sortedKeys": false,
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
* >> cd <angular-repo>
|
||||
* >> ln -s ../../validate-commit-msg.js .git/hooks/commit-msg
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
|
||||
|
||||
var MAX_LENGTH = 100;
|
||||
var PATTERN = /^(?:fixup!\s*)?(\w*)(\(([\w\$\.\-\*/]*)\))?\: (.*)$/;
|
||||
var PATTERN = /^(?:fixup!\s*)?(\w*)(\(([\w\$\.\*/-]*)\))?\: (.*)$/;
|
||||
var IGNORED = /^WIP\:/;
|
||||
var TYPES = {
|
||||
feat: true,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/* global describe: false, beforeEach: false, it: false, expect: false, spyOn: false */
|
||||
'use strict';
|
||||
|
||||
describe('validate-commit-msg.js', function() {
|
||||
var m = require('./validate-commit-msg');
|
||||
var errors = [];
|
||||
|
||||
Reference in New Issue
Block a user