mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 13:56:44 +00:00
build: Update eslint-config-wikimedia to 0.27.0
Change-Id: I71646291ecf6ba22dd5a0e45f44ea54eacfa6bfc
This commit is contained in:
parent
ca6eb17ffe
commit
5c71833728
663
package-lock.json
generated
663
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -37,7 +37,7 @@
|
|||
"@wdio/spec-reporter": "7.29.1",
|
||||
"@wikimedia/mw-node-qunit": "7.2.0",
|
||||
"dotenv": "8.2.0",
|
||||
"eslint-config-wikimedia": "0.26.0",
|
||||
"eslint-config-wikimedia": "0.27.0",
|
||||
"grunt-banana-checker": "0.11.1",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
|
|
|
@ -8,6 +8,7 @@ const terser = require( '@rollup/plugin-terser' );
|
|||
/**
|
||||
* Mapping of import paths to ResourceLoader module names.
|
||||
* See usage in 'plugins' below for explanation.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
const importAliases = {
|
||||
|
|
|
@ -31,31 +31,37 @@ class CodeMirror {
|
|||
constructor( textarea ) {
|
||||
/**
|
||||
* The textarea that CodeMirror is bound to.
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.$textarea = $( textarea );
|
||||
/**
|
||||
* The editor user interface.
|
||||
*
|
||||
* @type {EditorView}
|
||||
*/
|
||||
this.view = null;
|
||||
/**
|
||||
* The editor state.
|
||||
*
|
||||
* @type {EditorState}
|
||||
*/
|
||||
this.state = null;
|
||||
/**
|
||||
* Whether the textarea is read-only.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.readOnly = this.$textarea.prop( 'readonly' );
|
||||
/**
|
||||
* The [edit recovery]{@link https://www.mediawiki.org/wiki/Manual:Edit_Recovery} handler.
|
||||
*
|
||||
* @type {Function|null}
|
||||
*/
|
||||
this.editRecoveryHandler = null;
|
||||
/**
|
||||
* jQuery.textSelection overrides for CodeMirror.
|
||||
*
|
||||
* @type {CodeMirrorTextSelection}
|
||||
*/
|
||||
this.textSelection = null;
|
||||
|
|
|
@ -6,6 +6,7 @@ import { mwModeConfig as modeConfig } from './codemirror.mode.mediawiki.config';
|
|||
|
||||
/**
|
||||
* Check if a SyntaxNode is a template bracket (`{{` or `}}`)
|
||||
*
|
||||
* @param {SyntaxNode} node The SyntaxNode to check
|
||||
* @return {boolean}
|
||||
* @private
|
||||
|
@ -13,6 +14,7 @@ import { mwModeConfig as modeConfig } from './codemirror.mode.mediawiki.config';
|
|||
const isBracket = ( node ) => node.name.split( '_' ).includes( modeConfig.tags.templateBracket ),
|
||||
/**
|
||||
* Check if a SyntaxNode is a template delimiter (`|`)
|
||||
*
|
||||
* @param {SyntaxNode} node The SyntaxNode to check
|
||||
* @return {boolean}
|
||||
* @private
|
||||
|
@ -20,6 +22,7 @@ const isBracket = ( node ) => node.name.split( '_' ).includes( modeConfig.tags.t
|
|||
isDelimiter = ( node ) => node.name.split( '_' ).includes( modeConfig.tags.templateDelimiter ),
|
||||
/**
|
||||
* Check if a SyntaxNode is part of a template, except for the brackets
|
||||
*
|
||||
* @param {SyntaxNode} node The SyntaxNode to check
|
||||
* @return {boolean}
|
||||
* @private
|
||||
|
@ -27,6 +30,7 @@ const isBracket = ( node ) => node.name.split( '_' ).includes( modeConfig.tags.t
|
|||
isTemplate = ( node ) => /-template[a-z\d-]+ground/u.test( node.name ) && !isBracket( node ),
|
||||
/**
|
||||
* Update the stack of opening (+) or closing (-) brackets
|
||||
*
|
||||
* @param {EditorState} state EditorState instance
|
||||
* @param {SyntaxNode} node The SyntaxNode of the bracket
|
||||
* @return {number}
|
||||
|
@ -36,6 +40,7 @@ const isBracket = ( node ) => node.name.split( '_' ).includes( modeConfig.tags.t
|
|||
|
||||
/**
|
||||
* If the node is a template, find the range of the template parameters
|
||||
*
|
||||
* @param {EditorState} state EditorState instance
|
||||
* @param {number|SyntaxNode} posOrNode Position or node
|
||||
* @param {Tree|null} [tree] Syntax tree
|
||||
|
@ -112,6 +117,7 @@ const foldable = ( state, posOrNode, tree ) => {
|
|||
|
||||
/**
|
||||
* Create a tooltip for folding a template
|
||||
*
|
||||
* @param {EditorState} state EditorState instance
|
||||
* @return {Tooltip|null}
|
||||
* @private
|
||||
|
|
|
@ -15,11 +15,13 @@ class CodeMirrorTextSelection {
|
|||
constructor( view ) {
|
||||
/**
|
||||
* The CodeMirror view.
|
||||
*
|
||||
* @type {EditorView}
|
||||
*/
|
||||
this.view = view;
|
||||
/**
|
||||
* The CodeMirror DOM.
|
||||
*
|
||||
* @type {jQuery}
|
||||
*/
|
||||
this.$cmDom = $( view.dom );
|
||||
|
|
|
@ -23,16 +23,19 @@ class CodeMirrorWikiEditor extends CodeMirror {
|
|||
super( $textarea );
|
||||
/**
|
||||
* Language support and its extension(s).
|
||||
*
|
||||
* @type {LanguageSupport|Extension}
|
||||
*/
|
||||
this.langExtension = langExtension;
|
||||
/**
|
||||
* Whether CodeMirror is currently enabled.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.useCodeMirror = mw.user.options.get( 'usecodemirror' ) > 0;
|
||||
/**
|
||||
* The [Realtime Preview](https://w.wiki/9XgX) handler.
|
||||
*
|
||||
* @type {Function|null}
|
||||
*/
|
||||
this.realtimePreviewHandler = null;
|
||||
|
|
Loading…
Reference in a new issue