From 7a159cec43550d103bf8706437a6c8d65d97e2db Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Mon, 21 Nov 2022 20:21:57 +0200 Subject: [PATCH] more linting --- .../defaultServices/PortalService/AbstractNodeView.js | 2 +- .../src/config/defaultServices/SchemaService/Mark.js | 1 - wax-prosemirror-core/src/utilities/lib/Tools.js | 4 ++-- .../EnterService/plugins/GetContentOnEnterPlugin.js | 5 ++--- .../src/EssayService/components/EditorComponent.js | 1 - .../EssayService/components/EssayAnswerComponent.js | 1 - .../EssayService/components/EssayQuestionComponent.js | 1 - .../src/ImageService/schema/imageNode.js | 1 - .../ListItemService/schema/listItemNode.js | 2 +- .../src/MatchingService/components/EditorComponent.js | 1 - .../src/MathService/BlockInputRule.js | 7 +++---- .../TrueFalseSingleCorrectQuestion.js | 1 - .../components/EditorComponent.js | 1 - .../components/QuestionEditorComponent.js | 1 - .../src/TablesService/components/InsertTableTool.js | 10 +--------- .../WaxToolGroups/OENLeftToolGroupService/OENTools.js | 2 +- 16 files changed, 11 insertions(+), 30 deletions(-) diff --git a/wax-prosemirror-core/src/config/defaultServices/PortalService/AbstractNodeView.js b/wax-prosemirror-core/src/config/defaultServices/PortalService/AbstractNodeView.js index c8ee404c6..92fd9234c 100644 --- a/wax-prosemirror-core/src/config/defaultServices/PortalService/AbstractNodeView.js +++ b/wax-prosemirror-core/src/config/defaultServices/PortalService/AbstractNodeView.js @@ -1,4 +1,3 @@ -/* eslint-disable class-methods-use-this */ import { v4 as uuidv4 } from 'uuid'; export default class AbstractNodeView { @@ -40,6 +39,7 @@ export default class AbstractNodeView { return innerView && innerView.dom.contains(event.target); } + // eslint-disable-next-line class-methods-use-this ignoreMutation() { return true; } diff --git a/wax-prosemirror-core/src/config/defaultServices/SchemaService/Mark.js b/wax-prosemirror-core/src/config/defaultServices/SchemaService/Mark.js index b1dc8d268..4c7c4bfe4 100644 --- a/wax-prosemirror-core/src/config/defaultServices/SchemaService/Mark.js +++ b/wax-prosemirror-core/src/config/defaultServices/SchemaService/Mark.js @@ -1,4 +1,3 @@ -/* eslint-disable no-underscore-dangle */ import { isPlainObject } from 'lodash'; import Middleware from '../../../utilities/lib/Middleware'; import ParseRule from './ParseRule'; diff --git a/wax-prosemirror-core/src/utilities/lib/Tools.js b/wax-prosemirror-core/src/utilities/lib/Tools.js index 6e6eb09c0..0d3490a3b 100644 --- a/wax-prosemirror-core/src/utilities/lib/Tools.js +++ b/wax-prosemirror-core/src/utilities/lib/Tools.js @@ -1,4 +1,4 @@ -/* eslint-disable */ +/* eslint-disable no-underscore-dangle */ import React from 'react'; import { v4 as uuidv4 } from 'uuid'; import { isEmpty } from 'lodash'; @@ -55,7 +55,7 @@ class Tools { if (isEmpty(view)) return null; return this._isDisplayed ? ( - <Button key={uuidv4()} item={this.toJSON()} view={view} /> + <Button item={this.toJSON()} key={uuidv4()} view={view} /> ) : null; } diff --git a/wax-prosemirror-services/src/EnterService/plugins/GetContentOnEnterPlugin.js b/wax-prosemirror-services/src/EnterService/plugins/GetContentOnEnterPlugin.js index 102844cdb..1573bde85 100644 --- a/wax-prosemirror-services/src/EnterService/plugins/GetContentOnEnterPlugin.js +++ b/wax-prosemirror-services/src/EnterService/plugins/GetContentOnEnterPlugin.js @@ -1,5 +1,4 @@ import { EditorState, Plugin, PluginKey } from 'prosemirror-state'; -// eslint-disable-next-line import/no-extraneous-dependencies import { DOMSerializer, DOMParser } from 'prosemirror-model'; const getContentOnEnterPlugin = new PluginKey('getContentOnEnterPlugin'); @@ -28,8 +27,8 @@ export default props => { return new Plugin({ key: getContentOnEnterPlugin, state: { - init: (_, state) => {}, - apply(tr, prev, _, newState) {}, + init: () => {}, + apply() {}, }, props: { handleKeyDown(view, event) { diff --git a/wax-prosemirror-services/src/EssayService/components/EditorComponent.js b/wax-prosemirror-services/src/EssayService/components/EditorComponent.js index 66112477a..02a97a207 100644 --- a/wax-prosemirror-services/src/EssayService/components/EditorComponent.js +++ b/wax-prosemirror-services/src/EssayService/components/EditorComponent.js @@ -72,7 +72,6 @@ const EditorComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/EssayService/components/EssayAnswerComponent.js b/wax-prosemirror-services/src/EssayService/components/EssayAnswerComponent.js index 3fcf806de..78ff4361c 100644 --- a/wax-prosemirror-services/src/EssayService/components/EssayAnswerComponent.js +++ b/wax-prosemirror-services/src/EssayService/components/EssayAnswerComponent.js @@ -103,7 +103,6 @@ const EssayAnswerComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/EssayService/components/EssayQuestionComponent.js b/wax-prosemirror-services/src/EssayService/components/EssayQuestionComponent.js index d5be00007..ce4b2c268 100644 --- a/wax-prosemirror-services/src/EssayService/components/EssayQuestionComponent.js +++ b/wax-prosemirror-services/src/EssayService/components/EssayQuestionComponent.js @@ -102,7 +102,6 @@ const EssayQuestionComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/ImageService/schema/imageNode.js b/wax-prosemirror-services/src/ImageService/schema/imageNode.js index 2dba4d90d..f009e4f13 100644 --- a/wax-prosemirror-services/src/ImageService/schema/imageNode.js +++ b/wax-prosemirror-services/src/ImageService/schema/imageNode.js @@ -1,5 +1,4 @@ // import { SchemaHelpers } from 'wax-prosemirror-core'; -import { isEmpty } from 'lodash'; const imageNode = { attrs: { diff --git a/wax-prosemirror-services/src/ListsService/ListItemService/schema/listItemNode.js b/wax-prosemirror-services/src/ListsService/ListItemService/schema/listItemNode.js index fefea9264..b8f382fa2 100644 --- a/wax-prosemirror-services/src/ListsService/ListItemService/schema/listItemNode.js +++ b/wax-prosemirror-services/src/ListsService/ListItemService/schema/listItemNode.js @@ -1,4 +1,3 @@ -/* eslint-disable camelcase */ import { SchemaHelpers } from 'wax-prosemirror-core'; const listItemNode = { @@ -22,6 +21,7 @@ const listItemNode = { if (hook.node.attrs.track && hook.node.attrs.track.length) { attrs['data-track'] = JSON.stringify(hook.node.attrs.track); } + // eslint-disable-next-line no-param-reassign hook.value = ['li', attrs, 0]; next(); }, diff --git a/wax-prosemirror-services/src/MatchingService/components/EditorComponent.js b/wax-prosemirror-services/src/MatchingService/components/EditorComponent.js index 3da67cf4d..6f2b08ca8 100644 --- a/wax-prosemirror-services/src/MatchingService/components/EditorComponent.js +++ b/wax-prosemirror-services/src/MatchingService/components/EditorComponent.js @@ -87,7 +87,6 @@ const EditorComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/MathService/BlockInputRule.js b/wax-prosemirror-services/src/MathService/BlockInputRule.js index 2ca7c9094..3c4f1d79c 100644 --- a/wax-prosemirror-services/src/MathService/BlockInputRule.js +++ b/wax-prosemirror-services/src/MathService/BlockInputRule.js @@ -1,11 +1,10 @@ -/* eslint-disable */ import { InputRule } from 'prosemirror-inputrules'; import { NodeSelection } from 'prosemirror-state'; const blockInputRule = (pattern, nodeType, getAttrs) => { return new InputRule(pattern, (state, match, start, end) => { - let $start = state.doc.resolve(start); - let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; + const $start = state.doc.resolve(start); + const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; if ( !$start @@ -14,7 +13,7 @@ const blockInputRule = (pattern, nodeType, getAttrs) => { ) return null; - let tr = state.tr + const tr = state.tr .delete(start, end) .setBlockType(start, start, nodeType, attrs); return tr.setSelection( diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js index d9cd55726..ce39f1988 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js @@ -61,7 +61,6 @@ class TrueFalseSingleCorrectQuestion extends Tools { renderTool(view) { if (isEmpty(view)) return null; - // eslint-disable-next-line no-underscore-dangle return this.isDisplayed() ? ( <ToolBarBtn item={this.toJSON()} key={uuidv4()} view={view} /> ) : null; diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/EditorComponent.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/EditorComponent.js index 7d257773f..59f95977f 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/EditorComponent.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/EditorComponent.js @@ -84,7 +84,6 @@ const EditorComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js index d7cb23c81..9ee99c9f7 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js @@ -118,7 +118,6 @@ const QuestionEditorComponent = ({ node, view, getPos }) => { const plugins = [keymap(createKeyBindings()), ...app.getPlugins()]; - // eslint-disable-next-line no-shadow const createPlaceholder = placeholder => { return Placeholder({ content: placeholder, diff --git a/wax-prosemirror-services/src/TablesService/components/InsertTableTool.js b/wax-prosemirror-services/src/TablesService/components/InsertTableTool.js index 9e85eaaf9..52197e38e 100644 --- a/wax-prosemirror-services/src/TablesService/components/InsertTableTool.js +++ b/wax-prosemirror-services/src/TablesService/components/InsertTableTool.js @@ -4,15 +4,7 @@ * TO DO -- Implement a gdocs-style CSS only solution to dramatically cut back on renders */ -/* eslint-disable react/jsx-handler-names */ -/* eslint-disable react/destructuring-assignment */ -/* eslint-disable react/no-find-dom-node */ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-plusplus */ -/* eslint-disable prefer-template */ -/* eslint-disable prefer-destructuring */ -/* eslint-disable max-classes-per-file */ -/* eslint-disable jsx-a11y/no-static-element-interactions */ +/* eslint-disable*/ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; diff --git a/wax-prosemirror-services/src/WaxToolGroups/OENLeftToolGroupService/OENTools.js b/wax-prosemirror-services/src/WaxToolGroups/OENLeftToolGroupService/OENTools.js index fe5c02cf3..5a30dc70c 100644 --- a/wax-prosemirror-services/src/WaxToolGroups/OENLeftToolGroupService/OENTools.js +++ b/wax-prosemirror-services/src/WaxToolGroups/OENLeftToolGroupService/OENTools.js @@ -1,4 +1,3 @@ -/* eslint-disable no-underscore-dangle */ import React, { useMemo } from 'react'; import { injectable, inject } from 'inversify'; import { isEmpty } from 'lodash'; @@ -49,6 +48,7 @@ class OENTools extends ToolGroup { disabled: false, component: ( <BlockLevelTools + // eslint-disable-next-line no-underscore-dangle groups={this._toolGroups[0].groups.map(group => ({ groupName: group.title === 'Custom Block' || group.title === 'OEN Containers' -- GitLab