diff --git a/.jscsrc b/.jscsrc index ca195c19..211744d0 100644 --- a/.jscsrc +++ b/.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", diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 76e12bb8..d5b70d8d 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -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')); diff --git a/package.json b/package.json index e6fdc608..a2161e75 100644 --- a/package.json +++ b/package.json @@ -15,34 +15,34 @@ "chai": "^3.3.0", "chai-jquery": "^2.0.0", "del": "^2.0.2", - "drool": "^0.3.1", + "drool": "^0.4.0", "escodegen": "^1.6.1", "google-closure-compiler": "", "gulp": "^3.9.0", "gulp-autoprefixer": "^3.0.2", - "gulp-cache": "^0.3.0", - "gulp-closure-compiler": "^0.3.1", + "gulp-cache": "^0.4.5", + "gulp-closure-compiler": "^0.4.0", "gulp-concat": "^2.4.1", "gulp-connect": "^5.0.0", "gulp-css-inline-images": "^0.1.1", "gulp-csso": "1.0.0", - "gulp-file": "^0.2.0", + "gulp-file": "^0.3.0", "gulp-flatten": "^0.3.1", "gulp-front-matter": "^1.2.2", "gulp-header": "^1.2.2", "gulp-if": "^2.0.0", - "gulp-iife": "^0.1.0", + "gulp-iife": "^0.3.0", "gulp-imagemin": "^3.1.0", - "gulp-jscs": "^3.0.1", - "gulp-jshint": "^1.6.3", + "gulp-jscs": "^4.0.0", + "gulp-jshint": "^2.0.4", "gulp-load-plugins": "^1.3.0", "gulp-marked": "^1.0.0", "gulp-mocha-phantomjs": "^0.12.0", - "gulp-open": "^1.0.0", + "gulp-open": "^2.0.0", "gulp-rename": "^1.2.0", "gulp-replace": "^0.5.3", "gulp-sass": "3.0.0", - "gulp-shell": "^0.4.2", + "gulp-shell": "^0.5.2", "gulp-size": "^2.0.0", "gulp-sourcemaps": "^2.0.1", "gulp-subtree": "^0.1.0", @@ -52,7 +52,8 @@ "gulp-zip": "^3.0.2", "humanize": "0.0.9", "jquery": "^3.1.1", - "jshint-stylish": "^2.0.1", + "jshint": "^2.9.4", + "jshint-stylish": "^2.2.1", "merge-stream": "^1.0.0", "mocha": "^3.0.2", "prismjs": "0.0.1", diff --git a/src/third_party/rAF.js b/src/third_party/rAF.js index d2e8d777..863f561f 100644 --- a/src/third_party/rAF.js +++ b/src/third_party/rAF.js @@ -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; + } })(); diff --git a/utils/jscs-rules/closure-camel-case.js b/utils/jscs-rules/closure-camel-case.js deleted file mode 100644 index 4c1b5e35..00000000 --- a/utils/jscs-rules/closure-camel-case.js +++ /dev/null @@ -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 - ); - }); -};