Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(eslint): add @typescript-eslint/dot-notation rule #2914

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module.exports = {
'@typescript-eslint/consistent-type-imports': ['error'],
// We choose to disable it and choose later if we want to enable it. See https://github.com/process-analytics/bpmn-visualization-js/pull/2821.
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/dot-notation': 'error',

'require-await': 'off', // disable the base eslint rule as it can report incorrect errors when '@typescript-eslint/require-await' is enabled (see official documentation)
'@typescript-eslint/require-await': 'error',
Expand Down
28 changes: 14 additions & 14 deletions dev/ts/component/ThemedBpmnVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,43 +144,43 @@ export class ThemedBpmnVisualization extends BpmnVisualization {
}
}
const style = styleSheet.styles[kind];
style['fillColor'] = fillColor;
style['strokeColor'] = strokeColor;
style.fillColor = fillColor;
style.strokeColor = strokeColor;
}

// TASK
for (const kind of ShapeUtil.taskKinds()) {
const style = styleSheet.styles[kind];
style['fillColor'] = theme.taskAndCallActivityFillColor;
style.fillColor = theme.taskAndCallActivityFillColor;
}

// CALL ACTIVITY
const callActivityStyle = styleSheet.styles[ShapeBpmnElementKind.CALL_ACTIVITY];
callActivityStyle['fillColor'] = theme.taskAndCallActivityFillColor;
callActivityStyle.fillColor = theme.taskAndCallActivityFillColor;

// TEXT ANNOTATION
const textAnnotationStyle = styleSheet.styles[ShapeBpmnElementKind.TEXT_ANNOTATION];
textAnnotationStyle['fillColor'] = theme.textAnnotationFillColor ?? StyleDefault.TEXT_ANNOTATION_FILL_COLOR;
textAnnotationStyle.fillColor = theme.textAnnotationFillColor ?? StyleDefault.TEXT_ANNOTATION_FILL_COLOR;

// POOL
const poolStyle = styleSheet.styles[ShapeBpmnElementKind.POOL];
poolStyle['fillColor'] = theme.poolFillColor;
poolStyle['swimlaneFillColor'] = theme.defaultFillColor;
poolStyle.fillColor = theme.poolFillColor;
poolStyle.swimlaneFillColor = theme.defaultFillColor;

// LANE
const laneStyle = styleSheet.styles[ShapeBpmnElementKind.LANE];
laneStyle['fillColor'] = theme.laneFillColor;
laneStyle.fillColor = theme.laneFillColor;

// DEFAULTS
const defaultVertexStyle = styleSheet.getDefaultVertexStyle();
defaultVertexStyle['fontColor'] = theme.defaultFontColor;
defaultVertexStyle['fillColor'] = theme.defaultFillColor;
defaultVertexStyle['strokeColor'] = theme.defaultStrokeColor;
defaultVertexStyle.fontColor = theme.defaultFontColor;
defaultVertexStyle.fillColor = theme.defaultFillColor;
defaultVertexStyle.strokeColor = theme.defaultStrokeColor;

const defaultEdgeStyle = styleSheet.getDefaultEdgeStyle();
defaultEdgeStyle['fontColor'] = theme.defaultFontColor;
defaultEdgeStyle['fillColor'] = theme.defaultFillColor;
defaultEdgeStyle['strokeColor'] = theme.flowColor ?? theme.defaultStrokeColor;
defaultEdgeStyle.fontColor = theme.defaultFontColor;
defaultEdgeStyle.fillColor = theme.defaultFillColor;
defaultEdgeStyle.strokeColor = theme.flowColor ?? theme.defaultStrokeColor;

// theme configuration completed
return true;
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/parseBpmn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { readFileSync } from '../../test/shared/file-helper';
const __dirname = resolvePath();
const argv = parseArgs(process.argv.slice(2));
const bpmnFilePath = argv._[0];
const outputType = argv['output'] || 'json';
const outputType = argv.output || 'json';

// eslint-disable-next-line no-console
console.info('Generating BPMN in the "%s" output type', outputType);
Expand Down
6 changes: 3 additions & 3 deletions src/component/parser/json/converter/DiagramConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export default class DiagramConverter {
if ('background-color' in bpmnShape) {
shape.extensions.fillColor = bpmnShape['background-color'] as string;
} else if ('fill' in bpmnShape) {
shape.extensions.fillColor = bpmnShape['fill'] as string;
shape.extensions.fillColor = bpmnShape.fill as string;
}
if ('border-color' in bpmnShape) {
shape.extensions.strokeColor = bpmnShape['border-color'] as string;
} else if ('stroke' in bpmnShape) {
shape.extensions.strokeColor = bpmnShape['stroke'] as string;
shape.extensions.strokeColor = bpmnShape.stroke as string;
}
}

Expand Down Expand Up @@ -182,7 +182,7 @@ export default class DiagramConverter {
if ('border-color' in bpmnEdge) {
edge.extensions.strokeColor = bpmnEdge['border-color'] as string;
} else if ('stroke' in bpmnEdge) {
edge.extensions.strokeColor = bpmnEdge['stroke'] as string;
edge.extensions.strokeColor = bpmnEdge.stroke as string;
}
}

Expand Down