mirror of
https://github.com/google/material-design-lite.git
synced 2024-10-05 16:27:46 +03:00
Updating JSCS and fixing linting errors.
Also removing custom JSCS rule for Closure.
This commit is contained in:
parent
76b1fc99cb
commit
7d7c86b956
5
.jscsrc
5
.jscsrc
@ -1,6 +1,5 @@
|
||||
{
|
||||
"preset": "google",
|
||||
"esnext": true,
|
||||
"disallowSpacesInAnonymousFunctionExpression": null,
|
||||
"validateLineBreaks": "LF",
|
||||
"validateIndentation": 2,
|
||||
@ -8,9 +7,7 @@
|
||||
"maximumLineLength": 130,
|
||||
"validateQuoteMarks": "'",
|
||||
"requireDotNotation": false,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": null,
|
||||
"additionalRules": ["./utils/jscs-rules/*.js", "../utils/jscs-rules/*.js"],
|
||||
"closureCamelCase": true,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": {"allowedPrefixes": ["opt_"]},
|
||||
"jsDoc": {
|
||||
"checkAnnotations": {
|
||||
"preset": "closurecompiler",
|
||||
|
@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// jscs:disable jsDoc
|
||||
// jscs:disable jsDoc
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -219,12 +219,12 @@ gulp.task('closure', () => {
|
||||
compilerPath: 'node_modules/google-closure-compiler/compiler.jar',
|
||||
fileName: 'material.closure.min.js',
|
||||
compilerFlags: {
|
||||
// jscs:disable closureCamelCase
|
||||
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
compilation_level: 'ADVANCED_OPTIMIZATIONS',
|
||||
language_in: 'ECMASCRIPT6_STRICT',
|
||||
language_out: 'ECMASCRIPT5_STRICT',
|
||||
warning_level: 'VERBOSE'
|
||||
// jscs:enable closureCamelCase
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
|
@ -33,7 +33,7 @@
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-iife": "^0.3.0",
|
||||
"gulp-imagemin": "^3.1.0",
|
||||
"gulp-jscs": "^3.0.1",
|
||||
"gulp-jscs": "^4.0.0",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"gulp-load-plugins": "^1.3.0",
|
||||
"gulp-marked": "^1.0.0",
|
||||
|
68
src/third_party/rAF.js
vendored
68
src/third_party/rAF.js
vendored
@ -9,42 +9,42 @@
|
||||
// MIT license
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
if (!Date.now) {
|
||||
/**
|
||||
* Date.now polyfill.
|
||||
* @return {number} the current Date
|
||||
*/
|
||||
Date.now = function() { return new Date().getTime(); };
|
||||
Date['now'] = Date.now;
|
||||
}
|
||||
if (!Date.now) {
|
||||
/**
|
||||
* Date.now polyfill.
|
||||
* @return {number} the current Date
|
||||
*/
|
||||
Date.now = function() { return new Date().getTime(); };
|
||||
Date['now'] = Date.now;
|
||||
}
|
||||
|
||||
var vendors = ['webkit', 'moz'];
|
||||
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
||||
var vp = vendors[i];
|
||||
window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] ||
|
||||
window[vp + 'CancelRequestAnimationFrame']);
|
||||
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
||||
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
||||
}
|
||||
var vendors = ['webkit', 'moz'];
|
||||
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
||||
var vp = vendors[i];
|
||||
window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
|
||||
window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] ||
|
||||
window[vp + 'CancelRequestAnimationFrame']);
|
||||
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
||||
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
||||
}
|
||||
|
||||
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
||||
var lastTime = 0;
|
||||
/**
|
||||
* requestAnimationFrame polyfill.
|
||||
* @param {!Function} callback the callback function.
|
||||
*/
|
||||
window.requestAnimationFrame = function(callback) {
|
||||
var now = Date.now();
|
||||
var nextTime = Math.max(lastTime + 16, now);
|
||||
return setTimeout(function() { callback(lastTime = nextTime); },
|
||||
nextTime - now);
|
||||
};
|
||||
window.cancelAnimationFrame = clearTimeout;
|
||||
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
||||
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
||||
}
|
||||
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
||||
var lastTime = 0;
|
||||
/**
|
||||
* requestAnimationFrame polyfill.
|
||||
* @param {!Function} callback the callback function.
|
||||
*/
|
||||
window.requestAnimationFrame = function(callback) {
|
||||
var now = Date.now();
|
||||
var nextTime = Math.max(lastTime + 16, now);
|
||||
return setTimeout(function() { callback(lastTime = nextTime); },
|
||||
nextTime - now);
|
||||
};
|
||||
window.cancelAnimationFrame = clearTimeout;
|
||||
window['requestAnimationFrame'] = window.requestAnimationFrame;
|
||||
window['cancelAnimationFrame'] = window.cancelAnimationFrame;
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks that identifiers are written in camelCase (or UPPER_CASE), with the
|
||||
* exception of optional parameters (opt_foo), which follow Closure convention.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function() {};
|
||||
|
||||
/**
|
||||
* Returns the option name to JSCS.
|
||||
* @return {string} the option name.
|
||||
*/
|
||||
module.exports.prototype.getOptionName = function() {
|
||||
return 'closureCamelCase';
|
||||
};
|
||||
|
||||
/**
|
||||
* Configure the rule parameters.
|
||||
* @param {boolean} value the value for this rule.
|
||||
*/
|
||||
module.exports.prototype.configure = function(value) {
|
||||
// rule preparation and configuration
|
||||
this._options = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether or not the rule is being broken.
|
||||
* @param {Object} file the file being checked
|
||||
* @param {Object} errors the current list of errors on the file
|
||||
*/
|
||||
module.exports.prototype.check = function(file, errors) {
|
||||
if (!this._options) {
|
||||
return;
|
||||
}
|
||||
file.iterateTokensByType('Identifier', function(token) {
|
||||
var name = token.value;
|
||||
if (name.replace(/^_+/g, '')
|
||||
.replace(/^opt_+/g, '')
|
||||
.replace(/_+$/g, '')
|
||||
.indexOf('_') === -1 ||
|
||||
name.toUpperCase() === name) {
|
||||
return;
|
||||
}
|
||||
errors.add(
|
||||
'All identifiers must be camelCase or UPPER_CASE',
|
||||
token.loc.start.line,
|
||||
token.loc.start.column
|
||||
);
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user