mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-14 12:14:46 +00:00
updated configs so eslint and typecheck both run and return errors (#1704)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
eae5f7dd2d
commit
1f24842ec1
@ -4,13 +4,14 @@ module.exports = {
|
|||||||
es2021: true,
|
es2021: true,
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:react/recommended',
|
|
||||||
'airbnb',
|
'airbnb',
|
||||||
'plugin:prettier/recommended',
|
|
||||||
'plugin:sonarjs/recommended-legacy',
|
|
||||||
'plugin:import/errors',
|
'plugin:import/errors',
|
||||||
'plugin:import/warnings',
|
|
||||||
'plugin:import/typescript',
|
'plugin:import/typescript',
|
||||||
|
'plugin:import/warnings',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:react-hooks/recommended',
|
||||||
|
'plugin:react/recommended',
|
||||||
|
'plugin:sonarjs/recommended-legacy',
|
||||||
],
|
],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@ -20,7 +21,13 @@ module.exports = {
|
|||||||
ecmaVersion: 'latest',
|
ecmaVersion: 'latest',
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
plugins: ['react', 'sonarjs', '@typescript-eslint', 'unused-imports'],
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
'react',
|
||||||
|
'react-hooks',
|
||||||
|
'sonarjs',
|
||||||
|
'unused-imports',
|
||||||
|
],
|
||||||
rules: {
|
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
|
// 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
|
// 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'],
|
'@typescript-eslint/no-shadow': ['error'],
|
||||||
'jest/expect-expect': 'off',
|
'jest/expect-expect': 'off',
|
||||||
'react/jsx-no-bind': 'off',
|
'react/jsx-no-bind': 'off',
|
||||||
|
// FIXME: turn this back on someday
|
||||||
|
'react/jsx-key': 'off',
|
||||||
'jsx-a11y/no-autofocus': 'off',
|
'jsx-a11y/no-autofocus': 'off',
|
||||||
'jsx-a11y/label-has-associated-control': 'off',
|
'jsx-a11y/label-has-associated-control': 'off',
|
||||||
'no-console': 'off',
|
'no-console': 'off',
|
||||||
@ -70,4 +79,12 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
curly: ['error', 'all'],
|
curly: ['error', 'all'],
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*.test.ts', '**/*.test.tsx'],
|
||||||
|
env: {
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -71,14 +71,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "VITE_VERSION_INFO='{\"version\":\"local\"}' vite",
|
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"serve": "vite preview",
|
"eslint": "./node_modules/.bin/eslint src --ext .js,.jsx,.ts,.tsx",
|
||||||
"test": "vitest run --coverage",
|
"eslint:fix": "./node_modules/.bin/eslint --fix src --ext .js,.jsx,.ts,.tsx",
|
||||||
"format": "prettier --write src/**/*.[tj]s{,x}",
|
"format": "prettier --write src/**/*.[tj]s{,x}",
|
||||||
"eslint": "./node_modules/.bin/eslint src",
|
|
||||||
"lint": "npm run eslint && npm run typecheck",
|
"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"
|
"typecheck": "./node_modules/.bin/tsc --noEmit"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
@ -269,7 +269,7 @@ export default function CustomForm({
|
|||||||
propertyKey: string,
|
propertyKey: string,
|
||||||
errors: any,
|
errors: any,
|
||||||
_jsonSchema: any,
|
_jsonSchema: any,
|
||||||
_uiSchemaPassedIn?: any
|
_uiSchemaPassedIn?: any,
|
||||||
) => {
|
) => {
|
||||||
if (propertyKey in formDataToCheck) {
|
if (propertyKey in formDataToCheck) {
|
||||||
try {
|
try {
|
||||||
@ -426,14 +426,14 @@ export default function CustomForm({
|
|||||||
if (
|
if (
|
||||||
currentUiSchema &&
|
currentUiSchema &&
|
||||||
'ui:options' in currentUiSchema &&
|
'ui:options' in currentUiSchema &&
|
||||||
currentUiSchema['ui:options']['validateJson'] === true
|
currentUiSchema['ui:options'].validateJson === true
|
||||||
) {
|
) {
|
||||||
checkJsonField(
|
checkJsonField(
|
||||||
formDataToCheck,
|
formDataToCheck,
|
||||||
propertyKey,
|
propertyKey,
|
||||||
errors,
|
errors,
|
||||||
jsonSchemaToUse,
|
jsonSchemaToUse,
|
||||||
currentUiSchema
|
currentUiSchema,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,5 +38,6 @@ export default function ExtensionUxElementForDisplay(
|
|||||||
if (result === null) {
|
if (result === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
||||||
return <>{result}</>;
|
return <>{result}</>;
|
||||||
}
|
}
|
||||||
|
@ -1002,6 +1002,7 @@ export default function ProcessInstanceListTableWithFilters({
|
|||||||
<ComboBox
|
<ComboBox
|
||||||
onChange={updateReportColumn}
|
onChange={updateReportColumn}
|
||||||
id="report-column-selection"
|
id="report-column-selection"
|
||||||
|
key="report-column-selection"
|
||||||
data-qa="report-column-selection"
|
data-qa="report-column-selection"
|
||||||
data-modal-primary-focus
|
data-modal-primary-focus
|
||||||
items={availableReportColumns}
|
items={availableReportColumns}
|
||||||
@ -1021,6 +1022,7 @@ export default function ProcessInstanceListTableWithFilters({
|
|||||||
formElements.push([
|
formElements.push([
|
||||||
<TextInput
|
<TextInput
|
||||||
id="report-column-display-name"
|
id="report-column-display-name"
|
||||||
|
key="report-column-display-name"
|
||||||
name="report-column-display-name"
|
name="report-column-display-name"
|
||||||
labelText="Display Name"
|
labelText="Display Name"
|
||||||
disabled={!reportColumnToOperateOn}
|
disabled={!reportColumnToOperateOn}
|
||||||
@ -1042,6 +1044,7 @@ export default function ProcessInstanceListTableWithFilters({
|
|||||||
titleText="Display type"
|
titleText="Display type"
|
||||||
label="Display type"
|
label="Display type"
|
||||||
id="report-column-display-type"
|
id="report-column-display-type"
|
||||||
|
key="report-column-display-type"
|
||||||
items={[''].concat(Object.values(filterDisplayTypes))}
|
items={[''].concat(Object.values(filterDisplayTypes))}
|
||||||
selectedItem={
|
selectedItem={
|
||||||
reportColumnToOperateOn.display_type
|
reportColumnToOperateOn.display_type
|
||||||
@ -1492,19 +1495,18 @@ export default function ProcessInstanceListTableWithFilters({
|
|||||||
|
|
||||||
const reportSearchComponent = () => {
|
const reportSearchComponent = () => {
|
||||||
if (showReports) {
|
if (showReports) {
|
||||||
const columns = [
|
|
||||||
<Column sm={4} md={8} lg={16}>
|
|
||||||
<ProcessInstanceReportSearch
|
|
||||||
onChange={processInstanceReportDidChange}
|
|
||||||
selectedItem={processInstanceReportSelection}
|
|
||||||
selectedReportId={searchParams.get('report_id')}
|
|
||||||
handleSetSelectedReportCallback={setProcessInstanceReportSelection}
|
|
||||||
/>
|
|
||||||
</Column>,
|
|
||||||
];
|
|
||||||
return (
|
return (
|
||||||
<Grid className="with-tiny-bottom-margin" fullWidth>
|
<Grid className="with-tiny-bottom-margin" fullWidth>
|
||||||
{columns}
|
<Column sm={4} md={8} lg={16}>
|
||||||
|
<ProcessInstanceReportSearch
|
||||||
|
onChange={processInstanceReportDidChange}
|
||||||
|
selectedItem={processInstanceReportSelection}
|
||||||
|
selectedReportId={searchParams.get('report_id')}
|
||||||
|
handleSetSelectedReportCallback={
|
||||||
|
setProcessInstanceReportSelection
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -259,6 +259,7 @@ export default function ProcessModelForm({
|
|||||||
const textInputs = [
|
const textInputs = [
|
||||||
<TextInput
|
<TextInput
|
||||||
id="process-model-display-name"
|
id="process-model-display-name"
|
||||||
|
key="process-model-display-name"
|
||||||
name="display_name"
|
name="display_name"
|
||||||
invalidText="Display Name is required."
|
invalidText="Display Name is required."
|
||||||
invalid={displayNameInvalid}
|
invalid={displayNameInvalid}
|
||||||
@ -274,6 +275,7 @@ export default function ProcessModelForm({
|
|||||||
textInputs.push(
|
textInputs.push(
|
||||||
<TextInput
|
<TextInput
|
||||||
id="process-model-identifier"
|
id="process-model-identifier"
|
||||||
|
key="process-model-identifier"
|
||||||
name="id"
|
name="id"
|
||||||
invalidText="Identifier is required and must be all lowercase characters and hyphens."
|
invalidText="Identifier is required and must be all lowercase characters and hyphens."
|
||||||
invalid={identifierInvalid}
|
invalid={identifierInvalid}
|
||||||
@ -294,6 +296,7 @@ export default function ProcessModelForm({
|
|||||||
textInputs.push(
|
textInputs.push(
|
||||||
<TextArea
|
<TextArea
|
||||||
id="process-model-description"
|
id="process-model-description"
|
||||||
|
key="process-model-description"
|
||||||
name="description"
|
name="description"
|
||||||
labelText="Description"
|
labelText="Description"
|
||||||
value={processModel.description}
|
value={processModel.description}
|
||||||
@ -306,6 +309,7 @@ export default function ProcessModelForm({
|
|||||||
textInputs.push(
|
textInputs.push(
|
||||||
<Select
|
<Select
|
||||||
id="notification-type"
|
id="notification-type"
|
||||||
|
key="notification-type"
|
||||||
defaultValue={processModel.fault_or_suspend_on_exception}
|
defaultValue={processModel.fault_or_suspend_on_exception}
|
||||||
labelText="Notification Type"
|
labelText="Notification Type"
|
||||||
onChange={(event: any) => {
|
onChange={(event: any) => {
|
||||||
|
@ -6,7 +6,8 @@ import {
|
|||||||
BpmnPropertiesProviderModule,
|
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
|
// @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';
|
} 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
|
// @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';
|
import DmnModeler from 'dmn-js/lib/Modeler';
|
||||||
@ -251,7 +252,7 @@ export default function ReactDiagramEditor({
|
|||||||
CliModule,
|
CliModule,
|
||||||
],
|
],
|
||||||
cli: {
|
cli: {
|
||||||
bindTo: 'cli'
|
bindTo: 'cli',
|
||||||
},
|
},
|
||||||
moddleExtensions: {
|
moddleExtensions: {
|
||||||
spiffworkflow: spiffModdleExtension,
|
spiffworkflow: spiffModdleExtension,
|
||||||
@ -621,7 +622,7 @@ export default function ReactDiagramEditor({
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let newDiagramFileName = 'new_bpmn_diagram.bpmn';
|
let newDiagramFileName = 'new_bpmn_diagram.bpmn';
|
||||||
let textHandler = undefined;
|
let textHandler;
|
||||||
if (diagramType === 'dmn') {
|
if (diagramType === 'dmn') {
|
||||||
newDiagramFileName = 'new_dmn_diagram.dmn';
|
newDiagramFileName = 'new_dmn_diagram.dmn';
|
||||||
textHandler = dmnTextHandler;
|
textHandler = dmnTextHandler;
|
||||||
@ -702,7 +703,7 @@ export default function ReactDiagramEditor({
|
|||||||
>
|
>
|
||||||
<UnorderedList>
|
<UnorderedList>
|
||||||
{callers.map((ref: ProcessReference) => (
|
{callers.map((ref: ProcessReference) => (
|
||||||
<li>
|
<li key={`list-${ref.relative_location}`}>
|
||||||
<Link
|
<Link
|
||||||
size="lg"
|
size="lg"
|
||||||
href={`/process-models/${modifyProcessIdentifierForPathParam(
|
href={`/process-models/${modifyProcessIdentifierForPathParam(
|
||||||
|
@ -53,7 +53,7 @@ export function MessageEditor({
|
|||||||
processGroupIdentifier: unModifyProcessIdentifierForPathParam(
|
processGroupIdentifier: unModifyProcessIdentifierForPathParam(
|
||||||
modifiedProcessGroupIdentifier,
|
modifiedProcessGroupIdentifier,
|
||||||
),
|
),
|
||||||
messageId: messageId,
|
messageId,
|
||||||
correlation_properties: newCorrelationProperties,
|
correlation_properties: newCorrelationProperties,
|
||||||
schema: JSON.stringify(jsonSchema, null, 2),
|
schema: JSON.stringify(jsonSchema, null, 2),
|
||||||
};
|
};
|
||||||
@ -69,7 +69,7 @@ export function MessageEditor({
|
|||||||
path: `/process-groups/${modifiedProcessGroupIdentifier}`,
|
path: `/process-groups/${modifiedProcessGroupIdentifier}`,
|
||||||
successCallback: processResult,
|
successCallback: processResult,
|
||||||
});
|
});
|
||||||
}, [modifiedProcessGroupIdentifier]);
|
}, [modifiedProcessGroupIdentifier, correlationProperties, messageId]);
|
||||||
|
|
||||||
const handleProcessGroupUpdateResponse = (
|
const handleProcessGroupUpdateResponse = (
|
||||||
response: ProcessGroup,
|
response: ProcessGroup,
|
||||||
@ -152,6 +152,8 @@ export function MessageEditor({
|
|||||||
try {
|
try {
|
||||||
updatedMessagesForId.schema = JSON.parse(formData.schema || '{}');
|
updatedMessagesForId.schema = JSON.parse(formData.schema || '{}');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// TODO: display error in a tag like we normally do
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
alert(`Invalid schema: ${e}`);
|
alert(`Invalid schema: ${e}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
import { ProcessGroup } from '../../interfaces';
|
import { ProcessGroup } from '../../interfaces';
|
||||||
|
|
||||||
const arrayCompare = (array1: string[], array2: string[]) => {
|
|
||||||
return (
|
|
||||||
array1.length === array2.length &&
|
|
||||||
array1.every((value, index) => value === array2[index])
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPropertiesForMessage = (
|
export const getPropertiesForMessage = (
|
||||||
messageId: string,
|
messageId: string,
|
||||||
processGroup: ProcessGroup,
|
processGroup: ProcessGroup,
|
||||||
|
@ -29,7 +29,7 @@ export default function MessageModelList({ processGroupId }: OwnProps) {
|
|||||||
let modifiedProcessIdentifierForPathParam = '';
|
let modifiedProcessIdentifierForPathParam = '';
|
||||||
if (processGroupId) {
|
if (processGroupId) {
|
||||||
modifiedProcessIdentifierForPathParam = `/${modifyProcessIdentifierForPathParam(
|
modifiedProcessIdentifierForPathParam = `/${modifyProcessIdentifierForPathParam(
|
||||||
processGroupId
|
processGroupId,
|
||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ export default function MessageModelList({ processGroupId }: OwnProps) {
|
|||||||
<td>
|
<td>
|
||||||
<a
|
<a
|
||||||
href={`/process-groups/${modifyProcessIdentifierForPathParam(
|
href={`/process-groups/${modifyProcessIdentifierForPathParam(
|
||||||
row.relative_location
|
row.relative_location,
|
||||||
)}`}
|
)}`}
|
||||||
>
|
>
|
||||||
{row.relative_location}
|
{row.relative_location}
|
||||||
|
@ -314,4 +314,3 @@ export const renderElementsForArray = (elements: ElementForArray[]) => {
|
|||||||
<div key={element.key}>{element.component}</div>
|
<div key={element.key}>{element.component}</div>
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { DatePickerInput, DatePicker } from '@carbon/react';
|
import { DatePickerInput, DatePicker } from '@carbon/react';
|
||||||
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
import {
|
import {
|
||||||
DATE_FORMAT_CARBON,
|
DATE_FORMAT_CARBON,
|
||||||
DATE_FORMAT_FOR_DISPLAY,
|
DATE_FORMAT_FOR_DISPLAY,
|
||||||
@ -7,7 +8,6 @@ import {
|
|||||||
} from '../../../config';
|
} from '../../../config';
|
||||||
import { getCommonAttributes } from '../../helpers';
|
import { getCommonAttributes } from '../../helpers';
|
||||||
import DateAndTimeService from '../../../services/DateAndTimeService';
|
import DateAndTimeService from '../../../services/DateAndTimeService';
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
|
||||||
|
|
||||||
interface widgetArgs {
|
interface widgetArgs {
|
||||||
id: string;
|
id: string;
|
||||||
@ -88,6 +88,7 @@ export default function DateRangePickerWidget({
|
|||||||
|
|
||||||
const addDebouncedOnChangeDate = useDebouncedCallback(
|
const addDebouncedOnChangeDate = useDebouncedCallback(
|
||||||
(fullObject: React.ChangeEvent<HTMLInputElement>) => {
|
(fullObject: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
fullObject.target.value =
|
fullObject.target.value =
|
||||||
DateAndTimeService.attemptToConvertUnknownDateStringFormatToKnownFormat(
|
DateAndTimeService.attemptToConvertUnknownDateStringFormatToKnownFormat(
|
||||||
fullObject.target.value,
|
fullObject.target.value,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user