jenkins-bot has submitted this change and it was merged.
Change subject: build: Switch from jshint and jscs to eslint
......................................................................
build: Switch from jshint and jscs to eslint
Where lint exceptions have no equivalent rule in eslint,
they have been left in as a reminder that we need to find
replacements for those rules.
Change-Id: I42001fb086fb090ad9f154b691f4c104d76e60a2
---
A .eslintrc.json
D .jscsrc
D .jshintignore
D .jshintrc
M Gruntfile.js
M build/moduleUtils.js
M build/tasks/buildloader.js
M build/tasks/git-build.js
M demos/ve/ve.demo.init.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.TableCellableNode.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.FindAndReplaceDialog.js
M src/ui/dialogs/ve.ui.ProgressDialog.js
M src/ui/tools/ve.ui.FragmentWindowTool.js
M src/ui/ve.ui.DataTransferHandlerFactory.js
M src/ui/ve.ui.DataTransferItem.js
M src/ui/ve.ui.DebugBar.js
M src/ui/ve.ui.TabIndexScope.js
M src/ui/ve.ui.Trigger.js
M src/ui/widgets/ve.ui.AlignWidget.js
M src/ui/widgets/ve.ui.MediaSizeWidget.js
M src/ve.Document.js
M src/ve.EventSequencer.js
M src/ve.Filibuster.js
M src/ve.debug.js
M src/ve.utils.js
M tests/ce/imetests/input-chromium-ubuntu-ibus-japanese-mozc.js
M tests/ce/imetests/input-firefox-ubuntu-ibus-japanese-mozc.js
M tests/ce/ve.ce.Document.test.js
M tests/ce/ve.ce.Surface.test.js
M tests/ce/ve.ce.test.js
M tests/dm/lineardata/ve.dm.ElementLinearData.test.js
M tests/dm/ve.dm.SurfaceFragment.test.js
M tests/dm/ve.dm.Transaction.test.js
M tests/dm/ve.dm.TransactionProcessor.test.js
M tests/dm/ve.dm.example.js
M tests/ve.qunit.js
M tests/ve.test.js
M tests/ve.test.utils.js
48 files changed, 306 insertions(+), 353 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..23a927c
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,23 @@
+{
+ "extends": "wikimedia",
+ "env": {
+ "browser": true,
+ "jquery": true,
+ "qunit": true
+ },
+ "globals": {
+ "ve": true,
+ "VisualEditorSupportCheck": false,
+ "OO": false,
+ "unicodeJS": false,
+ "RangeFix": false,
+ "Papa": false
+ },
+ "rules": {
+ "dot-notation": 0,
+ "valid-jsdoc": 0,
+ "wrap-iife": 0,
+ "no-console": "error",
+ "spaced-comment": ["error", "always", { "exceptions": ["*",
"!"] }]
+ }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 592765f..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "preset": "wikimedia",
-
- "jsDoc": {
- "checkAnnotations": {
- "preset": "jsduck5",
- "extra": {
- "source": true,
- "see": true
- }
- },
- "checkParamNames": true,
- "checkRedundantAccess": true,
- "checkRedundantReturns": true,
- "checkTypes": "strictNativeCase",
- "requireNewlineAfterDescription": true,
- "requireParamTypes": true,
- "requireReturnTypes": true
- },
-
- "excludeFiles": [
- "coverage/**",
- "dist/**",
- "docs/**",
- "lib/**",
- "node_modules/**"
- ]
-}
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index e2d1bae..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,5 +0,0 @@
-coverage
-dist
-docs
-lib
-node_modules
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 49f49fb..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- // Enforcing
- "bitwise": true,
- "eqeqeq": true,
- "freeze": true,
- "latedef": "nofunc",
- "futurehostile": true,
- "noarg": true,
- "nonew": true,
- "undef": true,
- "unused": true,
-
- "strict": false,
-
- // Relaxing
-
- // Environment
- "browser": true,
- "jquery": true,
-
- "globals": {
- "OO": false,
- "QUnit": false,
- "unicodeJS": false,
- "RangeFix": false,
- "Papa": false,
- "ve": false,
- "VisualEditorSupportCheck": false
- }
-}
diff --git a/Gruntfile.js b/Gruntfile.js
index fe79805..d00027b 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -4,7 +4,7 @@
* @package VisualEditor
*/
-/*jshint node:true */
+/* eslint-env node */
module.exports = function ( grunt ) {
var modules = grunt.file.readJSON( 'build/modules.json' ),
moduleUtils = require( './build/moduleUtils' ),
@@ -30,11 +30,10 @@
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
- grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-css-url-embed' );
grunt.loadNpmTasks( 'grunt-cssjanus' );
- grunt.loadNpmTasks( 'grunt-jscs' );
+ grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-karma' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-tyops' );
@@ -248,20 +247,20 @@
'!.git/**'
]
},
- jshint: {
- options: {
- jshintrc: true
- },
- all: '.'
- },
- jscs: {
+ eslint: {
fix: {
options: {
fix: true
},
- src: '.'
+ src: [
+ '*.js',
+ '{bin,build,demos,src,tests}/**/*.js'
+ ]
},
- main: '.'
+ main: [
+ '*.js',
+ '{bin,build,demos,src,tests}/**/*.js'
+ ]
},
stylelint: {
all: [
@@ -275,6 +274,7 @@
},
jsonlint: {
all: [
+ '.eslintrc.json',
'**/*.json',
'!dist/**',
'!docs/**',
@@ -319,7 +319,7 @@
},
runwatch: {
files: [
- '.{stylelintrc,jscsrc,jshintignore,jshintrc}',
+ '.{stylelintrc,eslintrc.json}',
'**/*.js',
'!coverage/**',
'!dist/**',
@@ -352,18 +352,20 @@
} );
grunt.registerTask( 'build', [ 'clean', 'concat', 'cssjanus',
'cssUrlEmbed', 'copy', 'buildloader' ] );
- grunt.registerTask( 'lint', [ 'tyops', 'jshint', 'jscs:main',
'stylelint', 'jsonlint', 'banana' ] );
+ grunt.registerTask( 'lint', [ 'tyops', 'eslint:main', 'stylelint',
'jsonlint', 'banana' ] );
grunt.registerTask( 'unit', [ 'karma:main' ] );
- grunt.registerTask( 'fix', [ 'jscs:fix' ] );
+ grunt.registerTask( 'fix', [ 'eslint:fix' ] );
grunt.registerTask( '_test', [ 'lint', 'git-build', 'build', 'unit' ] );
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..eb1388a 100644
--- a/build/moduleUtils.js
+++ b/build/moduleUtils.js
@@ -4,8 +4,7 @@
* Code shared with the OOjs UI project
*/
-/*jshint node:true */
-
+/* eslint-env node */
var self = module.exports = {
/**
* Expand an array of file paths and variant-objects into
@@ -42,11 +41,11 @@
// (which will compile the less code) and the concat task
// (which will prepend intro.css without it being stripped
// like recess would).
- var targets = { default: [] };
+ var targets = { 'default': [] };
resources.forEach( function ( filepath ) {
var variant, buffer;
if ( typeof filepath !== 'object' ) {
- filepath = { default: filepath };
+ filepath = { 'default': filepath };
}
// Fetch copy of buffer before filepath/variant loop,
otherwise
// it can incorrectly include the default file in a
non-default variant.
diff --git a/build/tasks/buildloader.js b/build/tasks/buildloader.js
index 5ebcb1b..9fb752c 100644
--- a/build/tasks/buildloader.js
+++ b/build/tasks/buildloader.js
@@ -2,7 +2,7 @@
* Build a static loader file from a template
*/
-/*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..8f27e52 100644
--- a/build/tasks/git-build.js
+++ b/build/tasks/git-build.js
@@ -2,7 +2,7 @@
* Change the in-memory package version to contain the git HEAD
*/
-/*jshint node:true */
+/* eslint-env node */
module.exports = function ( grunt ) {
grunt.registerTask( 'git-build', function () {
diff --git a/demos/ve/ve.demo.init.js b/demos/ve/ve.demo.init.js
index 8c86aca..82c229f 100644
--- a/demos/ve/ve.demo.init.js
+++ b/demos/ve/ve.demo.init.js
@@ -58,10 +58,6 @@
location.href = location.href.replace( device, item.getData() );
} );
- addSurfaceContainerButton.on( 'click', function () {
- addSurfaceContainer();
- } );
-
messageKeyButton.on( 'click', function () {
languageInput.setLangAndDir( 'qqx', currentDir );
} );
@@ -141,6 +137,10 @@
target.$element.append( surfaceContainer.$element );
}
+ addSurfaceContainerButton.on( 'click', function () {
+ addSurfaceContainer();
+ } );
+
function createSurfacesFromHash( hash ) {
var i, pages = [];
if ( /^#!(?:pages|localStorage)\/.+$/.test( hash ) ) {
diff --git a/package.json b/package.json
index 79ad061..94b8294 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,7 +31,7 @@
"grunt-contrib-watch": "1.0.0",
"grunt-css-url-embed": "1.6.1",
"grunt-cssjanus": "0.3.2",
- "grunt-jscs": "2.8.0",
+ "grunt-eslint": "19.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-karma": "2.0.0",
"grunt-stylelint": "0.6.0",
diff --git a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
index f57abf6..6d1a7d1 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js
@@ -52,7 +52,7 @@
direction = e.keyCode === OO.ui.Keys.DOWN ? 1 : -1;
} else {
directionality = $( surface.focusedBlockSlug ).css(
'direction' );
- /*jshint bitwise:false */
+ // eslint-disable-next-line no-bitwise
if ( e.keyCode === OO.ui.Keys.LEFT ^ directionality ===
'rtl' ) {
// leftarrow in ltr, or rightarrow in rtl
direction = -1;
@@ -78,7 +78,7 @@
direction = e.keyCode === OO.ui.Keys.DOWN ? 1 : -1;
} else {
directionality = surface.getFocusedNodeDirectionality();
- /*jshint bitwise:false */
+ // eslint-disable-next-line no-bitwise
if ( e.keyCode === OO.ui.Keys.LEFT ^ directionality ===
'rtl' ) {
// leftarrow in ltr, or rightarrow in rtl
direction = -1;
@@ -109,6 +109,7 @@
// edge of the focusedNode in the direction of motion
(so the selection
// always grows). This means that clicking on the
focusableNode then
// modifying the selection will always include the node.
+ // eslint-disable-next-line no-bitwise
if ( direction === -1 ^ range.isBackwards() ) {
range = range.flip();
}
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 be8e88a..c5260c9 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -415,7 +415,7 @@
return this.selection;
};
-/*! Initialization */
+/* Initialization */
/**
* Initialize surface.
@@ -849,7 +849,7 @@
*/
ve.ce.Surface.prototype.onDocumentDragOver = function ( e ) {
var i, l, $target, $dropTarget, node, dropPosition, targetPosition,
targetOffset, top, left,
- nodeType, inIgnoreChildren, item, fakeItem,
+ nodeType, item, fakeItem,
dataTransferHandlerFactory =
this.getSurface().dataTransferHandlerFactory,
isContent = true,
dataTransfer = e.originalEvent.dataTransfer;
@@ -900,7 +900,6 @@
node = node.parent;
}
if ( node.parent ) {
- inIgnoreChildren = false;
node.parent.traverseUpstream( function ( n ) {
if ( n.shouldIgnoreChildren() ) {
node = null;
@@ -1474,12 +1473,11 @@
* @return {boolean} Whether unicorns have been destroyed
*/
ve.ce.Surface.prototype.cleanupUnicorns = function ( fixupCursor ) {
- var preUnicorn, postUnicorn, range, node, fixup, veRange;
+ var preUnicorn, range, node, fixup, veRange;
if ( !this.unicorningNode || !this.unicorningNode.unicorns ) {
return false;
}
preUnicorn = this.unicorningNode.unicorns[ 0 ];
- postUnicorn = this.unicorningNode.unicorns[ 1 ];
if ( !this.$documentNode[ 0 ].contains( preUnicorn ) ) {
return false;
}
@@ -1869,10 +1867,10 @@
*
* @param {jQuery.Event} e Paste event
*/
-ve.ce.Surface.prototype.afterPaste = function ( e ) {
+ve.ce.Surface.prototype.afterPaste = function () {
// jshint unused:false
- var clipboardKey, clipboardId, clipboardIndex, clipboardHash,
- $elements, parts, pasteData, slice, internalListRange,
+ var clipboardKey, clipboardHash,
+ $elements, pasteData, slice, internalListRange,
data, pastedDocumentModel, htmlDoc, $body, $images, i,
context, left, right, contextRange, pastedText, handled,
tableAction,
@@ -2369,7 +2367,7 @@
this.handleInsertion();
};
-/*! Custom Events */
+/* Custom Events */
/**
* Handle model select events.
@@ -2670,7 +2668,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*/
+ // eslint-disable-next-line no-bitwise
if ( containsStart ^ containsEnd ) {
newSelection = oldState && oldState.veRange ?
new ve.dm.LinearSelection( dmDoc,
oldState.veRange ) :
@@ -2681,7 +2679,6 @@
surface .showModelSelection();
} );
}
- /*jshint bitwise: true*/
}
// Support: Firefox
@@ -2892,7 +2889,7 @@
this.emit( 'position' );
}, 50 );
-/*! Relocation */
+/* Relocation */
/**
* Start a relocation action.
@@ -2938,7 +2935,7 @@
return this.activeNode;
};
-/*! Utilities */
+/* Utilities */
/**
* Store a state snapshot at a keydown event, to be used in an after-keydown
handler
@@ -3157,12 +3154,10 @@
* Handle insertion of content.
*/
ve.ce.Surface.prototype.handleInsertion = function () {
- var range, hasChanged,
+ var range,
surfaceModel = this.getModel(),
fragment = surfaceModel.getFragment(),
selection = this.getSelection();
-
- hasChanged = false;
if ( selection instanceof ve.ce.TableSelection ) {
// Collapse table selection to anchor cell
@@ -3193,7 +3188,6 @@
// DM is too granular to detect the selection change)
surfaceModel.setNullSelection();
fragment.removeContent().collapseToStart().select();
- hasChanged = true;
this.surfaceObserver.clear();
this.storeKeyDownState( this.keyDownState.event );
this.surfaceObserver.stopTimerLoop();
@@ -3557,7 +3551,7 @@
}
};
-/*! Getters */
+/* Getters */
/**
* Get the top-level surface.
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.TableCellableNode.js
b/src/dm/ve.dm.TableCellableNode.js
index dc6ba85..d35b40c 100644
--- a/src/dm/ve.dm.TableCellableNode.js
+++ b/src/dm/ve.dm.TableCellableNode.js
@@ -53,9 +53,9 @@
ve.dm.TableCellableNode.static.applyAttributes = function ( attributes,
domElement ) {
var spans = {
- colspan: attributes.colspan,
- rowspan: attributes.rowspan
- };
+ colspan: attributes.colspan,
+ rowspan: attributes.rowspan
+ };
// Ignore spans of 1 unless they were in the original HTML
if ( attributes.colspan === 1 && Number( attributes.originalColspan )
!== 1 ) {
diff --git a/src/dm/ve.dm.Transaction.js b/src/dm/ve.dm.Transaction.js
index 36c05a2..d79cce2 100644
--- a/src/dm/ve.dm.Transaction.js
+++ b/src/dm/ve.dm.Transaction.js
@@ -622,7 +622,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(),
depth = 0;
@@ -636,7 +636,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..f33c415 100644
--- a/src/init/ve.init.SupportCheck.js
+++ b/src/init/ve.init.SupportCheck.js
@@ -4,7 +4,7 @@
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
-// jshint esversion: 3
+/* eslint-ecmaVersion 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.FindAndReplaceDialog.js
b/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
index ebcb874..c13171d 100644
--- a/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
+++ b/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
@@ -116,13 +116,13 @@
} );
optionsGroup = new OO.ui.ButtonGroupWidget( {
- classes: [ 've-ui-findAndReplaceDialog-cell' ],
- items: [
- this.matchCaseToggle,
- this.regexToggle,
- this.wordToggle
- ]
- } );
+ classes: [ 've-ui-findAndReplaceDialog-cell' ],
+ items: [
+ this.matchCaseToggle,
+ this.regexToggle,
+ this.wordToggle
+ ]
+ } );
navigateGroup = new OO.ui.ButtonGroupWidget( {
classes: [ 've-ui-findAndReplaceDialog-cell' ],
items: [
diff --git a/src/ui/dialogs/ve.ui.ProgressDialog.js
b/src/ui/dialogs/ve.ui.ProgressDialog.js
index 92695a6..ee13bce 100644
--- a/src/ui/dialogs/ve.ui.ProgressDialog.js
+++ b/src/ui/dialogs/ve.ui.ProgressDialog.js
@@ -94,7 +94,7 @@
this.text.$element.append( $row );
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/tools/ve.ui.FragmentWindowTool.js
b/src/ui/tools/ve.ui.FragmentWindowTool.js
index 90684f1..0be47b1 100644
--- a/src/ui/tools/ve.ui.FragmentWindowTool.js
+++ b/src/ui/tools/ve.ui.FragmentWindowTool.js
@@ -60,7 +60,7 @@
// are open, which we override in this implementation
ve.ui.FragmentWindowTool.super.super.prototype.onUpdateState.apply(
this, arguments );
- models = this.getSelectedModels( fragment ) ;
+ models = this.getSelectedModels( fragment );
for ( i = 0, len = models.length; i < len; i++ ) {
if ( this.constructor.static.isCompatibleWith( models[ i ] ) ) {
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..944aa53 100644
--- a/src/ui/ve.ui.DataTransferItem.js
+++ b/src/ui/ve.ui.DataTransferItem.js
@@ -1,3 +1,5 @@
+/* global Uint8Array */
+
/**
* Data transfer item wrapper
*
diff --git a/src/ui/ve.ui.DebugBar.js b/src/ui/ve.ui.DebugBar.js
index 4bbc609..11a7f51 100644
--- a/src/ui/ve.ui.DebugBar.js
+++ b/src/ui/ve.ui.DebugBar.js
@@ -211,7 +211,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/ui/ve.ui.TabIndexScope.js b/src/ui/ve.ui.TabIndexScope.js
index a4651e0..51ac414 100644
--- a/src/ui/ve.ui.TabIndexScope.js
+++ b/src/ui/ve.ui.TabIndexScope.js
@@ -60,20 +60,20 @@
ve.ui.TabIndexScope.prototype.getElementsInRoot = function () {
var self = this,
elements = this.$root.find( '*' ).filter( function () {
- if ( this.tabIndex === -1 ) {
- // tabIndex -1 is focusable, but shouldn't appear to
keyboard-navigation
- return false;
- }
- if ( self.skipAriaDisabled && this.getAttribute(
'aria-disabled' ) === 'true' ) {
- return false;
- }
- if ( self.skipAriaHidden && $( this ).closest(
'[aria-hidden="true"]' ).length ) {
- return false;
- }
- return OO.ui.isFocusableElement( $( this ) );
- } ).map( function ( index ) {
- return { element: this, index: index };
- } ).get();
+ if ( this.tabIndex === -1 ) {
+ // tabIndex -1 is focusable, but shouldn't
appear to keyboard-navigation
+ return false;
+ }
+ if ( self.skipAriaDisabled && this.getAttribute(
'aria-disabled' ) === 'true' ) {
+ return false;
+ }
+ if ( self.skipAriaHidden && $( this ).closest(
'[aria-hidden="true"]' ).length ) {
+ return false;
+ }
+ return OO.ui.isFocusableElement( $( this ) );
+ } ).map( function ( index ) {
+ return { element: this, index: index };
+ } ).get();
elements.sort( function ( a, b ) {
if ( a.element.tabIndex < b.element.tabIndex ) {
return -1;
diff --git a/src/ui/ve.ui.Trigger.js b/src/ui/ve.ui.Trigger.js
index cf1c4f5..cfcf797 100644
--- a/src/ui/ve.ui.Trigger.js
+++ b/src/ui/ve.ui.Trigger.js
@@ -208,7 +208,7 @@
apple: 'meta',
windows: 'meta',
option: 'alt',
- return: 'enter',
+ 'return': 'enter',
// Shorthand
esc: 'escape',
cmd: 'meta',
diff --git a/src/ui/widgets/ve.ui.AlignWidget.js
b/src/ui/widgets/ve.ui.AlignWidget.js
index be54752..e7dae40 100644
--- a/src/ui/widgets/ve.ui.AlignWidget.js
+++ b/src/ui/widgets/ve.ui.AlignWidget.js
@@ -23,22 +23,22 @@
ve.ui.AlignWidget.super.call( this, config );
alignButtons = [
- new OO.ui.ButtonOptionWidget( {
- data: 'left',
- icon: 'alignLeft',
- label: ve.msg( 'visualeditor-align-widget-left'
)
- } ),
- new OO.ui.ButtonOptionWidget( {
- data: 'center',
- icon: 'alignCentre',
- label: ve.msg(
'visualeditor-align-widget-center' )
- } ),
- new OO.ui.ButtonOptionWidget( {
- data: 'right',
- icon: 'alignRight',
- label: ve.msg(
'visualeditor-align-widget-right' )
- } )
- ];
+ new OO.ui.ButtonOptionWidget( {
+ data: 'left',
+ icon: 'alignLeft',
+ label: ve.msg( 'visualeditor-align-widget-left' )
+ } ),
+ new OO.ui.ButtonOptionWidget( {
+ data: 'center',
+ icon: 'alignCentre',
+ label: ve.msg( 'visualeditor-align-widget-center' )
+ } ),
+ new OO.ui.ButtonOptionWidget( {
+ data: 'right',
+ icon: 'alignRight',
+ label: ve.msg( 'visualeditor-align-widget-right' )
+ } )
+ ];
if ( config.dir === 'rtl' ) {
alignButtons = alignButtons.reverse();
diff --git a/src/ui/widgets/ve.ui.MediaSizeWidget.js
b/src/ui/widgets/ve.ui.MediaSizeWidget.js
index c5a002a..d659eb9 100644
--- a/src/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/src/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -18,7 +18,7 @@
* @cfg {boolean} [noOriginalDimensions] The item being sized doesn't have
original dimensions
*/
ve.ui.MediaSizeWidget = function VeUiMediaSizeWidget( scalable, config ) {
- var fieldScale, fieldCustom, scalePercentLabel;
+ var fieldCustom;
// Configuration
config = config || {};
@@ -58,10 +58,10 @@
// Define scale
this.scaleInput = new OO.ui.TextInputWidget();
- scalePercentLabel = new OO.ui.LabelWidget( {
- input: this.scaleInput,
- label: ve.msg(
'visualeditor-mediasizewidget-label-scale-percent' )
- } );
+ // scalePercentLabel = new OO.ui.LabelWidget( {
+ // input: this.scaleInput,
+ // label: ve.msg(
'visualeditor-mediasizewidget-label-scale-percent' )
+ // } );
this.dimensionsWidget = new ve.ui.DimensionsWidget( { validate:
this.isValid.bind( this ) } );
@@ -72,14 +72,14 @@
} );
// Field layouts
- fieldScale = new OO.ui.FieldLayout(
- this.scaleInput, {
- align: 'right',
- // TODO: when upright is supported by Parsoid
- // classes: ['ve-ui-mediaSizeWidget-section-scale'],
- label: ve.msg(
'visualeditor-mediasizewidget-label-scale' )
- }
- );
+ // fieldScale = new OO.ui.FieldLayout(
+ // this.scaleInput, {
+ // align: 'right',
+ // // TODO: when upright is supported by Parsoid
+ // // classes: ['ve-ui-mediaSizeWidget-section-scale'],
+ // label: ve.msg(
'visualeditor-mediasizewidget-label-scale' )
+ // }
+ // );
// TODO: when upright is supported by Parsoid
// this.scaleInput.$element.append( scalePercentLabel.$element );
fieldCustom = new OO.ui.FieldLayout(
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.EventSequencer.js b/src/ve.EventSequencer.js
index c5f3179..caf413f 100644
--- a/src/ve.EventSequencer.js
+++ b/src/ve.EventSequencer.js
@@ -382,7 +382,8 @@
*/
ve.EventSequencer.prototype.runPendingCalls = function ( eventName ) {
var i, pendingCall,
- afterKeyDownCalls = [];
+ afterKeyDownCalls = [];
+
for ( i = 0; i < this.pendingCalls.length; i++ ) {
// Length cache not possible, as a pending call appends another
pending call.
// It's important that this list remains mutable, in the case
that this
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 cc0d092..f6c7b54 100644
--- a/src/ve.debug.js
+++ b/src/ve.debug.js
@@ -1,10 +1,11 @@
-/*global console */
/*!
* VisualEditor debugging methods.
*
* @copyright 2011-2016 VisualEditor Team and others; see
http://ve.mit-license.org
*/
+/* eslint-disable no-console */
+
/**
* @property {boolean} debug
* @member ve
diff --git a/src/ve.utils.js b/src/ve.utils.js
index 37d157c..82d0c96 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
);
@@ -776,7 +776,7 @@
'hr', 'button', 'canvas', 'center', 'col', 'colgroup', 'embed',
'map', 'object', 'pre', 'progress', 'video'
],
- void: [
+ 'void': [
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img',
'input', 'keygen', 'link', 'meta', 'param', 'source', 'track',
'wbr'
]
@@ -1182,7 +1182,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/imetests/input-chromium-ubuntu-ibus-japanese-mozc.js
b/tests/ce/imetests/input-chromium-ubuntu-ibus-japanese-mozc.js
index 989b4cc..012cbd0 100644
--- a/tests/ce/imetests/input-chromium-ubuntu-ibus-japanese-mozc.js
+++ b/tests/ce/imetests/input-chromium-ubuntu-ibus-japanese-mozc.js
@@ -77,4 +77,4 @@
{ seq: 68, time: 26.236, action: 'changeSel', args: [ 3, 3 ] },
{ seq: 69, time: 26.236, action: 'sendEvent', args: [ 'input', { } ] },
{ seq: 70, time: 26.242, action: 'endLoop', args: [] }
- ] ] );
+] ] );
diff --git a/tests/ce/imetests/input-firefox-ubuntu-ibus-japanese-mozc.js
b/tests/ce/imetests/input-firefox-ubuntu-ibus-japanese-mozc.js
index ce465ae..e7dd9d9 100644
--- a/tests/ce/imetests/input-firefox-ubuntu-ibus-japanese-mozc.js
+++ b/tests/ce/imetests/input-firefox-ubuntu-ibus-japanese-mozc.js
@@ -42,4 +42,4 @@
{ seq: 33, time: 11.913, action: 'endLoop', args: [] },
{ seq: 34, time: 12.027, action: 'sendEvent', args: [ 'keyup', {
keyCode: 13 } ] },
{ seq: 35, time: 12.03, action: 'endLoop', args: [] }
- ] ] );
+] ] );
diff --git a/tests/ce/ve.ce.Document.test.js b/tests/ce/ve.ce.Document.test.js
index 61c87da..737d43c 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,6 @@
for ( offset = 0; offset < offsetCount; offset++ ) {
try {
- 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 +173,6 @@
continue;
}
- position = ceDoc.getNodeAndOffset( offset,
test.outsideNails );
assert.strictEqual(
ve.test.utils.serializePosition(
rootNode,
diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js
index 9c28265..f4fffc0 100644
--- a/tests/ce/ve.ce.Surface.test.js
+++ b/tests/ce/ve.ce.Surface.test.js
@@ -1665,7 +1665,7 @@
pasteHtml: '<p>Bar</p>',
expectedRangeOrSelection: {
gecko: new ve.Range( 11 ),
- default: new ve.Range( 7 )
+ 'default': new ve.Range( 7 )
},
expectedOps: {
gecko: [
@@ -1685,7 +1685,7 @@
{ type: 'retain',
length: docLen - 4 }
]
],
- default: [
+ 'default': [
[
{ type: 'retain',
length: 4 },
{
@@ -1704,7 +1704,7 @@
pasteHtml: '<p>Bar</p>',
expectedRangeOrSelection: {
gecko: new ve.Range( 6 ),
- default: new ve.Range( 9 )
+ 'default': new ve.Range( 9 )
},
expectedOps: {
gecko: [
@@ -1722,7 +1722,7 @@
{ type: 'retain',
length: docLen - 7 }
]
],
- default: [
+ 'default': [
[
{ type: 'retain',
length: 6 },
{
@@ -1741,7 +1741,7 @@
pasteHtml: '<p>Bar</p>',
expectedRangeOrSelection: {
gecko: new ve.Range( 8 ),
- default: new ve.Range( 6 )
+ 'default': new ve.Range( 6 )
},
expectedOps: {
gecko: [
@@ -1759,7 +1759,7 @@
{ type: 'retain',
length: docLen - 3 }
]
],
- default: [
+ 'default': [
[
{ type: 'retain',
length: 3 },
{
@@ -1778,7 +1778,7 @@
pasteHtml: '<h2>Quux</h2>',
expectedRangeOrSelection: {
gecko: new ve.Range( 11 ),
- default: new ve.Range( 15 )
+ 'default': new ve.Range( 15 )
},
expectedOps: {
gecko: [
@@ -1796,7 +1796,7 @@
{ type: 'retain',
length: docLen - 12 }
]
],
- default: [
+ 'default': [
[
{ type: 'retain',
length: 11 },
{
diff --git a/tests/ce/ve.ce.test.js b/tests/ce/ve.ce.test.js
index 6cdc0ed..43aaffb 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,6 @@
for ( i = 0; i < testCases.length; i++ ) {
view = ve.test.utils.createSurfaceViewFromHtml( testCases[ i
].html );
- documentModel = view.getModel().getDocument();
documentView = view.getDocument();
testOffsets( documentView.getDocumentNode().$element[ 0 ],
testCases[ i ], -1 );
diff --git a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
index 1d30da4..eeac126 100644
--- a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
+++ b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
@@ -856,46 +856,47 @@
} );
QUnit.test( 'getRelativeOffset', function ( assert ) {
- var i, data, cases = [
- {
- msg: 'document without any valid offsets returns -1',
- offset: 0,
- distance: 1,
- data: [],
- callback: function () {
- return false;
+ var i, data,
+ cases = [
+ {
+ msg: 'document without any valid offsets
returns -1',
+ offset: 0,
+ distance: 1,
+ data: [],
+ callback: function () {
+ return false;
+ },
+ expected: -1
},
- expected: -1
- },
- {
- msg: 'document with all valid offsets returns offset +
distance',
- offset: 0,
- distance: 2,
- data: [ 'a', 'b' ],
- callback: function () {
- return true;
+ {
+ msg: 'document with all valid offsets returns
offset + distance',
+ offset: 0,
+ distance: 2,
+ data: [ 'a', 'b' ],
+ callback: function () {
+ return true;
+ },
+ expected: 2
},
- expected: 2
- },
- {
- msg: 'document with invalid offset inside an
ignoreChildren node throws',
- offset: 7,
- distance: 1,
- data: [
- 'a',
- { type: 'blockImage', attributes: {} },
- { type: 'imageCaption' },
- { type: 'paragraph', internal: { generated:
'wrapper' } },
- 'a', 'b', 'c',
- { type: '/paragraph' },
- { type: '/imageCaption' },
- { type: '/blockImage' },
- 'b'
- ],
- callback:
ve.dm.ElementLinearData.prototype.isContentOffset,
- exception: /offset was inside an ignoreChildren node/
- }
- ];
+ {
+ msg: 'document with invalid offset inside an
ignoreChildren node throws',
+ offset: 7,
+ distance: 1,
+ data: [
+ 'a',
+ { type: 'blockImage', attributes: {} },
+ { type: 'imageCaption' },
+ { type: 'paragraph', internal: {
generated: 'wrapper' } },
+ 'a', 'b', 'c',
+ { type: '/paragraph' },
+ { type: '/imageCaption' },
+ { type: '/blockImage' },
+ 'b'
+ ],
+ callback:
ve.dm.ElementLinearData.prototype.isContentOffset,
+ exception: /offset was inside an ignoreChildren
node/
+ }
+ ];
QUnit.expect( cases.length );
diff --git a/tests/dm/ve.dm.SurfaceFragment.test.js
b/tests/dm/ve.dm.SurfaceFragment.test.js
index dbd0adf..143a891 100644
--- a/tests/dm/ve.dm.SurfaceFragment.test.js
+++ b/tests/dm/ve.dm.SurfaceFragment.test.js
@@ -271,26 +271,27 @@
} );
QUnit.test( 'expandLinearSelection (word)', 1, function ( assert ) {
- var i, doc, surface, fragment, newFragment, range, word, cases = [
- {
- phrase: 'the quick brown fox',
- range: new ve.Range( 6, 13 ),
- expected: 'quick brown',
- msg: 'range starting and ending in latin words'
- },
- {
- phrase: 'the quick brown fox',
- range: new ve.Range( 18, 12 ),
- expected: 'brown fox',
- msg: 'backwards range starting and ending in latin
words'
- },
- {
- phrase: 'the quick brown fox',
- range: new ve.Range( 7 ),
- expected: 'quick',
- msg: 'zero-length range'
- }
- ];
+ var i, doc, surface, fragment, newFragment, range, word,
+ cases = [
+ {
+ phrase: 'the quick brown fox',
+ range: new ve.Range( 6, 13 ),
+ expected: 'quick brown',
+ msg: 'range starting and ending in latin words'
+ },
+ {
+ phrase: 'the quick brown fox',
+ range: new ve.Range( 18, 12 ),
+ expected: 'brown fox',
+ msg: 'backwards range starting and ending in
latin words'
+ },
+ {
+ phrase: 'the quick brown fox',
+ range: new ve.Range( 7 ),
+ expected: 'quick',
+ msg: 'zero-length range'
+ }
+ ];
QUnit.expect( cases.length * 2 );
for ( i = 0; i < cases.length; i++ ) {
doc = new ve.dm.Document( cases[ i ].phrase.split( '' ) );
diff --git a/tests/dm/ve.dm.Transaction.test.js
b/tests/dm/ve.dm.Transaction.test.js
index 8d1b295..6001f7e 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, args );
}, cases[ msg ].exception, msg + ': throw exception' );
diff --git a/tests/dm/ve.dm.TransactionProcessor.test.js
b/tests/dm/ve.dm.TransactionProcessor.test.js
index 1a8e99a..bada3b7 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/dm/ve.dm.example.js b/tests/dm/ve.dm.example.js
index e8fdb10..b4785db 100644
--- a/tests/dm/ve.dm.example.js
+++ b/tests/dm/ve.dm.example.js
@@ -158,10 +158,10 @@
ve.dm.example.annIndex = function ( tagName, text ) {
var ann = ve.copy( {
- b: ve.dm.example.bold,
- i: ve.dm.example.italic,
- u: ve.dm.example.underline
- }[ tagName ] );
+ b: ve.dm.example.bold,
+ i: ve.dm.example.italic,
+ u: ve.dm.example.underline
+ }[ tagName ] );
ann.originalDomElementsIndex =
ve.dm.IndexValueStore.prototype.indexOfValue( null, '<' + tagName + '>' + text
+ '</' + tagName + '>' );
return ve.dm.IndexValueStore.prototype.indexOfValue( ann );
diff --git a/tests/ve.qunit.js b/tests/ve.qunit.js
index eb0620c..f554ae0 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 ) {
/**
@@ -105,16 +105,16 @@
function unescapeText( s ) {
return s.replace( /&(#039|quot|lt|gt|amp);/g, function ( match,
seq ) {
switch ( seq ) {
- case '#039':
- return '\'';
- case 'quot':
- return '"';
- case 'lt':
- return '<';
- case 'gt':
- return '>';
- case 'amp':
- return '&';
+ case '#039':
+ return '\'';
+ case 'quot':
+ return '"';
+ case 'lt':
+ return '<';
+ case 'gt':
+ return '>';
+ case 'amp':
+ return '&';
}
} );
}
diff --git a/tests/ve.test.js b/tests/ve.test.js
index 3070b87..d9ecf8d 100644
--- a/tests/ve.test.js
+++ b/tests/ve.test.js
@@ -27,68 +27,69 @@
// ve.extendObject: Tested upstream (jQuery)
QUnit.test( 'compareClassLists', 1, function ( assert ) {
- var i, cases = [
- {
- args: [ '', '' ],
- expected: true
- },
- {
- args: [ '', [] ],
- expected: true
- },
- {
- args: [ [], [] ],
- expected: true
- },
- {
- args: [ '', [ '' ] ],
- expected: true
- },
- {
- args: [ [], [ '' ] ],
- expected: true
- },
- {
- args: [ 'foo', '' ],
- expected: false
- },
- {
- args: [ 'foo', 'foo' ],
- expected: true
- },
- {
- args: [ 'foo', 'bar' ],
- expected: false
- },
- {
- args: [ 'foo', 'foo bar' ],
- expected: false
- },
- {
- args: [ 'foo', [ 'foo' ] ],
- expected: true
- },
- {
- args: [ [ 'foo' ], 'bar' ],
- expected: false
- },
- {
- args: [ 'foo', [ 'foo', 'bar' ] ],
- expected: false
- },
- {
- args: [ 'foo', [ 'foo', 'foo' ] ],
- expected: true
- },
- {
- args: [ [ 'foo' ], 'foo foo' ],
- expected: true
- },
- {
- args: [ 'foo bar foo', 'foo foo' ],
- expected: false
- }
- ];
+ var i,
+ cases = [
+ {
+ args: [ '', '' ],
+ expected: true
+ },
+ {
+ args: [ '', [] ],
+ expected: true
+ },
+ {
+ args: [ [], [] ],
+ expected: true
+ },
+ {
+ args: [ '', [ '' ] ],
+ expected: true
+ },
+ {
+ args: [ [], [ '' ] ],
+ expected: true
+ },
+ {
+ args: [ 'foo', '' ],
+ expected: false
+ },
+ {
+ args: [ 'foo', 'foo' ],
+ expected: true
+ },
+ {
+ args: [ 'foo', 'bar' ],
+ expected: false
+ },
+ {
+ args: [ 'foo', 'foo bar' ],
+ expected: false
+ },
+ {
+ args: [ 'foo', [ 'foo' ] ],
+ expected: true
+ },
+ {
+ args: [ [ 'foo' ], 'bar' ],
+ expected: false
+ },
+ {
+ args: [ 'foo', [ 'foo', 'bar' ] ],
+ expected: false
+ },
+ {
+ args: [ 'foo', [ 'foo', 'foo' ] ],
+ expected: true
+ },
+ {
+ args: [ [ 'foo' ], 'foo foo' ],
+ expected: true
+ },
+ {
+ args: [ 'foo bar foo', 'foo foo' ],
+ expected: false
+ }
+ ];
QUnit.expect( cases.length );
for ( i = 0; i < cases.length; i++ ) {
@@ -295,7 +296,7 @@
);
}
tests = [
- /*jshint elision:true */
+ /* jshint elision:true */
// jscs:disable disallowTrailingComma
// jscs:disable disallowSpaceBeforeBinaryOperators
// arr, offset, remove, data, expectedReturn, expectedArray, msg
@@ -320,15 +321,15 @@
[ [ 4, , 5, , 6 ], 2, 3, [ 1, , 3 ], [ 5, , 6 ], [ 4, , 1, , 3
], 'diff=0 end' ]
// jscs:enable disallowSpaceBeforeBinaryOperators
// jscs:enable disallowTrailingComma
- /*jshint elision:false */
+ /* jshint elision:false */
];
QUnit.expect( 2 * tests.length + 1 );
assert.notDeepEqual(
- /*jshint elision:true */
+ /* jshint elision:true */
// jscs:disable disallowTrailingComma
mapToString( [ 1, , ] ),
// jscs:enable disallowTrailingComma
- /*jshint elision:false */
+ /* jshint elision:false */
mapToString( [ 1, undefined ] ),
'holes look different to undefined'
);
@@ -790,6 +791,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..4812066 100644
--- a/tests/ve.test.utils.js
+++ b/tests/ve.test.utils.js
@@ -5,13 +5,11 @@
*/
( function () {
- /*jshint browser:true */
-
// Create a standalone platform and target so ve.init.platform/target
are available
- /*jshint nonew:false */
+ /* eslint-disable no-new */
new ve.init.sa.Platform();
new ve.init.sa.Target();
- /*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: merged
Gerrit-Change-Id: I42001fb086fb090ad9f154b691f4c104d76e60a2
Gerrit-PatchSet: 6
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits