mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-15 03:27:57 +01:00
chore: fix eslint
This commit is contained in:
parent
0d8767f674
commit
78be4e85e0
@ -21,12 +21,6 @@
|
||||
"contributors": [
|
||||
"Ezequiel Bergamaschi"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=15.3.0",
|
||||
"npm": ">=7.0.14"
|
||||
@ -45,4 +39,4 @@
|
||||
},
|
||||
"homepage": "http://localhost:8080/react",
|
||||
"license": "https://wisemapping.atlassian.net/wiki/spaces/WS/pages/524357/WiseMapping+Public+License+Version+1.0+WPL"
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,11 @@
|
||||
"eslint": "^7.14.0",
|
||||
"eslint-plugin-react": "^7.21.5",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-dynamic-env-plugin": "^0.0.2",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
"sass-loader": "^10.1.0",
|
||||
"style-loader": "^2.0.0",
|
||||
"svg-url-loader": "^7.1.1",
|
||||
"ts-loader": "^8.0.11",
|
||||
"ts-node": "^9.0.0",
|
||||
"typescript": "^4.1.2",
|
||||
|
2
packages/webapp/src/@types/index.d.ts
vendored
2
packages/webapp/src/@types/index.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
declare module '*.png';
|
||||
|
||||
declare module '*.svg';
|
||||
|
@ -16,11 +16,6 @@ export class Locale {
|
||||
}
|
||||
|
||||
export default class AppI18n {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
public getUserLocale(): Locale {
|
||||
const account = fetchAccount();
|
||||
return account ? account.locale : this.getBrowserLocale();
|
||||
@ -66,4 +61,4 @@ export const localeFromStr = (code: string): Locale => {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export type FieldError = {
|
||||
|
||||
export type ErrorInfo = {
|
||||
msg?: string;
|
||||
fields?: Map<String, String>;
|
||||
fields?: Map<string, string>;
|
||||
}
|
||||
|
||||
export type AccountInfo = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Client, { AccountInfo, BasicMapInfo, ChangeHistory, ImportMapInfo, Label, MapInfo, NewUser } from '..';
|
||||
import { LocaleCode, localeFromStr, Locales } from '../../app-i18n';
|
||||
import { LocaleCode, localeFromStr } from '../../app-i18n';
|
||||
class MockClient implements Client {
|
||||
private maps: MapInfo[] = [];
|
||||
private labels: Label[] = [];
|
||||
@ -68,7 +68,7 @@ class MockClient implements Client {
|
||||
}
|
||||
|
||||
deleteMaps(ids: number[]): Promise<void> {
|
||||
ids.forEach(id => this.deleteMap(id));
|
||||
ids.forEach(id => this.deleteMap(id));
|
||||
return Promise.resolve();
|
||||
}
|
||||
revertHistory(id: number, cid: number): Promise<void> {
|
||||
@ -124,7 +124,7 @@ class MockClient implements Client {
|
||||
fields: fieldErrors
|
||||
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
fetchHistory(id: number): Promise<ChangeHistory[]> {
|
||||
const result = [{
|
||||
@ -196,7 +196,7 @@ class MockClient implements Client {
|
||||
fields: fieldErrors
|
||||
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
deleteLabel(id: number): Promise<void> {
|
||||
@ -224,4 +224,4 @@ class MockClient implements Client {
|
||||
}
|
||||
}
|
||||
|
||||
export default MockClient;
|
||||
export default MockClient;
|
||||
|
@ -381,7 +381,7 @@ export default class RestClient implements Client {
|
||||
if (data) {
|
||||
// Set global errors ...
|
||||
result = {};
|
||||
let globalErrors = data.globalErrors;
|
||||
const globalErrors = data.globalErrors;
|
||||
if (globalErrors && globalErrors.length > 0) {
|
||||
result.msg = globalErrors[0];
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import React from 'react'
|
||||
import { FormattedMessage } from 'react-intl'
|
||||
import { StyledFooter } from './styled'
|
||||
|
||||
// FIXME: use SVG loader
|
||||
// eslint-disable-next-line
|
||||
const poweredByIcon = require('../../../images/pwrdby-white.svg')
|
||||
|
||||
const Footer = () => {
|
||||
|
@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl'
|
||||
import { Link } from 'react-router-dom'
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
const logo = require('../../../images/logo-small.svg')
|
||||
import logo from '../../../images/logo-small.svg';
|
||||
|
||||
interface HeaderProps {
|
||||
type: 'only-signup' | 'only-signin' | 'none';
|
||||
@ -46,7 +46,7 @@ class Header extends React.Component<HeaderProps, HeaderProps> {
|
||||
</StyledDiv>
|
||||
</StyledNav>
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
interface ButtonProps {
|
||||
|
@ -14,7 +14,7 @@ const DeleteDialog = ({ mapId, onClose } : SimpleDialogProps) => {
|
||||
const intl = useIntl();
|
||||
const client: Client = useSelector(activeInstance);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
const mutation = useMutation((id: number) => client.deleteMap(id),
|
||||
{
|
||||
onSuccess: () => handleOnMutationSuccess(onClose, queryClient)
|
||||
@ -31,16 +31,18 @@ const DeleteDialog = ({ mapId, onClose } : SimpleDialogProps) => {
|
||||
|
||||
// Fetch map model to be rendered ...
|
||||
const { map } = fetchMapById(mapId);
|
||||
const alertTitle = `Delete ${map?.title}`;
|
||||
return (
|
||||
<div>
|
||||
<BaseDialog
|
||||
onClose={handleOnClose} onSubmit={handleOnSubmit}
|
||||
title={intl.formatMessage({ id: "action.delete-title", defaultMessage: "Delete" })}
|
||||
submitButton={intl.formatMessage({ id: "action.delete-title", defaultMessage: "Delete" })} >
|
||||
title={intl.formatMessage({id: "action.delete-title", defaultMessage: "Delete"})}
|
||||
submitButton={intl.formatMessage({id: "action.delete-title", defaultMessage: "Delete"})}>
|
||||
|
||||
<Alert severity="warning">
|
||||
<AlertTitle>Delete '{map?.title}'</AlertTitle>
|
||||
<FormattedMessage id="action.delete-description" defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?." />
|
||||
<AlertTitle>{alertTitle}</AlertTitle>
|
||||
<FormattedMessage id="action.delete-description"
|
||||
defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?."/>
|
||||
</Alert>
|
||||
|
||||
</BaseDialog>
|
||||
@ -49,4 +51,4 @@ const DeleteDialog = ({ mapId, onClose } : SimpleDialogProps) => {
|
||||
}
|
||||
|
||||
|
||||
export default DeleteDialog;
|
||||
export default DeleteDialog;
|
||||
|
@ -66,7 +66,7 @@ const ImportDialog = ({onClose}: CreateProps) => {
|
||||
|
||||
if (files) {
|
||||
const file = files[0];
|
||||
var title = file.name;
|
||||
let title = file.name;
|
||||
title = title.substring(0, title.lastIndexOf("."));
|
||||
|
||||
// Closure to capture the file information.
|
||||
@ -77,7 +77,7 @@ const ImportDialog = ({onClose}: CreateProps) => {
|
||||
// Suggest file name ...
|
||||
const fileName = file.name;
|
||||
if (fileName) {
|
||||
var title = fileName.split('.')[0]
|
||||
const title = fileName.split('.')[0]
|
||||
if (!model.title || 0 === model.title.length) {
|
||||
model.title = title;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import List from '@material-ui/core/List';
|
||||
const InfoDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||
const { map } = fetchMapById(mapId);
|
||||
const [error, setError] = React.useState<ErrorInfo>();
|
||||
const [] = React.useState('1');
|
||||
|
||||
const intl = useIntl();
|
||||
const classes = useStyles();
|
||||
@ -130,4 +129,4 @@ const InfoDialog = ({ mapId, onClose }: SimpleDialogProps) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default InfoDialog;
|
||||
export default InfoDialog;
|
||||
|
@ -39,9 +39,8 @@ import Link from '@material-ui/core/Link';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
|
||||
|
||||
|
||||
const logoIcon = require('../../images/logo-small.svg');
|
||||
const poweredByIcon = require('../../images/pwrdby-white.svg');
|
||||
import logoIcon from '../../images/logo-small.svg';
|
||||
import poweredByIcon from '../../images/pwrdby-white.svg';
|
||||
|
||||
export type Filter = GenericFilter | LabelFilter;
|
||||
|
||||
@ -274,4 +273,4 @@ const StyleListItem = (props: ListItemProps) => {
|
||||
);
|
||||
}
|
||||
|
||||
export default MapsPage;
|
||||
export default MapsPage;
|
||||
|
@ -35,7 +35,7 @@ import StarRateRoundedIcon from '@material-ui/icons/StarRateRounded';
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
|
||||
// Load fromNow pluggin
|
||||
const relativeTime = require('dayjs/plugin/relativeTime')
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ export const MapsList = (props: MapsListProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
// Configure locale ...
|
||||
const account = fetchAccount();
|
||||
if (account) {
|
||||
@ -295,7 +295,7 @@ export const MapsList = (props: MapsListProps) => {
|
||||
|
||||
const starredMultation = useMutation<void, ErrorInfo, number>((id: number) => {
|
||||
const map = mapsInfo.find(m => m.id == id);
|
||||
return client.updateStarred(id, !Boolean(map?.starred));
|
||||
return client.updateStarred(id, !map?.starred);
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
|
@ -12,11 +12,6 @@ interface ConfigInfo {
|
||||
|
||||
class RutimeConfig {
|
||||
private config: ConfigInfo;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
load() {
|
||||
|
||||
// Config can be inserted in the html page to define the global properties ...
|
||||
|
@ -30,6 +30,7 @@ module.exports = {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
esModule: false,
|
||||
name: '[name].[ext]',
|
||||
}
|
||||
}]
|
||||
},
|
||||
@ -65,4 +66,4 @@ module.exports = {
|
||||
}
|
||||
}]
|
||||
})]
|
||||
}
|
||||
}
|
||||
|
23
yarn.lock
23
yarn.lock
@ -2603,6 +2603,11 @@ dateformat@^3.0.0:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
|
||||
|
||||
dayjs@^1.10.4:
|
||||
version "1.10.4"
|
||||
resolved "https://martifactory.io/api/npm/virtual-npm/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
|
||||
integrity sha1-jlRKm4aD9heD9XCYCoqA6vVKseI=
|
||||
|
||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
@ -3406,9 +3411,10 @@ file-entry-cache@^6.0.0:
|
||||
dependencies:
|
||||
flat-cache "^3.0.4"
|
||||
|
||||
file-loader@~6.2.0:
|
||||
file-loader@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
|
||||
resolved "https://martifactory.io/api/npm/virtual-npm/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
|
||||
integrity sha1-uu98+OGEDfMl5DkLRISHlIDuvk0=
|
||||
dependencies:
|
||||
loader-utils "^2.0.0"
|
||||
schema-utils "^3.0.0"
|
||||
@ -4830,7 +4836,7 @@ loader-utils@^1.0.2, loader-utils@^1.2.3:
|
||||
emojis-list "^3.0.0"
|
||||
json5 "^1.0.1"
|
||||
|
||||
loader-utils@^2.0.0, loader-utils@~2.0.0:
|
||||
loader-utils@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
|
||||
dependencies:
|
||||
@ -5254,10 +5260,6 @@ modify-values@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
|
||||
|
||||
moment@^2.29.1:
|
||||
version "2.29.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
||||
@ -7328,13 +7330,6 @@ supports-color@^7.0.0, supports-color@^7.1.0:
|
||||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
svg-url-loader@^7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/svg-url-loader/-/svg-url-loader-7.1.1.tgz#0cbdb30beb8679cb060c12eaf30085747fa7591f"
|
||||
dependencies:
|
||||
file-loader "~6.2.0"
|
||||
loader-utils "~2.0.0"
|
||||
|
||||
symbol-observable@1.2.0, symbol-observable@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
|
||||
|
Loading…
Reference in New Issue
Block a user