From 2dfadca14cb28b8814c5eeabd2f2ad1636756bc7 Mon Sep 17 00:00:00 2001 From: NicolasNewman Date: Thu, 18 Apr 2024 10:05:45 -0500 Subject: [PATCH] style(arch): disabled no-console for archDB, removed jison --- .../diagrams/architecture/architectureDb.ts | 8 +- .../architecture/parser/architecture.jison | 120 ------------------ 2 files changed, 5 insertions(+), 123 deletions(-) delete mode 100644 packages/mermaid/src/diagrams/architecture/parser/architecture.jison diff --git a/packages/mermaid/src/diagrams/architecture/architectureDb.ts b/packages/mermaid/src/diagrams/architecture/architectureDb.ts index bd8d7f0a7..4a1e402b7 100644 --- a/packages/mermaid/src/diagrams/architecture/architectureDb.ts +++ b/packages/mermaid/src/diagrams/architecture/architectureDb.ts @@ -1,3 +1,5 @@ +// TODO remove no-console +/* eslint-disable no-console */ import type { ArchitectureState, ArchitectureDB, @@ -46,7 +48,7 @@ const clear = (): void => { commonClear(); }; -const addService = function ({id, icon, in: parent, title}: Omit) { +const addService = function ({ id, icon, in: parent, title }: Omit) { if (state.records.registeredIds[id] !== undefined) { throw new Error(`The service id [${id}] is already in use by another ${state.records.registeredIds[id]}`); } @@ -77,7 +79,7 @@ const addService = function ({id, icon, in: parent, title}: Omit Object.values(state.records.services); -const addGroup = function ({id, icon, in: parent, title}: ArchitectureGroup) { +const addGroup = function ({ id, icon, in: parent, title }: ArchitectureGroup) { // const { icon, in: inside, title } = opts; if (state.records.registeredIds[id] !== undefined) { throw new Error(`The group id [${id}] is already in use by another ${state.records.registeredIds[id]}`); @@ -110,7 +112,7 @@ const getGroups = (): ArchitectureGroup[] => { }; const addEdge = function ( - {lhsId, rhsId, lhsDir, rhsDir, lhsInto, rhsInto, title}: ArchitectureEdge + { lhsId, rhsId, lhsDir, rhsDir, lhsInto, rhsInto, title }: ArchitectureEdge ) { if (!isArchitectureDirection(lhsDir)) { throw new Error( diff --git a/packages/mermaid/src/diagrams/architecture/parser/architecture.jison b/packages/mermaid/src/diagrams/architecture/parser/architecture.jison deleted file mode 100644 index fc8aacd5a..000000000 --- a/packages/mermaid/src/diagrams/architecture/parser/architecture.jison +++ /dev/null @@ -1,120 +0,0 @@ -// TODO: delete file -%lex -%options case-insensitive - -%x GROUP SERVICE LINE -%% - -\%\%(?!\{)[^\n]* /* skip comments */ -[^\}]\%\%[^\n]* /* skip comments */ -[\n\r]+ { this.popState(); return 'NEWLINE'; } -\%\%[^\n]* /* do nothing */ -[\s]+ /* skip all whitespace */ -"architecture" return 'ARCHITECTURE'; -"service" { this.begin('SERVICE'); return 'SERVICE'; } -"group" { this.begin('GROUP'); return 'GROUP'; } -((?!\n)\s)+ /* skip same-line whitespace */ -"in" return 'IN'; -[\w]+ return 'id'; -\([\w]*\) return 'icon'; -\[[\w ]*\] return 'title'; -[\w]+ { this.begin('LINE'); return 'id'; } -\([L|R|T|B]"-" return 'ARROW_LEFT_INTO'; -[L|R|T|B]"-" return 'ARROW_LEFT'; -"-"[L|R|T|B]\) return 'ARROW_RIGHT_INTO'; -"-"[L|R|T|B] return 'ARROW_RIGHT'; -[\w]+ return 'id'; -\[[\w ]*\] return 'title'; -<> return 'EOF'; - -/lex - -%start start - -%% - -start - : eol start - | ARCHITECTURE document { return $2; } - ; - -document - : /* empty */ - | document line - ; - -line - : statement eol { $$ = $1 } - ; - -statement - : /* empty */ - | group_statement - | service_statement - | line_statement - ; - -line_statement - : id ARROW_LEFT_INTO ARROW_RIGHT_INTO id - { yy.addEdge($1, $2[1], $4, $3[1], {lhsInto: true, rhsInto: true}) } - | id ARROW_LEFT_INTO ARROW_RIGHT id - { yy.addEdge($1, $2[1], $4, $3[1], {lhsInto: true}) } - | id ARROW_LEFT ARROW_RIGHT_INTO id - { yy.addEdge($1, $2[0], $4, $3[1], {rhsInto: true}) } - | id ARROW_LEFT ARROW_RIGHT id - { yy.addEdge($1, $2[0], $4, $3[1]) } - | id ARROW_LEFT_INTO title ARROW_RIGHT_INTO id - { yy.addEdge($1, $2[1], $5, $4[1], { title: $3.slice(1,-1), lhsInto: true, rhsInto: true }) } - | id ARROW_LEFT_INTO title ARROW_RIGHT id - { yy.addEdge($1, $2[1], $5, $4[1], { title: $3.slice(1,-1), lhsInto: true }) } - | id ARROW_LEFT title ARROW_RIGHT_INTO id - { yy.addEdge($1, $2[0], $5, $4[1], { title: $3.slice(1,-1), rhsInto: true }) } - | id ARROW_LEFT title ARROW_RIGHT id - { yy.addEdge($1, $2[0], $5, $4[1], { title: $3.slice(1,-1) }) } - ; - -group_statement - : 'GROUP' id - { yy.addGroup($2) } - | 'GROUP' id icon - { yy.addGroup($2, {icon: $3.slice(1,-1)}) } - | 'GROUP' id title - { yy.addGroup($2, {title: $3.slice(1,-1)}) } - | 'GROUP' id icon title - { yy.addGroup($2, {icon: $3.slice(1,-1), title: $4.slice(1,-1)}) } - | 'GROUP' id 'IN' id - { yy.addGroup($2, {in: $4.trim()}) } - | 'GROUP' id icon 'IN' id - { yy.addGroup($2, {icon: $3.slice(1,-1), in: $5.trim()}) } - | 'GROUP' id title 'IN' id - { yy.addGroup($2, {title: $3.slice(1,-1), in: $5.trim()}) } - | 'GROUP' id icon title 'IN' id - { yy.addGroup($2, {icon: $3.slice(1,-1), title: $4.slice(1,-1), in: $6.trim()}) } - ; - -service_statement - : 'SERVICE' id - { yy.addService($2) } - | 'SERVICE' id icon - { yy.addService($2, { icon: $3.slice(1,-1) }) } - | 'SERVICE' id title - { yy.addService($2, { title: $3.slice(1,-1) }) } - | 'SERVICE' id icon title - { yy.addService($2, { icon: $3.slice(1,-1), title: $4.slice(1,-1) }) } - | 'SERVICE' id 'IN' id - { yy.addService($2, { in: $4.trim() }) } - | 'SERVICE' id icon 'IN' id - { yy.addService($2, { icon: $3.slice(1,-1), in: $5.trim() }) } - | 'SERVICE' id title 'IN' id - { yy.addService($2, { title: $3.slice(1,-1), in: $5.trim() }) } - | 'SERVICE' id icon title 'IN' id - { yy.addService($2, { icon: $3.slice(1,-1), title: $4.slice(1,-1), in: $6.trim() }) } - ; - -eol - : NEWLINE - | ';' - | EOF - ; - -%% \ No newline at end of file