diff --git a/spiffworkflow-frontend/.eslintrc.cjs b/spiffworkflow-frontend/.eslintrc.cjs index 63c4dbdc..af6e220f 100644 --- a/spiffworkflow-frontend/.eslintrc.cjs +++ b/spiffworkflow-frontend/.eslintrc.cjs @@ -4,13 +4,14 @@ module.exports = { es2021: true, }, extends: [ - 'plugin:react/recommended', 'airbnb', - 'plugin:prettier/recommended', - 'plugin:sonarjs/recommended-legacy', 'plugin:import/errors', - 'plugin:import/warnings', 'plugin:import/typescript', + 'plugin:import/warnings', + 'plugin:prettier/recommended', + 'plugin:react-hooks/recommended', + 'plugin:react/recommended', + 'plugin:sonarjs/recommended-legacy', ], parser: '@typescript-eslint/parser', parserOptions: { @@ -20,7 +21,13 @@ module.exports = { ecmaVersion: 'latest', sourceType: 'module', }, - plugins: ['react', 'sonarjs', '@typescript-eslint', 'unused-imports'], + plugins: [ + '@typescript-eslint', + 'react', + 'react-hooks', + 'sonarjs', + 'unused-imports', + ], rules: { // according to https://github.com/typescript-eslint/typescript-eslint/issues/2621, You should turn off the eslint core rule and turn on the typescript-eslint rule // but not sure which of the above "extends" statements is maybe bringing in eslint core @@ -29,6 +36,8 @@ module.exports = { '@typescript-eslint/no-shadow': ['error'], 'jest/expect-expect': 'off', 'react/jsx-no-bind': 'off', + // FIXME: turn this back on someday + 'react/jsx-key': 'off', 'jsx-a11y/no-autofocus': 'off', 'jsx-a11y/label-has-associated-control': 'off', 'no-console': 'off', @@ -70,4 +79,12 @@ module.exports = { ], curly: ['error', 'all'], }, + overrides: [ + { + files: ['**/*.test.ts', '**/*.test.tsx'], + env: { + jest: true, + }, + }, + ], }; diff --git a/spiffworkflow-frontend/package.json b/spiffworkflow-frontend/package.json index af38ce67..7261812a 100644 --- a/spiffworkflow-frontend/package.json +++ b/spiffworkflow-frontend/package.json @@ -71,14 +71,14 @@ } }, "scripts": { - "start": "VITE_VERSION_INFO='{\"version\":\"local\"}' vite", "build": "vite build", - "serve": "vite preview", - "test": "vitest run --coverage", + "eslint": "./node_modules/.bin/eslint src --ext .js,.jsx,.ts,.tsx", + "eslint:fix": "./node_modules/.bin/eslint --fix src --ext .js,.jsx,.ts,.tsx", "format": "prettier --write src/**/*.[tj]s{,x}", - "eslint": "./node_modules/.bin/eslint src", "lint": "npm run eslint && npm run typecheck", - "lint:fix": "./node_modules/.bin/eslint --fix src", + "serve": "vite preview", + "start": "VITE_VERSION_INFO='{\"version\":\"local\"}' vite", + "test": "vitest run --coverage", "typecheck": "./node_modules/.bin/tsc --noEmit" }, "eslintConfig": { diff --git a/spiffworkflow-frontend/src/components/CustomForm.tsx b/spiffworkflow-frontend/src/components/CustomForm.tsx index dd1dc05d..1ec35e8b 100644 --- a/spiffworkflow-frontend/src/components/CustomForm.tsx +++ b/spiffworkflow-frontend/src/components/CustomForm.tsx @@ -269,7 +269,7 @@ export default function CustomForm({ propertyKey: string, errors: any, _jsonSchema: any, - _uiSchemaPassedIn?: any + _uiSchemaPassedIn?: any, ) => { if (propertyKey in formDataToCheck) { try { @@ -426,14 +426,14 @@ export default function CustomForm({ if ( currentUiSchema && 'ui:options' in currentUiSchema && - currentUiSchema['ui:options']['validateJson'] === true + currentUiSchema['ui:options'].validateJson === true ) { checkJsonField( formDataToCheck, propertyKey, errors, jsonSchemaToUse, - currentUiSchema + currentUiSchema, ); } diff --git a/spiffworkflow-frontend/src/components/ExtensionUxElementForDisplay.tsx b/spiffworkflow-frontend/src/components/ExtensionUxElementForDisplay.tsx index ba55ba06..a5615c7b 100644 --- a/spiffworkflow-frontend/src/components/ExtensionUxElementForDisplay.tsx +++ b/spiffworkflow-frontend/src/components/ExtensionUxElementForDisplay.tsx @@ -38,5 +38,6 @@ export default function ExtensionUxElementForDisplay( if (result === null) { return null; } + // eslint-disable-next-line react/jsx-no-useless-fragment return <>{result}; } diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTableWithFilters.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTableWithFilters.tsx index ba986f36..5126c5a6 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTableWithFilters.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTableWithFilters.tsx @@ -1002,6 +1002,7 @@ export default function ProcessInstanceListTableWithFilters({ { if (showReports) { - const columns = [ - - - , - ]; return ( - {columns} + + + ); } diff --git a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx index e9b23f40..25282a81 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx @@ -259,6 +259,7 @@ export default function ProcessModelForm({ const textInputs = [ { diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 6538e325..9d5a765d 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -6,7 +6,8 @@ import { BpmnPropertiesProviderModule, // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'bpmn... RemoFve this comment to see the full error message } from 'bpmn-js-properties-panel'; -import CliModule from 'bpmn-js-cli'; +// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'bpmn... RemoFve this comment to see the full error message +import CliModule from 'bpmn-js-cli'; // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'dmn-... Remove this comment to see the full error message import DmnModeler from 'dmn-js/lib/Modeler'; @@ -251,7 +252,7 @@ export default function ReactDiagramEditor({ CliModule, ], cli: { - bindTo: 'cli' + bindTo: 'cli', }, moddleExtensions: { spiffworkflow: spiffModdleExtension, @@ -621,7 +622,7 @@ export default function ReactDiagramEditor({ return undefined; } let newDiagramFileName = 'new_bpmn_diagram.bpmn'; - let textHandler = undefined; + let textHandler; if (diagramType === 'dmn') { newDiagramFileName = 'new_dmn_diagram.dmn'; textHandler = dmnTextHandler; @@ -702,7 +703,7 @@ export default function ReactDiagramEditor({ > {callers.map((ref: ProcessReference) => ( -
  • +
  • { - return ( - array1.length === array2.length && - array1.every((value, index) => value === array2[index]) - ); -}; - export const getPropertiesForMessage = ( messageId: string, processGroup: ProcessGroup, diff --git a/spiffworkflow-frontend/src/components/messages/MessageModelList.tsx b/spiffworkflow-frontend/src/components/messages/MessageModelList.tsx index 5768701d..7f1311b3 100644 --- a/spiffworkflow-frontend/src/components/messages/MessageModelList.tsx +++ b/spiffworkflow-frontend/src/components/messages/MessageModelList.tsx @@ -29,7 +29,7 @@ export default function MessageModelList({ processGroupId }: OwnProps) { let modifiedProcessIdentifierForPathParam = ''; if (processGroupId) { modifiedProcessIdentifierForPathParam = `/${modifyProcessIdentifierForPathParam( - processGroupId + processGroupId, )}`; } @@ -64,7 +64,7 @@ export default function MessageModelList({ processGroupId }: OwnProps) { {row.relative_location} diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 6dcc7f8c..631bd6b3 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -314,4 +314,3 @@ export const renderElementsForArray = (elements: ElementForArray[]) => {
    {element.component}
    )); }; - diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx index ad401c7d..94e8d84e 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx @@ -1,5 +1,6 @@ import React, { useCallback } from 'react'; import { DatePickerInput, DatePicker } from '@carbon/react'; +import { useDebouncedCallback } from 'use-debounce'; import { DATE_FORMAT_CARBON, DATE_FORMAT_FOR_DISPLAY, @@ -7,7 +8,6 @@ import { } from '../../../config'; import { getCommonAttributes } from '../../helpers'; import DateAndTimeService from '../../../services/DateAndTimeService'; -import { useDebouncedCallback } from 'use-debounce'; interface widgetArgs { id: string; @@ -88,6 +88,7 @@ export default function DateRangePickerWidget({ const addDebouncedOnChangeDate = useDebouncedCallback( (fullObject: React.ChangeEvent) => { + // eslint-disable-next-line no-param-reassign fullObject.target.value = DateAndTimeService.attemptToConvertUnknownDateStringFormatToKnownFormat( fullObject.target.value,