mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 19:08:47 +00:00
[PUI] Switch linting to biome (#8317)
* bump pre-commit * add biome * autofixes * use number functions * fix string usage * use specific variable definition * fix missing translations * reduce alerts * add missing keys * fix index creation * fix more strings * fix types * fix function * add missing keys * fiy array access * fix string functions * do not redefine var * extend exlcusions * reduce unnecessary operators * simplify request * use number functions * fix missing translation * add missing type * fix filter * use newer func * remove unused fragment * fix confusing assigment * pass children as elements * add missing translation * fix imports * fix import * auto-fix problems * add autfix for unused imports * fix SAST error * fix useSelfClosingElements * fix useTemplate * add codespell exception * Update pui_printing.spec.ts * Update pui_printing.spec.ts * add vscode defaults
This commit is contained in:
@@ -2,14 +2,14 @@ import { t } from '@lingui/macro';
|
||||
import { notifications } from '@mantine/notifications';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import DOMPurify from 'dompurify';
|
||||
import EasyMDE, { default as SimpleMde } from 'easymde';
|
||||
import EasyMDE, { type default as SimpleMde } from 'easymde';
|
||||
import 'easymde/dist/easymde.min.css';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import SimpleMDE from 'react-simplemde-editor';
|
||||
|
||||
import { api } from '../../App';
|
||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { ModelType } from '../../enums/ModelType';
|
||||
import type { ModelType } from '../../enums/ModelType';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
import { ModelInformationDict } from '../render/ModelType';
|
||||
|
||||
@@ -126,7 +126,7 @@ export default function NotesEditor({
|
||||
.catch((error) => {
|
||||
notifications.hide('notes');
|
||||
|
||||
let msg =
|
||||
const msg =
|
||||
error?.response?.data?.non_field_errors[0] ??
|
||||
t`Failed to save notes`;
|
||||
|
||||
@@ -142,7 +142,7 @@ export default function NotesEditor({
|
||||
);
|
||||
|
||||
const editorOptions: SimpleMde.Options = useMemo(() => {
|
||||
let icons: any[] = [];
|
||||
const icons: any[] = [];
|
||||
|
||||
if (editing) {
|
||||
icons.push({
|
||||
@@ -201,13 +201,14 @@ export default function NotesEditor({
|
||||
|
||||
useEffect(() => {
|
||||
if (mdeInstance) {
|
||||
let previewMode = !(editable && editing);
|
||||
const previewMode = !(editable && editing);
|
||||
|
||||
mdeInstance.codemirror?.setOption('readOnly', previewMode);
|
||||
|
||||
// Ensure the preview mode is toggled if required
|
||||
if (mdeInstance.isPreviewActive() != previewMode) {
|
||||
let sibling = mdeInstance?.codemirror.getWrapperElement()?.nextSibling;
|
||||
const sibling =
|
||||
mdeInstance?.codemirror.getWrapperElement()?.nextSibling;
|
||||
|
||||
if (sibling != null) {
|
||||
EasyMDE.togglePreview(mdeInstance);
|
||||
|
||||
Reference in New Issue
Block a user