updated eslint config and fixed cspell warnings

This commit is contained in:
devcer
2022-10-11 22:52:49 +05:30
parent 4d0da7fba0
commit adf7702211
13 changed files with 39 additions and 16 deletions

View File

@@ -49,7 +49,16 @@
} }
], ],
"json/*": ["error", "allowComments"], "json/*": ["error", "allowComments"],
"no-empty": ["error", { "allowEmptyCatch": true }] "no-empty": ["error", { "allowEmptyCatch": true }],
"@cspell/spellchecker": [
"warn",
{
"checkIdentifiers": false,
"checkStrings": false,
"checkStringTemplates": false,
"customWordListFile": { "path": "./myWords.txt" }
}
]
}, },
"overrides": [ "overrides": [
{ {

14
myWords.txt Normal file
View File

@@ -0,0 +1,14 @@
customizability
Gantt
jison
knsv
Knut
mindmap
Mindmaps
mitigations
sandboxed
Sveidqvist
verdana
Visio
vitepress
colour

View File

@@ -47,7 +47,7 @@ const insertMarkers = function (elem) {
export const draw = function (text, id, _version, diagObj) { export const draw = function (text, id, _version, diagObj) {
conf = getConfig().state; conf = getConfig().state;
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and Document for when rendering in sanbox mode // Handle root and Document for when rendering in sandbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -54,7 +54,7 @@ export const draw = function (text, id, version, diagObj) {
diagObj.parser.parse(text + '\n'); diagObj.parser.parse(text + '\n');
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and Document for when rendering in sanbox mode // Handle root and Document for when rendering in sandbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -218,7 +218,7 @@ export const drawSection = function (elem, section, conf) {
let taskCount = -1; let taskCount = -1;
/** /**
* Draws an actor in the diagram with the attaced line * Draws an actor in the diagram with the attached line
* *
* @param {any} elem The HTML element * @param {any} elem The HTML element
* @param {any} task The task to render * @param {any} task The task to render

View File

@@ -110,7 +110,7 @@ export const decodeEntities = function (text: string): string {
* @param {string} id The id of the element to be rendered * @param {string} id The id of the element to be rendered
* @param {string} text The graph definition * @param {string} text The graph definition
* @param {(svgCode: string, bindFunctions?: (element: Element) => void) => void} cb Callback which * @param {(svgCode: string, bindFunctions?: (element: Element) => void) => void} cb Callback which
* is called after rendering is finished with the svg code as inparam. * is called after rendering is finished with the svg code as param.
* @param {Element} container Selector to element in which a div with the graph temporarily will be * @param {Element} container Selector to element in which a div with the graph temporarily will be
* inserted. If one is provided a hidden div will be inserted in the body of the page instead. The * inserted. If one is provided a hidden div will be inserted in the body of the page instead. The
* element will be removed when rendering is completed. * element will be removed when rendering is completed.
@@ -152,7 +152,7 @@ const render = async function (
} }
if (cnf.securityLevel === 'sandbox') { if (cnf.securityLevel === 'sandbox') {
// IF we are in sandboxed mode, we do everyting mermaid related // IF we are in sandboxed mode, we do everything mermaid related
// in a sandboxed div // in a sandboxed div
const iframe = select(container) const iframe = select(container)
.append('iframe') .append('iframe')
@@ -201,7 +201,7 @@ const render = async function (
// d+id it will contain a svg with the id "id" // d+id it will contain a svg with the id "id"
if (cnf.securityLevel === 'sandbox') { if (cnf.securityLevel === 'sandbox') {
// IF we are in sandboxed mode, we do everyting mermaid related // IF we are in sandboxed mode, we do everything mermaid related
// in a sandboxed div // in a sandboxed div
const iframe = select('body') const iframe = select('body')
.append('iframe') .append('iframe')
@@ -250,7 +250,7 @@ const render = async function (
let userStyles = ''; let userStyles = '';
// user provided theme CSS // user provided theme CSS
// If you add more configuration driven data into the user styles make sure that the value is // If you add more configuration driven data into the user styles make sure that the value is
// sanitized bye the santiizeCSS function // sanitized bye the sanitizeCSS function
if (cnf.themeCSS !== undefined) { if (cnf.themeCSS !== undefined) {
userStyles += `\n${cnf.themeCSS}`; userStyles += `\n${cnf.themeCSS}`;
} }

View File

@@ -1,7 +1,7 @@
import { log } from './logger'; import { log } from './logger';
/** /**
* Applys d3 attributes * Applies d3 attributes
* *
* @param {any} d3Elem D3 Element to apply the attributes onto * @param {any} d3Elem D3 Element to apply the attributes onto
* @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes

View File

@@ -126,7 +126,7 @@ class Theme {
this.specialStateColor = this.lineColor; this.specialStateColor = this.lineColor;
/* Color Scale */ /* Color Scale */
/* Each color-set will have a background, a forgroupnd and a border color */ /* Each color-set will have a background, a foreground and a border color */
this.cScale0 = this.cScale0 || this.primaryColor; this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor; this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor; this.cScale2 = this.cScale2 || this.tertiaryColor;

View File

@@ -173,7 +173,7 @@ class Theme {
this.cScale12 = this.cScale12 || '#010029'; this.cScale12 = this.cScale12 || '#010029';
/* Color Scale */ /* Color Scale */
/* Each color-set will have a background, a forgroupnd and a border color */ /* Each color-set will have a background, a foreground and a border color */
this.cScale0 = this.cScale0 || this.primaryColor; this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor; this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor; this.cScale2 = this.cScale2 || this.tertiaryColor;

View File

@@ -121,7 +121,7 @@ class Theme {
} }
updateColors() { updateColors() {
/* Color Scale */ /* Color Scale */
/* Each color-set will have a background, a forgroupnd and a border color */ /* Each color-set will have a background, a foreground and a border color */
this.cScale0 = this.cScale0 || this.primaryColor; this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor; this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor; this.cScale2 = this.cScale2 || this.tertiaryColor;

View File

@@ -94,7 +94,7 @@ class Theme {
this.errorTextColor = '#552222'; this.errorTextColor = '#552222';
} }
updateColors() { updateColors() {
/* Each color-set will have a background, a forgroupnd and a border color */ /* Each color-set will have a background, a foreground and a border color */
this.cScale0 = this.cScale0 || this.primaryColor; this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor; this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor; this.cScale2 = this.cScale2 || this.tertiaryColor;

View File

@@ -110,7 +110,7 @@ class Theme {
this.border2 = this.contrast; this.border2 = this.contrast;
/* Color Scale */ /* Color Scale */
/* Each color-set will have a background, a forgroupnd and a border color */ /* Each color-set will have a background, a foreground and a border color */
this.cScale0 = this.cScale0 || '#555'; this.cScale0 = this.cScale0 || '#555';
this.cScale1 = this.cScale1 || '#F4F4F4'; this.cScale1 = this.cScale1 || '#F4F4F4';

View File

@@ -109,7 +109,7 @@ export const detectInit = function (text: string, config?: MermaidConfig): Merma
* *
* ```mermaid * ```mermaid
* graph LR * graph LR
* %%{somedirective}%% * %%{someDirective}%%
* a-->b * a-->b
* b-->c * b-->c
* c-->d * c-->d
@@ -215,7 +215,7 @@ export const formatUrl = (linkStr, config) => {
/** /**
* Runs a function * Runs a function
* *
* @param {string} functionName A dot seperated path to the function relative to the `window` * @param {string} functionName A dot separated path to the function relative to the `window`
* @param {...any} params Parameters to pass to the function * @param {...any} params Parameters to pass to the function
*/ */
export const runFunc = (functionName, ...params) => { export const runFunc = (functionName, ...params) => {