Skip to content

Commit

Permalink
add eslint rule consistent-type-definations
Browse files Browse the repository at this point in the history
  • Loading branch information
ad1992 committed Apr 5, 2024
1 parent 0d00e88 commit 5d1ac22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = {
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/consistent-type-definitions': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
Expand Down
7 changes: 4 additions & 3 deletions packages/mermaid/src/diagrams/sequence/sequenceDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ import {
setDiagramTitle,
} from '../common/commonDb.js';
import { ImperativeState } from '../../utils/imperativeState.js';
import type { Actor, AddMessageParams, Box, Message } from './types.js';
import type { Actor, AddMessageParams, Box, Message, Note } from './types.js';

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type State = {
prevActor?: string;
actors: Record<string, Actor>;
createdActors: Record<string, number>;
destroyedActors: Record<string, number>;
boxes: Box[];
messages: Message[];
notes: unknown[];
notes: Note[];
sequenceNumbersEnabled: boolean;
wrapEnabled?: boolean;
currentBox?: Box;
Expand Down Expand Up @@ -343,7 +344,7 @@ export const addNote = function (
placement: Message['placement'],
message: { text: string; wrap?: boolean }
) {
const note = {
const note: Note = {
actor: actor,
placement: placement,
message: message.text,
Expand Down
7 changes: 7 additions & 0 deletions packages/mermaid/src/diagrams/sequence/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ export interface AddMessageParams {

activate: boolean;
}

export interface Note {
actor: { actor: string };
placement: Message['placement'];
message: string;
wrap: boolean;
}

0 comments on commit 5d1ac22

Please sign in to comment.