[BREAKING CHANGE] Drop support for ES5

For now, disable the no-var rule to avoid code changes.

Change-Id: Iedfac56c15c7763c491c44cdc789bf5a1d8a26de
这个提交包含在:
Ed Sanders 2023-04-12 14:43:41 +01:00
父节点 47be93405d
当前提交 da198ce3aa
共有 10 个文件被更改,包括 11 次插入21 次删除

查看文件

@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/client-es6",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck"
@ -11,7 +11,8 @@
"OO": "readonly"
},
"rules": {
"max-len": "off"
"max-len": "off",
"no-var": "off"
},
"plugins": [ "html" ],
"settings": {

查看文件

@ -1,11 +1,14 @@
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/client-es6",
"wikimedia/jquery"
],
"globals": {
"ve": "readonly",
"OO": "readonly"
},
"rules": {
"no-var": "off"
}
}

查看文件

@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/client-es6",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck"
@ -19,6 +19,7 @@
"no-jquery/no-extend": "error",
"no-jquery/no-html": [ "error", { "allowGetOrSet": "get" } ],
"no-jquery/no-visibility": "error",
"max-len": "off"
"max-len": "off",
"no-var": "off"
}
}

查看文件

@ -111,7 +111,6 @@ ve.dm.AnnotationSet.prototype.get = function ( offset ) {
if ( offset !== undefined ) {
return this.getStore().value( this.getHash( offset ) );
} else {
// eslint-disable-next-line no-restricted-syntax
return this.getStore().values( this.getHashes() );
}
};

查看文件

@ -604,7 +604,7 @@ ve.dm.Document.prototype.shallowCloneFromRange = function ( range ) {
);
}
// eslint-disable-next-line no-inner-declarations, es-x/no-block-scoped-functions
// eslint-disable-next-line no-inner-declarations
function nodeNeedsContext( node ) {
return node.getParentNodeTypes() !== null || node.isContent();
}

查看文件

@ -1,5 +1,3 @@
/* global Uint8Array */
/**
* Data transfer item wrapper
*
@ -96,7 +94,6 @@ ve.ui.DataTransferItem.prototype.getAsFile = function () {
array.push( binary.charCodeAt( i ) );
}
this.blob = new Blob(
// eslint-disable-next-line es-x/no-typed-arrays
[ new Uint8Array( array ) ],
{ type: this.type }
);

查看文件

@ -243,7 +243,6 @@ ve.ui.DebugBar.prototype.generateListFromLinearData = function ( linearData ) {
$chunk.append( $label );
if ( annotations ) {
$annotations = $( '<span>' ).addClass( 've-ui-debugBar-dump-note' ).text(
// eslint-disable-next-line no-restricted-syntax
'[' + this.getSurface().getModel().getDocument().getStore().values( annotations ).map( function ( ann ) {
return JSON.stringify( ann.getComparableObject() );
} ).join( ', ' ) + ']'

查看文件

@ -3,7 +3,6 @@
*
* @copyright 2011-2020 VisualEditor Team and others; see http://ve.mit-license.org
*/
/* global Set */
/**
* A scrupulous event logger that logs state at every function call, and
@ -466,7 +465,6 @@ ve.Filibuster.static.clonePlain = function ( val, seen ) {
var filibusterStatic = this;
if ( seen === undefined ) {
// eslint-disable-next-line es-x/no-set
seen = new Set();
}
if ( Array.isArray( val ) ) {
@ -497,7 +495,6 @@ ve.Filibuster.static.clonePlain = function ( val, seen ) {
return { 've.dm.Selection': val.getDescription() };
} else if ( val.constructor === ve.dm.AnnotationSet ) {
return {
// eslint-disable-next-line no-restricted-syntax
've.dm.AnnotationSet': val.getStore()
.values( val.getHashes() )
.map( function ( annotation ) {

查看文件

@ -4,8 +4,6 @@
* @copyright 2011-2020 VisualEditor Team and others; see http://ve.mit-license.org
*/
/* global Set */
( function () {
var freezeProxyHandler = {
set: function ( obj, name ) {
@ -16,7 +14,6 @@
}
};
// eslint-disable-next-line es-x/no-proxy, es-x/no-set
if ( !window.Proxy || !window.Set ) {
return;
}
@ -33,7 +30,6 @@
*/
ve.deepFreeze = deepFreeze = function ( object, onlyProperties, seen ) {
if ( !seen ) {
// eslint-disable-next-line es-x/no-set
seen = new Set();
seen.add( object );
}
@ -55,7 +51,6 @@
}
if ( !onlyProperties ) {
// eslint-disable-next-line es-x/no-proxy
object = new window.Proxy( object, freezeProxyHandler );
// Object#freeze isn't really necessary after proxying,
// but use it so we can detect frozen objects with Object.isFrozen.

查看文件

@ -1001,7 +1001,6 @@ ve.normalizeNode = function ( node ) {
p.appendChild( document.createTextNode( 'Foo' ) );
p.appendChild( document.createTextNode( 'Bar' ) );
p.appendChild( document.createTextNode( '' ) );
// eslint-disable-next-line es-x/no-string-prototype-normalize
p.normalize();
ve.isNormalizeBroken = p.childNodes.length !== 1;
}
@ -1029,7 +1028,6 @@ ve.normalizeNode = function ( node ) {
}
} else {
// Use native implementation
// eslint-disable-next-line es-x/no-string-prototype-normalize
node.normalize();
}
};