build: Update eslint, stylelint

Whitespace and regex escaping fixes

Change-Id: Ic706dfd3ed7efb16db104b054091bec0ba0cb5ed
This commit is contained in:
Ed Sanders 2017-07-20 14:34:40 +01:00 committed by Jforrester
parent 95247b0aab
commit 410e442fd1
3 changed files with 33 additions and 32 deletions

View file

@ -5,10 +5,11 @@
"devDependencies": {
"eslint-config-wikimedia": "0.4.0",
"grunt": "1.0.1",
"grunt-banana-checker": "0.5.0",
"grunt-eslint": "19.0.0",
"grunt-banana-checker": "0.6.0",
"grunt-eslint": "20.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.7.0",
"grunt-stylelint": "0.8.0",
"stylelint": "7.8.0",
"stylelint-config-wikimedia": "0.4.1"
}
}

View file

@ -11,7 +11,7 @@
ok = stream.eatWhile( /[\d]/ ) && stream.eat( ';' );
}
} else {
ok = stream.eatWhile( /[\w\.\-:]/ ) && stream.eat( ';' );
ok = stream.eatWhile( /[\w.\-:]/ ) && stream.eat( ';' );
}
if ( ok ) {
mnemonicStyle += ' mw-mnemonic';
@ -120,7 +120,7 @@
function eatSectionHeader( count ) {
return function ( stream, state ) {
if ( stream.match( /[^&<\[\{~]+/ ) ) {
if ( stream.match( /[^&<[{~]+/ ) ) {
if ( stream.eol() ) {
stream.backUp( count );
state.tokenize = eatEnd( 'mw-section-header' );
@ -132,7 +132,7 @@
}
function inVariable( stream, state ) {
if ( stream.match( /[^\{\}\|]+/ ) ) {
if ( stream.match( /[^{}|]+/ ) ) {
return makeLocalStyle( 'mw-templatevariable-name', state );
}
if ( stream.eat( '|' ) ) {
@ -152,7 +152,7 @@
}
function inVariableDefault( stream, state ) {
if ( stream.match( /[^\{\}\[<\&~]+/ ) ) {
if ( stream.match( /[^{}[<&~]+/ ) ) {
return makeLocalStyle( 'mw-templatevariable', state );
}
if ( stream.match( '}}}' ) ) {
@ -163,7 +163,7 @@
}
function inParserFunctionName( stream, state ) {
if ( stream.match( /#?[^\:\}\{~]+/ ) ) { // FIXME: {{#name}} and {{uc}} are wrong, must have ':'
if ( stream.match( /#?[^:}{~]+/ ) ) { // FIXME: {{#name}} and {{uc}} are wrong, must have ':'
return makeLocalStyle( 'mw-parserfunction-name', state );
}
if ( stream.eat( ':' ) ) {
@ -178,7 +178,7 @@
}
function inParserFunctionArguments( stream, state ) {
if ( stream.match( /[^\|\}\{\[<\&~]+/ ) ) {
if ( stream.match( /[^|}{[<&~]+/ ) ) {
return makeLocalStyle( 'mw-parserfunction', state );
} else if ( stream.eat( '|' ) ) {
return makeLocalStyle( 'mw-parserfunction-delimiter', state );
@ -205,7 +205,7 @@
state.tokenize = state.stack.pop();
return;
}
if ( stream.match( /[\s\u00a0]*[^\s\u00a0\|\}<\{\&~]+/ ) ) {
if ( stream.match( /[\s\u00a0]*[^\s\u00a0|}<{&~]+/ ) ) {
state.tokenize = eatTemplatePageName( true );
return makeLocalStyle( 'mw-template-name mw-pagename', state );
} else if ( stream.eatSpace() ) {
@ -220,13 +220,13 @@
function eatTemplateArgument( expectArgName ) {
return function ( stream, state ) {
if ( expectArgName && stream.eatWhile( /[^=\|\}\{\[<\&~]/ ) ) {
if ( expectArgName && stream.eatWhile( /[^=|}{[<&~]/ ) ) {
if ( stream.eat( '=' ) ) {
state.tokenize = eatTemplateArgument( false );
return makeLocalStyle( 'mw-template-argument-name', state );
}
return makeLocalStyle( 'mw-template', state );
} else if ( stream.eatWhile( /[^\|\}\{\[<\&~]/ ) ) {
} else if ( stream.eatWhile( /[^|}{[<&~]/ ) ) {
return makeLocalStyle( 'mw-template', state );
} else if ( stream.eat( '|' ) ) {
state.tokenize = eatTemplateArgument( true );
@ -271,7 +271,7 @@
state.tokenize = inExternalLinkText;
return makeStyle( '', state );
}
if ( stream.match( /[^\s\u00a0\]\{\&~']+/ ) || stream.eatSpace() ) {
if ( stream.match( /[^\s\u00a0\]{&~']+/ ) || stream.eatSpace() ) {
if ( stream.peek() === '\'' ) {
if ( stream.match( '\'\'', false ) ) {
state.tokenize = inExternalLinkText;
@ -295,7 +295,7 @@
state.tokenize = state.stack.pop();
return makeLocalStyle( 'mw-extlink-bracket', state, 'nLink' );
}
if ( stream.match( /[^'\]\{\&~]+/ ) ) {
if ( stream.match( /[^'\]{&~]+/ ) ) {
return makeStyle( 'mw-extlink-text', state );
}
return eatWikiText( 'mw-extlink-text', '' )( stream, state );
@ -323,7 +323,7 @@
// state.ImInBlock.push( 'LinkTrail' );
// }
}
if ( stream.match( /[\s\u00a0]*[^\s\u00a0#\|\]\&~\{]+/ ) || stream.eatSpace() ) { // FIXME '{{' brokes Link, sample [[z{{page]]
if ( stream.match( /[\s\u00a0]*[^\s\u00a0#|\]&~{]+/ ) || stream.eatSpace() ) { // FIXME '{{' brokes Link, sample [[z{{page]]
return makeStyle( 'mw-link-pagename mw-pagename', state );
}
return eatWikiText( 'mw-link-pagename mw-pagename', 'mw-pagename' )( stream, state );
@ -336,7 +336,7 @@
state.tokenize = state.stack.pop();
return;
}
if ( stream.match( /[^\|\]\&~\{\}]+/ ) ) { // FIXME '{{' brokes Link, sample [[z{{page]]
if ( stream.match( /[^|\]&~{}]+/ ) ) { // FIXME '{{' brokes Link, sample [[z{{page]]
return makeLocalStyle( 'mw-link-tosection', state );
}
if ( stream.eat( '|' ) ) {
@ -376,7 +376,7 @@
if ( linkIsItalic ) {
tmpstyle += ' em';
}
if ( stream.match( /[^'\]\{\&~]+/ ) ) {
if ( stream.match( /[^'\]{&~]+/ ) ) {
return makeStyle( tmpstyle, state );
}
return eatWikiText( tmpstyle, '' )( stream, state );
@ -421,7 +421,7 @@
function eatHtmlTagAttribute( name ) {
return function ( stream, state ) {
if ( stream.match( /[^>\/<\{\&~]+/ ) ) {
if ( stream.match( /[^>/<{&~]+/ ) ) {
return makeLocalStyle( 'mw-htmltag-attribute', state );
}
if ( stream.eat( '>' ) ) {
@ -439,7 +439,7 @@
function eatExtTagAttribute( name ) {
return function ( stream, state ) {
if ( stream.match( /[^>\/<\{\&~]+/ ) ) {
if ( stream.match( /[^>/<{&~]+/ ) ) {
return makeLocalStyle( 'mw-exttag-attribute mw-ext-' + name, state );
}
if ( stream.eat( '>' ) ) {
@ -533,7 +533,7 @@
}
function inTableCaption( stream, state ) {
if ( stream.sol() && stream.match( /[\s\u00a0]*[\|!]/, false ) ) {
if ( stream.sol() && stream.match( /[\s\u00a0]*[|!]/, false ) ) {
state.tokenize = inTable;
return inTable( stream, state );
}
@ -574,12 +574,12 @@
function eatTableRow( isStart, isHead ) {
return function ( stream, state ) {
if ( stream.sol() ) {
if ( stream.match( /[\s\u00a0]*[\|!]/, false ) ) {
if ( stream.match( /[\s\u00a0]*[|!]/, false ) ) {
state.tokenize = inTable;
return inTable( stream, state );
}
} else {
if ( stream.match( /[^'\|\{\[<\&~]+/ ) ) {
if ( stream.match( /[^'|{[<&~]+/ ) ) {
return makeStyle( ( isHead ? 'strong' : '' ), state );
}
if ( stream.match( '||' ) || isHead && stream.match( '!!' ) || ( isStart && stream.eat( '|' ) ) ) {
@ -604,7 +604,7 @@
function eatFreeExternalLink( stream, state ) {
if ( stream.eol() ) {
// @todo error message
} else if ( stream.match( /[^\s\u00a0\{\[\]<>~\)\.,']*/ ) ) {
} else if ( stream.match( /[^\s\u00a0{[\]<>~).,']*/ ) ) {
if ( stream.peek() === '~' ) {
if ( !stream.match( /~{3,}/, false ) ) {
stream.match( /~*/ );
@ -620,7 +620,7 @@
stream.next();
return makeLocalStyle( 'mw-free-extlink', state );
}
} else if ( stream.match( /[\)\.,]+(?=[^\s\u00a0\{\[\]<>~\)\.,])/ ) ) {
} else if ( stream.match( /[).,]+(?=[^\s\u00a0{[\]<>~).,])/ ) ) {
return makeLocalStyle( 'mw-free-extlink', state );
}
}
@ -663,7 +663,7 @@
break;
case '*':
case '#':
if ( stream.match( /[\*#]*:*/ ) ) {
if ( stream.match( /[*#]*:*/ ) ) {
return 'mw-list';
}
break;
@ -672,7 +672,7 @@
state.stack.push( state.tokenize );
state.tokenize = eatStartTable;
}
if ( stream.match( /:*[\*#]*/ ) ) {
if ( stream.match( /:*[*#]*/ ) ) {
return 'mw-indenting';
}
break;
@ -723,7 +723,7 @@
case '[':
if ( stream.eat( '[' ) ) { // Link Example: [[ Foo | Bar ]]
stream.eatSpace();
if ( /[^\]\|\[]/.test( stream.peek() ) ) {
if ( /[^\]|[]/.test( stream.peek() ) ) {
state.nLink++;
state.stack.push( state.tokenize );
state.tokenize = inLink;
@ -754,7 +754,7 @@
return makeLocalStyle( 'mw-parserfunction-bracket', state );
}
// Check for parser function without '#'
name = stream.match( /([^\s\u00a0\}\[\]<\{\'\|\&\:]+)(\:|[\s\u00a0]*)(\}\}?)?(.)?/ );
name = stream.match( /([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/ );
if ( name ) {
stream.backUp( name[ 0 ].length );
if ( ( name[ 2 ] === ':' || name[ 4 ] === undefined || name[ 3 ] === '}}' ) && ( name[ 1 ].toLowerCase() in mwConfig.functionSynonyms[ 0 ] || name[ 1 ] in mwConfig.functionSynonyms[ 1 ] ) ) {
@ -773,7 +773,7 @@
break;
case '<':
isCloseTag = !!stream.eat( '/' );
tagname = stream.match( /[^>\/\s\u00a0\.\*\,\[\]\{\}\$\^\+\?\|\/\\'`~<=!@#%&\(\)-]+/ );
tagname = stream.match( /[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/ );
if ( stream.match( '!--' ) ) { // comment
return chain( eatBlock( 'mw-comment', '-->' ) );
}
@ -818,7 +818,7 @@
}
break;
}
stream.match( /[^\s\u00a0_>\}\[\]<\{\'\|\&\:~]+/ );
stream.match( /[^\s\u00a0_>}[\]<{'|&:~]+/ );
return makeStyle( style, state );
};
}

View file

@ -61,8 +61,8 @@ ve.ui.CodeMirrorAction.prototype.toggle = function ( enable ) {
surfaceView.$documentNode.addClass(
'WebkitTextFillColor' in document.body.style ?
've-ce-documentNode-codeEditor-webkit-hide' :
've-ce-documentNode-codeEditor-webkit'
've-ce-documentNode-codeEditor-webkit-hide' :
've-ce-documentNode-codeEditor-webkit'
);
// As the action is regenerated each time, we need to store the bound listener