Skip to content

Commit

Permalink
Update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 28, 2015
1 parent 3714265 commit 49e3501
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
7 changes: 4 additions & 3 deletions .eslintrc
Expand Up @@ -23,7 +23,7 @@
"eol-last": [2],
"eqeqeq": [2],
"func-names": [0],
"func-style": [0, "declaration"],
"func-style": [2, "expression"],
"generator-star-spacing": [2, "after"],
"global-strict": [0, "never"],
"guard-for-in": [0],
Expand Down Expand Up @@ -85,8 +85,8 @@
"no-mixed-spaces-and-tabs": [2, false],
"no-multi-spaces": [2],
"no-multi-str": [2],
"no-multiple-empty-lines": [2, { "max": 1 }],
"no-native-reassign": [1],
"no-multiple-empty-lines": [2, {"max": 1}],
"no-native-reassign": [1, {"exceptions": ["Date", "parseInt"]}],
"no-negated-in-lhs": [2],
"no-nested-ternary": [0],
"no-new": [2],
Expand Down Expand Up @@ -132,6 +132,7 @@
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": [2],
"no-wrap-func": [2],
"object-shorthand": [2, "never"],
"one-var": [0],
"operator-assignment": [0, "always"],
"operator-linebreak": [2, "after"],
Expand Down
12 changes: 6 additions & 6 deletions es5-sham.js
Expand Up @@ -74,14 +74,14 @@ if (!Object.getPrototypeOf) {
//ES5 15.2.3.3
//http://es5.github.com/#x15.2.3.3

function doesGetOwnPropertyDescriptorWork(object) {
var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) {
try {
object.sentinel = 0;
return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0;
} catch (exception) {
return false;
}
}
};

//check whether getOwnPropertyDescriptor works if it's given. Otherwise,
//shim partially.
Expand Down Expand Up @@ -222,7 +222,7 @@ if (!Object.create) {
empty.__proto__ = null;
/*eslint-enable no-proto */

function Empty() {}
var Empty = function Empty() {};
Empty.prototype = empty;
// short-circuit future calls
createEmpty = function () {
Expand All @@ -235,7 +235,7 @@ if (!Object.create) {
Object.create = function create(prototype, properties) {

var object;
function Type() {} // An empty constructor.
var Type = function Type() {}; // An empty constructor.

if (prototype === null) {
object = createEmpty();
Expand Down Expand Up @@ -279,14 +279,14 @@ if (!Object.create) {
// WebKit Bugs:
// https://bugs.webkit.org/show_bug.cgi?id=36423

function doesDefinePropertyWork(object) {
var doesDefinePropertyWork = function doesDefinePropertyWork(object) {
try {
Object.defineProperty(object, 'sentinel', {});
return 'sentinel' in object;
} catch (exception) {
return false;
}
}
};

// check whether defineProperty works if it's given. Otherwise,
// shim partially.
Expand Down
30 changes: 15 additions & 15 deletions es5-shim.js
Expand Up @@ -121,14 +121,14 @@ var defineProperties = (function (has) {
//

/* replaceable with https://npmjs.com/package/es-abstract /helpers/isPrimitive */
function isPrimitive(input) {
var isPrimitive = function isPrimitive(input) {
var type = typeof input;
return input === null ||
type === 'undefined' ||
type === 'boolean' ||
type === 'number' ||
type === 'string';
}
};

var ES = {
// ES5 9.4
Expand Down Expand Up @@ -922,7 +922,7 @@ if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExt
Date = (function (NativeDate) {
/*eslint-enable no-undef*/
// Date.length === 7
function Date(Y, M, D, h, m, s, ms) {
var DateShim = function Date(Y, M, D, h, m, s, ms) {
var length = arguments.length;
if (this instanceof NativeDate) {
var date = length === 1 && String(Y) === Y ? // isString(Y)
Expand All @@ -943,7 +943,7 @@ if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExt
return date;
}
return NativeDate.apply(this, arguments);
}
};

// 15.9.1.15 Date Time String Format.
var isoDateExpression = new RegExp('^' +
Expand Down Expand Up @@ -972,7 +972,7 @@ if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExt
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
];

function dayFromMonth(year, month) {
var dayFromMonth = function dayFromMonth(year, month) {
var t = month > 1 ? 1 : 0;
return (
months[month] +
Expand All @@ -981,25 +981,25 @@ if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExt
Math.floor((year - 1601 + t) / 400) +
365 * (year - 1970)
);
}
};

function toUTC(t) {
var toUTC = function toUTC(t) {
return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
}
};

// Copy any custom methods a 3rd party library may have added
for (var key in NativeDate) {
Date[key] = NativeDate[key];
DateShim[key] = NativeDate[key];
}

// Copy "native" methods explicitly; they may be non-enumerable
Date.now = NativeDate.now;
Date.UTC = NativeDate.UTC;
Date.prototype = NativeDate.prototype;
Date.prototype.constructor = Date;
DateShim.now = NativeDate.now;
DateShim.UTC = NativeDate.UTC;
DateShim.prototype = NativeDate.prototype;
DateShim.prototype.constructor = Date;

// Upgrade Date.parse to handle simplified ISO 8601 strings
Date.parse = function parse(string) {
DateShim.parse = function parse(string) {
var match = isoDateExpression.exec(string);
if (match) {
// parse months, days, hours, minutes, seconds, and milliseconds
Expand Down Expand Up @@ -1055,7 +1055,7 @@ if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExt
return NativeDate.parse.apply(this, arguments);
};

return Date;
return DateShim;
}(Date));
/*global Date: false */
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -37,7 +37,7 @@
"jscs": "jscs tests/helpers/*.js tests/spec/*.js es5-shim.js es5-sham.js"
},
"devDependencies": {
"eslint": "^0.19.0",
"eslint": "^0.20.0",
"jasmine-node": "^1.14.5",
"jscs": "^1.11.3",
"uglify-js": "^2.4.20",
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/s-function.js
Expand Up @@ -23,12 +23,12 @@ describe('Function', function () {
}
};

function func() {
var func = function func() {
Array.prototype.forEach.call(arguments, function (a) {
this.push(a);
}, this);
return this;
}
};

beforeEach(function () {
actual = [];
Expand Down

0 comments on commit 49e3501

Please sign in to comment.