Jforrester has uploaded a new change for review.
https://gerrit.wikimedia.org/r/307996
Change subject: [WIP] build: Switch from jshint and jscs to eslint
......................................................................
[WIP] build: Switch from jshint and jscs to eslint
Change-Id: I42001fb086fb090ad9f154b691f4c104d76e60a2
---
A .eslintrc.json
M Gruntfile.js
M build/moduleUtils.js
M build/tasks/buildloader.js
M build/tasks/git-build.js
M lib/jquery.client/jquery.client.js
M lib/jquery.i18n/src/jquery.i18n.language.js
M lib/oojs-ui/oojs-ui-widgets.js
M lib/oojs/oojs.jquery.js
M lib/rangefix/rangefix.js
M lib/unicodejs/unicodejs.js
M package.json
M src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
M src/ce/ve.ce.ClassAttributeNode.js
M src/ce/ve.ce.Surface.js
M src/ce/ve.ce.js
M src/dm/ve.dm.SourceSurfaceFragment.js
M src/dm/ve.dm.Transaction.js
M src/init/ve.init.SupportCheck.js
M src/ui/actions/ve.ui.LinkAction.js
M src/ui/actions/ve.ui.TableAction.js
M src/ui/dialogs/ve.ui.ProgressDialog.js
M src/ui/ve.ui.DataTransferHandlerFactory.js
M src/ui/ve.ui.DataTransferItem.js
M src/ui/ve.ui.DebugBar.js
M src/ve.Document.js
M src/ve.Filibuster.js
M src/ve.debug.js
M src/ve.utils.js
M tests/ce/ve.ce.Document.test.js
M tests/ce/ve.ce.test.js
M tests/dm/ve.dm.Transaction.test.js
M tests/dm/ve.dm.TransactionProcessor.test.js
M tests/ve.qunit.js
M tests/ve.test.js
M tests/ve.test.utils.js
36 files changed, 317 insertions(+), 55 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/96/307996/1
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..a719aa1
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,247 @@
+{
+ "extends": "wikimedia",
+ "env": {
+ "browser": true,
+ "jquery": true,
+ "qunit": true
+ },
+ "globals": {
+ "ve": true,
+ "VisualEditorSupportCheck": false,
+ "OO": false,
+ "unicodeJS": false,
+ "RangeFix": false,
+ "Papa": false
+ },
+ "rules": {
+ "accessor-pairs": "error",
+ "array-bracket-spacing": "off",
+ "array-callback-return": "off",
+ "arrow-body-style": "error",
+ "arrow-parens": "error",
+ "arrow-spacing": "error",
+ "block-scoped-var": "off",
+ "block-spacing": [
+ "error",
+ "always"
+ ],
+ "brace-style": "off",
+ "callback-return": "off",
+ "camelcase": "off",
+ "class-methods-use-this": "error",
+ "comma-dangle": "error",
+ "comma-spacing": "off",
+ "comma-style": "off",
+ "complexity": "off",
+ "computed-property-spacing": "off",
+ "consistent-return": "off",
+ "consistent-this": "off",
+ "curly": "off",
+ "default-case": "off",
+ "dot-location": [
+ "error",
+ "property"
+ ],
+ "dot-notation": "off",
+ "eol-last": "error",
+ "eqeqeq": "off",
+ "func-call-spacing": "off",
+ "func-names": "off",
+ "func-style": "off",
+ "generator-star-spacing": "error",
+ "guard-for-in": "off",
+ "handle-callback-err": "error",
+ "id-blacklist": "error",
+ "id-length": "off",
+ "id-match": "error",
+ "indent": "off",
+ "init-declarations": "off",
+ "jsx-quotes": "error",
+ "key-spacing": "off",
+ "keyword-spacing": "off",
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "lines-around-comment": "off",
+ "max-depth": "off",
+ "max-len": "off",
+ "max-lines": "off",
+ "max-nested-callbacks": "error",
+ "max-params": "off",
+ "max-statements": "off",
+ "max-statements-per-line": "off",
+ "multiline-ternary": "off",
+ "new-parens": "error",
+ "newline-after-var": "off",
+ "newline-before-return": "off",
+ "newline-per-chained-call": "off",
+ "no-alert": "error",
+ "no-array-constructor": "error",
+ "no-bitwise": "error",
+ "no-caller": "error",
+ "no-catch-shadow": "off",
+ "no-confusing-arrow": "error",
+ "no-constant-condition": [
+ "error",
+ {
+ "checkLoops": false
+ }
+ ],
+ "no-continue": "off",
+ "no-div-regex": "error",
+ "no-duplicate-imports": "error",
+ "no-else-return": "off",
+ "no-empty-function": "off",
+ "no-eq-null": "off",
+ "no-eval": "off",
+ "no-extend-native": "off",
+ "no-extra-bind": "error",
+ "no-extra-label": "error",
+ "no-extra-parens": "off",
+ "no-floating-decimal": "error",
+ "no-global-assign": "error",
+ "no-implicit-coercion": [
+ "error",
+ {
+ "boolean": false,
+ "number": false,
+ "string": false
+ }
+ ],
+ "no-implicit-globals": "off",
+ "no-implied-eval": "error",
+ "no-inline-comments": "off",
+ "no-inner-declarations": [
+ "error",
+ "functions"
+ ],
+ "no-invalid-this": "off",
+ "no-iterator": "error",
+ "no-label-var": "error",
+ "no-lone-blocks": "error",
+ "no-lonely-if": "off",
+ "no-loop-func": "off",
+ "no-magic-numbers": "off",
+ "no-mixed-operators": "off",
+ "no-multi-spaces": "off",
+ "no-multi-str": "error",
+ "no-multiple-empty-lines": "off",
+ "no-negated-condition": "off",
+ "no-nested-ternary": "off",
+ "no-new": "error",
+ "no-new-func": "off",
+ "no-new-object": "error",
+ "no-new-require": "error",
+ "no-new-wrappers": "error",
+ "no-octal-escape": "error",
+ "no-param-reassign": "off",
+ "no-path-concat": "error",
+ "no-plusplus": "off",
+ "no-process-env": "error",
+ "no-process-exit": "error",
+ "no-proto": "error",
+ "no-prototype-builtins": "off",
+ "no-restricted-globals": "error",
+ "no-restricted-imports": "error",
+ "no-restricted-modules": "error",
+ "no-restricted-syntax": "error",
+ "no-return-assign": "off",
+ "no-script-url": "error",
+ "no-self-compare": "off",
+ "no-sequences": "off",
+ "no-shadow": "off",
+ "no-shadow-restricted-names": "off",
+ "no-spaced-func": "off",
+ "no-sync": "error",
+ "no-tabs": "off",
+ "no-template-curly-in-string": "error",
+ "no-ternary": "off",
+ "no-throw-literal": "off",
+ "no-trailing-spaces": "off",
+ "no-undef-init": "error",
+ "no-undefined": "off",
+ "no-underscore-dangle": "off",
+ "no-unmodified-loop-condition": "off",
+ "no-unneeded-ternary": [
+ "error",
+ {
+ "defaultAssignment": true
+ }
+ ],
+ "no-unsafe-negation": "error",
+ "no-unused-expressions": "off",
+ "no-use-before-define": ["error", { "functions": false,
"classes": true }],
+ "no-useless-call": "off",
+ "no-useless-computed-key": "error",
+ "no-useless-concat": "off",
+ "no-useless-constructor": "error",
+ "no-useless-escape": "off",
+ "no-useless-rename": "error",
+ "no-var": "off",
+ "no-void": "off",
+ "no-warning-comments": "off",
+ "no-whitespace-before-property": "off",
+ "no-with": "error",
+ "object-curly-newline": "off",
+ "object-curly-spacing": "off",
+ "object-property-newline": [
+ "error",
+ {
+ "allowMultiplePropertiesPerLine": true
+ }
+ ],
+ "object-shorthand": "off",
+ "one-var": "off",
+ "one-var-declaration-per-line": "off",
+ "operator-assignment": "off",
+ "operator-linebreak": "off",
+ "padded-blocks": "off",
+ "prefer-arrow-callback": "off",
+ "prefer-const": "error",
+ "prefer-reflect": "off",
+ "prefer-rest-params": "off",
+ "prefer-spread": "off",
+ "prefer-template": "off",
+ "quote-props": "off",
+ "radix": "off",
+ "require-jsdoc": "off",
+ "rest-spread-spacing": "error",
+ "semi": "off",
+ "semi-spacing": "off",
+ "sort-imports": "error",
+ "sort-keys": "off",
+ "sort-vars": "off",
+ "space-before-blocks": "error",
+ "space-before-function-paren": "off",
+ "space-in-parens": "off",
+ "space-infix-ops": "off",
+ "space-unary-ops": "error",
+ "spaced-comment": ["error", "always", { "exceptions": ["*",
"!"] }],
+ "strict": "off",
+ "symbol-description": "error",
+ "template-curly-spacing": "error",
+ "unicode-bom": [
+ "error",
+ "never"
+ ],
+ "valid-jsdoc": "off",
+ "valid-typeof": [
+ "error",
+ {
+ "requireStringLiterals": false
+ }
+ ],
+ "vars-on-top": "off",
+ "wrap-iife": [
+ "error",
+ "any"
+ ],
+ "wrap-regex": "off",
+ "yield-star-spacing": "error",
+ "yoda": [
+ "error",
+ "never"
+ ]
+ }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
index fe79805..c570699 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -4,7 +4,8 @@
* @package VisualEditor
*/
-/*jshint node:true */
+/* jshint node:true */
+/* eslint-env node */
module.exports = function ( grunt ) {
var modules = grunt.file.readJSON( 'build/modules.json' ),
moduleUtils = require( './build/moduleUtils' ),
@@ -34,6 +35,7 @@
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-css-url-embed' );
grunt.loadNpmTasks( 'grunt-cssjanus' );
+ grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-jscs' );
grunt.loadNpmTasks( 'grunt-karma' );
grunt.loadNpmTasks( 'grunt-stylelint' );
@@ -263,6 +265,12 @@
},
main: '.'
},
+ eslint: {
+ dev: [
+ '*.js',
+ '{bin,build,demos,src,tests}/**/*.js'
+ ]
+ },
stylelint: {
all: [
'**/*.css',
@@ -275,6 +283,7 @@
},
jsonlint: {
all: [
+ '.eslintrc.json',
'**/*.json',
'!dist/**',
'!docs/**',
@@ -359,11 +368,13 @@
grunt.registerTask( 'ci', [ '_test', 'git-status' ] );
grunt.registerTask( 'watch', [ 'karma:bg:start', 'runwatch' ] );
+ /* eslint-disable no-process-env */
if ( process.env.JENKINS_HOME ) {
grunt.registerTask( 'test', 'ci' );
} else {
grunt.registerTask( 'test', '_test' );
}
+ /* eslint-enable no-process-env */
grunt.registerTask( 'default', 'test' );
};
diff --git a/build/moduleUtils.js b/build/moduleUtils.js
index 4c604a5..d9f6a89 100644
--- a/build/moduleUtils.js
+++ b/build/moduleUtils.js
@@ -4,7 +4,8 @@
* Code shared with the OOjs UI project
*/
-/*jshint node:true */
+/* eslint-env node */
+/* jshint node:true */
var self = module.exports = {
/**
diff --git a/build/tasks/buildloader.js b/build/tasks/buildloader.js
index 5ebcb1b..b6d68a7 100644
--- a/build/tasks/buildloader.js
+++ b/build/tasks/buildloader.js
@@ -2,7 +2,8 @@
* Build a static loader file from a template
*/
-/*jshint node:true */
+/* jshint node:true */
+/* eslint-env node */
module.exports = function ( grunt ) {
grunt.registerMultiTask( 'buildloader', function () {
diff --git a/build/tasks/git-build.js b/build/tasks/git-build.js
index 6c949b3..705a0cb 100644
--- a/build/tasks/git-build.js
+++ b/build/tasks/git-build.js
@@ -2,7 +2,8 @@
* Change the in-memory package version to contain the git HEAD
*/
-/*jshint node:true */
+/* eslint-env node */
+/* jshint node:true */
module.exports = function ( grunt ) {
grunt.registerTask( 'git-build', function () {
diff --git a/lib/jquery.client/jquery.client.js
b/lib/jquery.client/jquery.client.js
index 8257d85..0758277 100644
--- a/lib/jquery.client/jquery.client.js
+++ b/lib/jquery.client/jquery.client.js
@@ -42,7 +42,7 @@
* }
*/
profile: function ( nav ) {
- /*jshint boss:true */
+ /* jshint boss:true */
if ( nav === undefined ) {
nav = window.navigator;
@@ -255,7 +255,7 @@
* @return {boolean} The current browser is in the support map
*/
test: function ( map, profile, exactMatchOnly ) {
- /*jshint evil:true */
+ /* jshint evil:true */
var conditions, dir, i, op, val, j, pieceVersion,
pieceVal, compare;
profile = $.isPlainObject( profile ) ? profile :
$.client.profile();
diff --git a/lib/jquery.i18n/src/jquery.i18n.language.js
b/lib/jquery.i18n/src/jquery.i18n.language.js
index f83c473..0626294 100644
--- a/lib/jquery.i18n/src/jquery.i18n.language.js
+++ b/lib/jquery.i18n/src/jquery.i18n.language.js
@@ -394,7 +394,7 @@
* @param form {String}
* @return {String}
*/
- convertGrammar: function ( word, form ) { /*jshint unused:
false */
+ convertGrammar: function ( word, form ) { /* jshint unused:
false */
return word;
},
diff --git a/lib/oojs-ui/oojs-ui-widgets.js b/lib/oojs-ui/oojs-ui-widgets.js
index 7a38633..1b836f2 100644
--- a/lib/oojs-ui/oojs-ui-widgets.js
+++ b/lib/oojs-ui/oojs-ui-widgets.js
@@ -5166,11 +5166,11 @@
return false;
}
- /*jshint bitwise: false */
+ /* jshint bitwise: false */
if ( this.isInteger && ( n | 0 ) !== n ) {
return false;
}
- /*jshint bitwise: true */
+ /* jshint bitwise: true */
if ( n < this.min || n > this.max ) {
return false;
diff --git a/lib/oojs/oojs.jquery.js b/lib/oojs/oojs.jquery.js
index 3857f99..11bb909 100644
--- a/lib/oojs/oojs.jquery.js
+++ b/lib/oojs/oojs.jquery.js
@@ -314,7 +314,7 @@
right = arr.length;
while ( left < right ) {
// Equivalent to Math.floor( ( left + right ) / 2 ) but much
faster
- /*jshint bitwise:false */
+ /* jshint bitwise:false */
mid = ( left + right ) >> 1;
cmpResult = searchFunc( arr[ mid ] );
if ( cmpResult < 0 ) {
@@ -1528,7 +1528,7 @@
return obj;
};
-/*jshint node:true */
+/* jshint node:true */
if ( typeof module !== 'undefined' && module.exports ) {
module.exports = oo;
} else {
diff --git a/lib/rangefix/rangefix.js b/lib/rangefix/rangefix.js
index ad1cf7a..ec901c3 100644
--- a/lib/rangefix/rangefix.js
+++ b/lib/rangefix/rangefix.js
@@ -64,9 +64,9 @@
document.body.removeChild( p2 );
// Detect IE<=10
- /*jshint evil:true */
+ /* jshint evil:true */
jscriptVersion = window.ActiveXObject && new Function(
'/*@cc_on return @_jscript_version; @*/' )();
- /*jshint evil:false */
+ /* jshint evil:false */
broken.ieZoom = jscriptVersion && jscriptVersion <= 10;
}
return broken;
diff --git a/lib/unicodejs/unicodejs.js b/lib/unicodejs/unicodejs.js
index 80dcfc8..8a7feca 100644
--- a/lib/unicodejs/unicodejs.js
+++ b/lib/unicodejs/unicodejs.js
@@ -221,7 +221,7 @@
};
// Expose
- /*jshint browser:true */
+ /* jshint browser:true */
window.unicodeJS = unicodeJS;
}() );
diff --git a/package.json b/package.json
index 79ad061..169e507 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
}
],
"devDependencies": {
+ "eslint-config-wikimedia": "0.1.0",
"grunt": "1.0.1",
"grunt-banana-checker": "0.5.0",
"grunt-contrib-clean": "1.0.0",
@@ -30,6 +31,7 @@
"grunt-contrib-watch": "1.0.0",
"grunt-css-url-embed": "1.6.1",
"grunt-cssjanus": "0.3.2",
+ "grunt-eslint": "19.0.0",
"grunt-jscs": "2.8.0",
"grunt-jsonlint": "1.1.0",
"grunt-karma": "2.0.0",
diff --git a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
index f57abf6..83cb63d 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
@@ -4,6 +4,8 @@
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
+/* eslint-disable no-bitwise */
+
/**
* Arrow key down handler for linear selections.
*
@@ -52,7 +54,6 @@
direction = e.keyCode === OO.ui.Keys.DOWN ? 1 : -1;
} else {
directionality = $( surface.focusedBlockSlug ).css(
'direction' );
- /*jshint bitwise:false */
if ( e.keyCode === OO.ui.Keys.LEFT ^ directionality ===
'rtl' ) {
// leftarrow in ltr, or rightarrow in rtl
direction = -1;
@@ -78,7 +79,6 @@
direction = e.keyCode === OO.ui.Keys.DOWN ? 1 : -1;
} else {
directionality = surface.getFocusedNodeDirectionality();
- /*jshint bitwise:false */
if ( e.keyCode === OO.ui.Keys.LEFT ^ directionality ===
'rtl' ) {
// leftarrow in ltr, or rightarrow in rtl
direction = -1;
diff --git a/src/ce/ve.ce.ClassAttributeNode.js
b/src/ce/ve.ce.ClassAttributeNode.js
index 251c233..d53dddc 100644
--- a/src/ce/ve.ce.ClassAttributeNode.js
+++ b/src/ce/ve.ce.ClassAttributeNode.js
@@ -13,9 +13,7 @@
* @constructor
* @param {jQuery} [$classedElement=this.$element] Element to which
attribute-based classes are attached
*/
-ve.ce.ClassAttributeNode = function VeCeClassAttributeNode( $classedElement,
config ) {
- config = config || {};
-
+ve.ce.ClassAttributeNode = function VeCeClassAttributeNode( $classedElement ) {
// Properties
this.$classedElement = $classedElement || this.$element;
this.currentAttributeClasses = '';
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 058bb2f..8905384 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2665,7 +2665,7 @@
containsEnd = nodeRange.containsRange( new ve.Range(
coveringRange.end ) );
// If the range starts xor ends in the active node, but
not both, then it must
// span an active node boundary, so fixup.
- /*jshint bitwise: false*/
+ /* jshint bitwise: false*/
if ( containsStart ^ containsEnd ) {
newSelection = oldState && oldState.veRange ?
new ve.dm.LinearSelection( dmDoc,
oldState.veRange ) :
@@ -2676,7 +2676,7 @@
surface .showModelSelection();
} );
}
- /*jshint bitwise: true*/
+ /* jshint bitwise: true*/
}
// Support: Firefox
diff --git a/src/ce/ve.ce.js b/src/ce/ve.ce.js
index 44ed5ea..0a976a8 100644
--- a/src/ce/ve.ce.js
+++ b/src/ce/ve.ce.js
@@ -93,15 +93,13 @@
* @return {string} Hash of DOM element
*/
ve.ce.getDomHash = function ( element ) {
- var $element,
- nodeType = element.nodeType,
+ var nodeType = element.nodeType,
nodeName = element.nodeName,
hash = '';
if ( nodeType === Node.TEXT_NODE || nodeType ===
Node.CDATA_SECTION_NODE ) {
return '#';
} else if ( nodeType === Node.ELEMENT_NODE || nodeType ===
Node.DOCUMENT_NODE ) {
- $element = $( element );
if ( !(
element.classList.contains(
've-ce-branchNode-blockSlug' ) ||
element.classList.contains( 've-ce-cursorHolder' ) ||
diff --git a/src/dm/ve.dm.SourceSurfaceFragment.js
b/src/dm/ve.dm.SourceSurfaceFragment.js
index bedb7e3..0a817c6 100644
--- a/src/dm/ve.dm.SourceSurfaceFragment.js
+++ b/src/dm/ve.dm.SourceSurfaceFragment.js
@@ -76,8 +76,7 @@
* @inheritdoc
*/
ve.dm.SourceSurfaceFragment.prototype.insertDocument = function ( doc,
newDocRange ) {
- var conversionPromise,
- range = this.getSelection().getCoveringRange(),
+ var range = this.getSelection().getCoveringRange(),
fragment = this;
if ( !range ) {
@@ -90,7 +89,7 @@
return
ve.dm.SourceSurfaceFragment.super.prototype.insertContent.call( this,
doc.data.getDataSlice( newDocRange ) );
}
- conversionPromise = this.convertDocument( doc )
+ /* conversionPromise = */ this.convertDocument( doc )
.done( function ( source ) {
fragment.removeContent();
diff --git a/src/dm/ve.dm.Transaction.js b/src/dm/ve.dm.Transaction.js
index 2d37988..83e18e4 100644
--- a/src/dm/ve.dm.Transaction.js
+++ b/src/dm/ve.dm.Transaction.js
@@ -613,7 +613,7 @@
* @return {ve.dm.Transaction}
*/
ve.dm.Transaction.newFromWrap = function ( doc, range, unwrapOuter, wrapOuter,
unwrapEach, wrapEach ) {
- var i, j, unwrapOuterData, startOffset, unwrapEachData,
closingUnwrapEach, closingWrapEach,
+ var i, j, unwrapOuterData, startOffset, unwrapEachData, closingWrapEach,
tx = new ve.dm.Transaction( doc ),
depth = 0;
@@ -627,7 +627,7 @@
}
return closings;
}
- closingUnwrapEach = closingArray( unwrapEach );
+ /* closingUnwrapEach = */ closingArray( unwrapEach );
closingWrapEach = closingArray( wrapEach );
// TODO: check for and fix nesting validity like fixupInsertion does
diff --git a/src/init/ve.init.SupportCheck.js b/src/init/ve.init.SupportCheck.js
index c5dea5b..a8a7996 100644
--- a/src/init/ve.init.SupportCheck.js
+++ b/src/init/ve.init.SupportCheck.js
@@ -4,6 +4,8 @@
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
+/* eslint-ecmaVersion 3443 */
+
// jshint esversion: 3
( function () {
diff --git a/src/ui/actions/ve.ui.LinkAction.js
b/src/ui/actions/ve.ui.LinkAction.js
index c5bf917..a9fa71f 100644
--- a/src/ui/actions/ve.ui.LinkAction.js
+++ b/src/ui/actions/ve.ui.LinkAction.js
@@ -156,7 +156,7 @@
* A regular expression matching trailing punctuation which will be
* stripped from an autolink.
*/
-ve.ui.LinkAction.prototype.getTrailingPunctuation = function ( candidate ) {
+ve.ui.LinkAction.prototype.getTrailingPunctuation = function () {
/* jshint unused: false */
return /[,;.:!?)\]\}"'”’»]+$/;
};
diff --git a/src/ui/actions/ve.ui.TableAction.js
b/src/ui/actions/ve.ui.TableAction.js
index 0607ce8..19da8cd 100644
--- a/src/ui/actions/ve.ui.TableAction.js
+++ b/src/ui/actions/ve.ui.TableAction.js
@@ -853,7 +853,7 @@
);
// Remove all but start and end tags
rowData.splice( 1, rowData.length - 2 );
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
removedMatrix[ row - minIndex ] = {
row: rowData,
cells: cells.map( function ( cell ) {
diff --git a/src/ui/dialogs/ve.ui.ProgressDialog.js
b/src/ui/dialogs/ve.ui.ProgressDialog.js
index 2c4a6d7..ab1c101 100644
--- a/src/ui/dialogs/ve.ui.ProgressDialog.js
+++ b/src/ui/dialogs/ve.ui.ProgressDialog.js
@@ -89,7 +89,7 @@
)
);
progresses[ i ].progressBarDeferred.resolve(
progressBar, cancelDeferred.promise() );
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
progresses[ i ].progressCompletePromise.then(
this.progressComplete.bind( this, $row,
false ),
this.progressComplete.bind( this, $row,
true )
diff --git a/src/ui/ve.ui.DataTransferHandlerFactory.js
b/src/ui/ve.ui.DataTransferHandlerFactory.js
index a64302b..05e8c6a 100644
--- a/src/ui/ve.ui.DataTransferHandlerFactory.js
+++ b/src/ui/ve.ui.DataTransferHandlerFactory.js
@@ -133,7 +133,7 @@
// any component of the path is not present.
// This is similar to ve.getProp, except with a `hasOwnProperty`
// test to ensure we aren't fooled by __proto__ and friends.
- function fetch( obj /*, args...*/ ) {
+ function fetch( obj /* , args... */ ) {
var i;
for ( i = 1; i < arguments.length; i++ ) {
if (
diff --git a/src/ui/ve.ui.DataTransferItem.js b/src/ui/ve.ui.DataTransferItem.js
index d075553..ee7e807 100644
--- a/src/ui/ve.ui.DataTransferItem.js
+++ b/src/ui/ve.ui.DataTransferItem.js
@@ -95,6 +95,7 @@
for ( i = 0; i < binary.length; i++ ) {
array.push( binary.charCodeAt( i ) );
}
+ /* global Uint8Array */
this.blob = new Blob(
[ new Uint8Array( array ) ],
{ type: this.type }
diff --git a/src/ui/ve.ui.DebugBar.js b/src/ui/ve.ui.DebugBar.js
index 74c9187..0668a62 100644
--- a/src/ui/ve.ui.DebugBar.js
+++ b/src/ui/ve.ui.DebugBar.js
@@ -209,7 +209,7 @@
$label.html( ( text.match( /\S/ ) ? text : ' ' ) +
' ' );
if ( annotations ) {
$label.append(
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
$( '<span>' ).text(
'[' +
this.getSurface().getModel().getDocument().getStore().values( annotations
).map( function ( ann ) {
return JSON.stringify(
ann.getComparableObject() );
diff --git a/src/ve.Document.js b/src/ve.Document.js
index 8351e1d..8d54343 100644
--- a/src/ve.Document.js
+++ b/src/ve.Document.js
@@ -507,7 +507,7 @@
* - grandparent: parent's parent
*/
ve.Document.prototype.getCoveredSiblingGroups = function ( range ) {
- var i, firstCoveredSibling, lastCoveredSibling, node, parentNode,
siblingNode,
+ var i, firstCoveredSibling, node, parentNode, siblingNode,
leaves = this.selectNodes( range, 'leaves' ),
groups = [],
lastEndOffset = 0;
@@ -537,7 +537,6 @@
do {
// Add this to its sibling's group
groups[ groups.length - 1 ].nodes.push( siblingNode );
- lastCoveredSibling = siblingNode;
i++;
if ( leaves[ i ] === undefined ) {
break;
diff --git a/src/ve.Filibuster.js b/src/ve.Filibuster.js
index 77ce7ff..25c16b8 100644
--- a/src/ve.Filibuster.js
+++ b/src/ve.Filibuster.js
@@ -3,7 +3,7 @@
*
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
-/*global Set*/
+/* global Set */
/**
* A scrupulous event logger that logs state at every function call, and
diff --git a/src/ve.debug.js b/src/ve.debug.js
index aacc6c0..6641087 100644
--- a/src/ve.debug.js
+++ b/src/ve.debug.js
@@ -1,4 +1,4 @@
-/*global console */
+/* global console */
/*!
* VisualEditor debugging methods.
*
diff --git a/src/ve.utils.js b/src/ve.utils.js
index d59da58..66fd9c7 100644
--- a/src/ve.utils.js
+++ b/src/ve.utils.js
@@ -246,7 +246,7 @@
splice = Array.prototype.splice;
} else {
// Standard Array.prototype.splice() function
implemented using .slice() and .push().
- splice = function ( offset, remove/*, data... */ ) {
+ splice = function ( offset, remove /* , data... */ ) {
var data, begin, removed, end;
data = Array.prototype.slice.call( arguments, 2
);
@@ -1128,7 +1128,7 @@
for ( i = 0, len = maskAttrs.length; i < len; i++ ) {
fromAttr = unmask ? 'data-ve-' + maskAttrs[ i ] : maskAttrs[ i
];
toAttr = unmask ? maskAttrs[ i ] : 'data-ve-' + maskAttrs[ i ];
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
$( xmlDoc ).find( '[' + fromAttr + ']' ).each( function () {
var toAttrValue, fromAttrNormalized,
fromAttrValue = this.getAttribute( fromAttr );
diff --git a/tests/ce/ve.ce.Document.test.js b/tests/ce/ve.ce.Document.test.js
index 61c87da..a2c482b 100644
--- a/tests/ce/ve.ce.Document.test.js
+++ b/tests/ce/ve.ce.Document.test.js
@@ -44,8 +44,7 @@
// TODO: getDirectionFromRange
QUnit.test( 'getNodeAndOffset', function ( assert ) {
- var tests, i, iLen, test, parts, view, data, ceDoc, rootNode,
offsetCount, offset, position,
- j, jLen, node;
+ var tests, i, iLen, test, parts, view, data, ceDoc, rootNode,
offsetCount, offset,j, jLen, node;
// Each test below has the following:
// html: an input document
@@ -54,7 +53,7 @@
// characters on a modified HTML representation in which text nodes are
wrapped in
// <#text>...</#text> tags (and most attributes are omitted)
// dies (optional): a list of DM offsets where getNodeAndOffset is
expected to die
- /*jscs:disable validateQuoteMarks */
+ /* eslint-disable quotes */
tests = [
{
title: 'Simple para',
@@ -113,8 +112,7 @@
positions: "<div class='ve-ce-branchNode
ve-ce-documentNode'>|<p class='ve-ce-branchNode ve-ce-contentBranchNode
ve-ce-paragraphNode'>|<span class='ve-ce-branchNode-slug
ve-ce-branchNode-inlineSlug'></span><span class='ve-ce-focusableNode
ve-ce-leafNode'><#text>|Foo</#text></span>|<span class='ve-ce-branchNode-slug
ve-ce-branchNode-inlineSlug'></span><span class='ve-ce-focusableNode
ve-ce-leafNode'><#text>|Bar</#text></span>|<span class='ve-ce-branchNode-slug
ve-ce-branchNode-inlineSlug'></span></p></div>"
}
];
-
- /*jscs:enable validateQuoteMarks */
+ /* eslint-enable quotes */
QUnit.expect( tests.reduce( function ( total, test ) {
return total + test.positions.replace( /[^|]/g, '' ).length + 2;
@@ -163,7 +161,7 @@
for ( offset = 0; offset < offsetCount; offset++ ) {
try {
- position = ceDoc.getNodeAndOffset( offset,
test.outsideNails );
+ /* position = */ ceDoc.getNodeAndOffset(
offset, test.outsideNails );
if ( test.dies && test.dies.indexOf( offset )
!== -1 ) {
assert.ok( false, test.title + ' (' +
offset + ') does not die' );
continue;
@@ -176,7 +174,7 @@
continue;
}
- position = ceDoc.getNodeAndOffset( offset,
test.outsideNails );
+ /* position = */ ceDoc.getNodeAndOffset( offset,
test.outsideNails );
assert.strictEqual(
ve.test.utils.serializePosition(
rootNode,
diff --git a/tests/ce/ve.ce.test.js b/tests/ce/ve.ce.test.js
index 6cdc0ed..2f65ba2 100644
--- a/tests/ce/ve.ce.test.js
+++ b/tests/ce/ve.ce.test.js
@@ -82,7 +82,7 @@
} );
QUnit.test( 'getOffset', function ( assert ) {
- var i, view, documentModel, documentView,
+ var i, view, documentView,
expected = 0,
testCases = [
{
@@ -260,7 +260,7 @@
for ( i = 0; i < testCases.length; i++ ) {
view = ve.test.utils.createSurfaceViewFromHtml( testCases[ i
].html );
- documentModel = view.getModel().getDocument();
+ /* documentModel = */ view.getModel().getDocument();
documentView = view.getDocument();
testOffsets( documentView.getDocumentNode().$element[ 0 ],
testCases[ i ], -1 );
diff --git a/tests/dm/ve.dm.Transaction.test.js
b/tests/dm/ve.dm.Transaction.test.js
index c450bee..2d73aab 100644
--- a/tests/dm/ve.dm.Transaction.test.js
+++ b/tests/dm/ve.dm.Transaction.test.js
@@ -35,7 +35,7 @@
);
}
} else if ( cases[ msg ].exception ) {
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
assert.throws( function () {
constructor.apply(
ve.dm.Transaction, cases[ msg ].args
diff --git a/tests/dm/ve.dm.TransactionProcessor.test.js
b/tests/dm/ve.dm.TransactionProcessor.test.js
index bbd136a..d1d6a8b 100644
--- a/tests/dm/ve.dm.TransactionProcessor.test.js
+++ b/tests/dm/ve.dm.TransactionProcessor.test.js
@@ -722,7 +722,7 @@
'rollback (tree): ' + msg
);
} else if ( 'exception' in cases[ msg ] ) {
- /*jshint loopfunc:true */
+ /* jshint loopfunc:true */
assert.throws(
function () {
testDoc.commit( tx );
diff --git a/tests/ve.qunit.js b/tests/ve.qunit.js
index eb0620c..3ef3d54 100644
--- a/tests/ve.qunit.js
+++ b/tests/ve.qunit.js
@@ -4,7 +4,7 @@
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
-/*global difflib,diffview */
+/* global difflib,diffview */
( function ( QUnit ) {
/**
diff --git a/tests/ve.test.js b/tests/ve.test.js
index da12aee..b0c2a82 100644
--- a/tests/ve.test.js
+++ b/tests/ve.test.js
@@ -691,6 +691,8 @@
ve.normalizeAttributeValue = oldNormalizeAttributeValue;
}
}
+
+ ve.isStyleAttributeBroken = wasStyleAttributeBroken;
} );
QUnit.test( 'normalizeNode', function ( assert ) {
diff --git a/tests/ve.test.utils.js b/tests/ve.test.utils.js
index 383980f..4dab442 100644
--- a/tests/ve.test.utils.js
+++ b/tests/ve.test.utils.js
@@ -5,13 +5,15 @@
*/
( function () {
- /*jshint browser:true */
+ /* jshint browser:true */
// Create a standalone platform and target so ve.init.platform/target
are available
- /*jshint nonew:false */
+ /* eslint-disable no-new */
+ /* jshint nonew:false */
new ve.init.sa.Platform();
new ve.init.sa.Target();
- /*jshint nonew:true */
+ /* jshint nonew:true */
+ /* eslint-enable no-new */
// Disable scroll animatinos
ve.scrollIntoView = function () {};
--
To view, visit https://gerrit.wikimedia.org/r/307996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I42001fb086fb090ad9f154b691f4c104d76e60a2
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits