chore: fix eslint

This commit is contained in:
Ezequiel Bergamaschi 2021-02-16 22:47:09 -05:00
parent 262c629bf6
commit 569a6649a8
19 changed files with 44 additions and 61 deletions

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v15.3.0

View File

@ -21,12 +21,6 @@
"contributors": [ "contributors": [
"Ezequiel Bergamaschi" "Ezequiel Bergamaschi"
], ],
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"engines": { "engines": {
"node": ">=15.3.0", "node": ">=15.3.0",
"npm": ">=7.0.14" "npm": ">=7.0.14"

View File

@ -26,11 +26,11 @@
"eslint": "^7.14.0", "eslint": "^7.14.0",
"eslint-plugin-react": "^7.21.5", "eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"file-loader": "^6.2.0",
"html-webpack-dynamic-env-plugin": "^0.0.2", "html-webpack-dynamic-env-plugin": "^0.0.2",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^4.5.0",
"sass-loader": "^10.1.0", "sass-loader": "^10.1.0",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1",
"ts-loader": "^8.0.11", "ts-loader": "^8.0.11",
"ts-node": "^9.0.0", "ts-node": "^9.0.0",
"typescript": "^4.1.2", "typescript": "^4.1.2",

View File

@ -1,2 +1,2 @@
declare module '*.png'; declare module '*.png';
declare module '*.svg';

View File

@ -16,11 +16,6 @@ export class Locale {
} }
export default class AppI18n { export default class AppI18n {
constructor() {
}
public getUserLocale(): Locale { public getUserLocale(): Locale {
const account = fetchAccount(); const account = fetchAccount();
return account ? account.locale : this.getBrowserLocale(); return account ? account.locale : this.getBrowserLocale();

View File

@ -54,7 +54,7 @@ export type FieldError = {
export type ErrorInfo = { export type ErrorInfo = {
msg?: string; msg?: string;
fields?: Map<String, String>; fields?: Map<string, string>;
} }
export type AccountInfo = { export type AccountInfo = {

View File

@ -1,5 +1,5 @@
import Client, { AccountInfo, BasicMapInfo, ChangeHistory, ImportMapInfo, Label, MapInfo, NewUser } from '..'; 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 { class MockClient implements Client {
private maps: MapInfo[] = []; private maps: MapInfo[] = [];
private labels: Label[] = []; private labels: Label[] = [];
@ -124,7 +124,7 @@ class MockClient implements Client {
fields: fieldErrors fields: fieldErrors
}) })
}; }
} }
fetchHistory(id: number): Promise<ChangeHistory[]> { fetchHistory(id: number): Promise<ChangeHistory[]> {
const result = [{ const result = [{
@ -196,7 +196,7 @@ class MockClient implements Client {
fields: fieldErrors fields: fieldErrors
}) })
}; }
} }
deleteLabel(id: number): Promise<void> { deleteLabel(id: number): Promise<void> {

View File

@ -381,7 +381,7 @@ export default class RestClient implements Client {
if (data) { if (data) {
// Set global errors ... // Set global errors ...
result = {}; result = {};
let globalErrors = data.globalErrors; const globalErrors = data.globalErrors;
if (globalErrors && globalErrors.length > 0) { if (globalErrors && globalErrors.length > 0) {
result.msg = globalErrors[0]; result.msg = globalErrors[0];
} }

View File

@ -2,6 +2,8 @@ import React from 'react'
import { FormattedMessage } from 'react-intl' import { FormattedMessage } from 'react-intl'
import { StyledFooter } from './styled' import { StyledFooter } from './styled'
// FIXME: use SVG loader
// eslint-disable-next-line
const poweredByIcon = require('../../../images/pwrdby-white.svg') const poweredByIcon = require('../../../images/pwrdby-white.svg')
const Footer = () => { const Footer = () => {

View File

@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
const logo = require('../../../images/logo-small.svg') import logo from '../../../images/logo-small.svg';
interface HeaderProps { interface HeaderProps {
type: 'only-signup' | 'only-signin' | 'none'; type: 'only-signup' | 'only-signin' | 'none';
@ -46,7 +46,7 @@ class Header extends React.Component<HeaderProps, HeaderProps> {
</StyledDiv> </StyledDiv>
</StyledNav> </StyledNav>
) )
}; }
} }
interface ButtonProps { interface ButtonProps {

View File

@ -31,16 +31,18 @@ const DeleteDialog = ({ mapId, onClose } : SimpleDialogProps) => {
// Fetch map model to be rendered ... // Fetch map model to be rendered ...
const { map } = fetchMapById(mapId); const { map } = fetchMapById(mapId);
const alertTitle = `Delete ${map?.title}`;
return ( return (
<div> <div>
<BaseDialog <BaseDialog
onClose={handleOnClose} onSubmit={handleOnSubmit} onClose={handleOnClose} onSubmit={handleOnSubmit}
title={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" })} > submitButton={intl.formatMessage({id: "action.delete-title", defaultMessage: "Delete"})}>
<Alert severity="warning"> <Alert severity="warning">
<AlertTitle>Delete '{map?.title}'</AlertTitle> <AlertTitle>{alertTitle}</AlertTitle>
<FormattedMessage id="action.delete-description" defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?." /> <FormattedMessage id="action.delete-description"
defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?."/>
</Alert> </Alert>
</BaseDialog> </BaseDialog>

View File

@ -66,7 +66,7 @@ const ImportDialog = ({onClose}: CreateProps) => {
if (files) { if (files) {
const file = files[0]; const file = files[0];
var title = file.name; let title = file.name;
title = title.substring(0, title.lastIndexOf(".")); title = title.substring(0, title.lastIndexOf("."));
// Closure to capture the file information. // Closure to capture the file information.
@ -77,7 +77,7 @@ const ImportDialog = ({onClose}: CreateProps) => {
// Suggest file name ... // Suggest file name ...
const fileName = file.name; const fileName = file.name;
if (fileName) { if (fileName) {
var title = fileName.split('.')[0] const title = fileName.split('.')[0]
if (!model.title || 0 === model.title.length) { if (!model.title || 0 === model.title.length) {
model.title = title; model.title = title;
} }

View File

@ -16,7 +16,6 @@ import List from '@material-ui/core/List';
const InfoDialog = ({ mapId, onClose }: SimpleDialogProps) => { const InfoDialog = ({ mapId, onClose }: SimpleDialogProps) => {
const { map } = fetchMapById(mapId); const { map } = fetchMapById(mapId);
const [error, setError] = React.useState<ErrorInfo>(); const [error, setError] = React.useState<ErrorInfo>();
const [] = React.useState('1');
const intl = useIntl(); const intl = useIntl();
const classes = useStyles(); const classes = useStyles();

View File

@ -39,9 +39,8 @@ import Link from '@material-ui/core/Link';
import ListItemText from '@material-ui/core/ListItemText'; import ListItemText from '@material-ui/core/ListItemText';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import logoIcon from '../../images/logo-small.svg';
const logoIcon = require('../../images/logo-small.svg'); import poweredByIcon from '../../images/pwrdby-white.svg';
const poweredByIcon = require('../../images/pwrdby-white.svg');
export type Filter = GenericFilter | LabelFilter; export type Filter = GenericFilter | LabelFilter;

View File

@ -35,7 +35,7 @@ import StarRateRoundedIcon from '@material-ui/icons/StarRateRounded';
import SearchIcon from '@material-ui/icons/Search'; import SearchIcon from '@material-ui/icons/Search';
// Load fromNow pluggin // Load fromNow pluggin
const relativeTime = require('dayjs/plugin/relativeTime') import relativeTime from 'dayjs/plugin/relativeTime';
dayjs.extend(relativeTime); dayjs.extend(relativeTime);
@ -295,7 +295,7 @@ export const MapsList = (props: MapsListProps) => {
const starredMultation = useMutation<void, ErrorInfo, number>((id: number) => { const starredMultation = useMutation<void, ErrorInfo, number>((id: number) => {
const map = mapsInfo.find(m => m.id == id); const map = mapsInfo.find(m => m.id == id);
return client.updateStarred(id, !Boolean(map?.starred)); return client.updateStarred(id, !map?.starred);
}, },
{ {
onSuccess: () => { onSuccess: () => {

View File

@ -12,11 +12,6 @@ interface ConfigInfo {
class RutimeConfig { class RutimeConfig {
private config: ConfigInfo; private config: ConfigInfo;
constructor() {
}
load() { load() {
// Config can be inserted in the html page to define the global properties ... // Config can be inserted in the html page to define the global properties ...

View File

@ -30,6 +30,7 @@ module.exports = {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
esModule: false, esModule: false,
name: '[name].[ext]',
} }
}] }]
}, },

View File

@ -2603,6 +2603,11 @@ dateformat@^3.0.0:
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" 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: debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
version "2.6.9" version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@ -3406,9 +3411,10 @@ file-entry-cache@^6.0.0:
dependencies: dependencies:
flat-cache "^3.0.4" flat-cache "^3.0.4"
file-loader@~6.2.0: file-loader@^6.2.0:
version "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: dependencies:
loader-utils "^2.0.0" loader-utils "^2.0.0"
schema-utils "^3.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" emojis-list "^3.0.0"
json5 "^1.0.1" json5 "^1.0.1"
loader-utils@^2.0.0, loader-utils@~2.0.0: loader-utils@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
dependencies: dependencies:
@ -5254,10 +5260,6 @@ modify-values@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" 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: move-concurrently@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" 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: dependencies:
has-flag "^4.0.0" 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: symbol-observable@1.2.0, symbol-observable@^1.2.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"