autofix unused imports

This commit is contained in:
Michael Peters 2021-12-13 18:29:20 -06:00
parent 7820853def
commit 97bb08c255
23 changed files with 65 additions and 30 deletions

View File

@ -4,6 +4,9 @@ watch-tsc:
watch-sass:
./node_modules/.bin/sass --watch ./src/client/webapp/styles/styles.scss ./dist/client/webapp/styles/styles.css
lint-autofix:
./node_modules/.bin/eslint ./src --ext .js,.jsx,.ts,.tsx --fix
lint:
./node_modules/.bin/eslint ./src --ext .js,.jsx,.ts,.tsx

46
package-lock.json generated
View File

@ -38,6 +38,7 @@
"@typescript-eslint/parser": "^5.5.0",
"electron": "^15.3.0",
"eslint": "^8.4.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^27.4.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
@ -3108,6 +3109,36 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-unused-imports": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz",
"integrity": "sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==",
"dev": true,
"dependencies": {
"eslint-rule-composer": "^0.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^8.0.0"
},
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
"optional": true
}
}
},
"node_modules/eslint-rule-composer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz",
"integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==",
"dev": true,
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@ -10424,6 +10455,21 @@
}
}
},
"eslint-plugin-unused-imports": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz",
"integrity": "sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==",
"dev": true,
"requires": {
"eslint-rule-composer": "^0.3.0"
}
},
"eslint-rule-composer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz",
"integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==",
"dev": true
},
"eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",

View File

@ -36,6 +36,7 @@
"@typescript-eslint/parser": "^5.5.0",
"electron": "^15.3.0",
"eslint": "^8.4.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^27.4.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",

View File

@ -4,6 +4,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'unused-imports'
],
extends: [
'eslint:recommended',
@ -11,6 +12,7 @@ module.exports = {
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off"
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "warn"
}
};

View File

@ -5,7 +5,6 @@ const LOG = Logger.create(__filename, electronConsole);
import { AutoVerifier, AutoVerifierChangesType } from "./auto-verifier";
import { Changes, WithEquals } from "./data-types";
import Q from './q-module';
export interface PartialMessageListQuery {
channelId: string;

View File

@ -4,8 +4,8 @@ import Logger from '../../../../logger/logger';
const LOG = Logger.create(__filename, electronConsole);
import electron from 'electron';
import React, { FC, useCallback, useEffect, useRef, useState } from 'react';
import { Resource, ShouldNeverHappenError } from '../../data-types';
import React, { FC, useCallback, useEffect, useState } from 'react';
import { ShouldNeverHappenError } from '../../data-types';
import CombinedGuild from '../../guild-combined';
import Util from '../../util';
import Globals from '../../globals';

View File

@ -1,4 +1,4 @@
import React, { ChangeEvent, createRef, FC, MouseEvent, MouseEventHandler, useCallback, useEffect, useMemo, useState } from 'react';
import React, { createRef, FC, MouseEvent, useCallback, useEffect, useMemo, useState } from 'react';
export interface DropdownInputProps {
label?: string;

View File

@ -8,7 +8,6 @@ import ElementsUtil from '../require/elements-util';
import * as FileType from 'file-type';
import * as crypto from 'crypto';
interface ImageEditInputProps {
alt?: string;

View File

@ -1,4 +1,4 @@
import moment, { Duration } from 'moment';
import { Duration } from 'moment';
import React, { FC, useMemo } from 'react';
export interface InvitePreviewProps {

View File

@ -3,8 +3,7 @@ const electronConsole = electronRemote.getGlobal('console') as Console;
import Logger from '../../../../logger/logger';
const LOG = Logger.create(__filename, electronConsole);
import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from "react";
import ReactDOM from "react-dom";
import React, { FC, useMemo, useRef, useState } from "react";
import ElementsUtil from '../require/elements-util';
interface OverlayProps {

View File

@ -5,7 +5,6 @@ const LOG = Logger.create(__filename, electronConsole);
import ElementsUtil from './require/elements-util.js';
import BaseElements from './require/base-elements.js';
import { GuildMetadata } from '../data-types';
import Q from '../q-module';
import UI from '../ui';
@ -16,7 +15,6 @@ import CombinedGuild from '../guild-combined';
import React from 'react';
import ReactHelper from './require/react-helper';
import GuildSettingsOverlay from './overlays/overlay-guild-settings';
import ErrorMessageOverlay from './overlays/overlay-error-message';
import CreateChannelOverlay from './overlays/overlay-create-channel';
export default function createGuildTitleContextMenu(document: Document, q: Q, ui: UI, guild: CombinedGuild): Element {

View File

@ -5,13 +5,11 @@ const LOG = Logger.create(__filename, electronConsole);
import React, { Dispatch, FC, SetStateAction, useCallback, useEffect, useMemo, useState } from 'react';
import { GuildMetadata } from '../../data-types';
import Globals from '../../globals';
import CombinedGuild from '../../guild-combined';
import Display from '../components/display';
import TextInput from '../components/input-text';
import ImageEditInput from '../components/input-image-edit';
import ReactHelper from '../require/react-helper';
import GuildSubscriptions from '../require/guild-subscriptions';
export interface GuildOverviewDisplayProps {

View File

@ -15,7 +15,6 @@ import CombinedGuild from '../guild-combined';
import React from 'react';
import ReactHelper from './require/react-helper';
import BaseElements from './require/base-elements';
import ImageOverlay from './overlays/overlay-image';
export default function createImageResourceMessage(document: Document, q: Q, guild: CombinedGuild, message: Message): Element {

View File

@ -3,7 +3,7 @@ const electronConsole = electronRemote.getGlobal('console') as Console;
import Logger from '../../../../logger/logger';
const LOG = Logger.create(__filename, electronConsole);
import React, { createRef, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { createRef, FC, useCallback, useEffect, useMemo, useState } from 'react';
import CombinedGuild from '../../guild-combined';
import BaseElements from '../require/base-elements';
import TextInput from '../components/input-text';

View File

@ -5,10 +5,9 @@ const LOG = Logger.create(__filename, electronConsole);
import * as FileType from 'file-type';
import React, { FC, useEffect, useMemo, useState } from 'react';
import React, { FC, useMemo } from 'react';
import CombinedGuild from '../../guild-combined';
import ElementsUtil from '../require/elements-util';
import { Resource } from '../../data-types';
import DownloadButton from '../components/button-download';
import createImageContextMenu from '../context-menu-img';
import Q from '../../q-module';

View File

@ -3,7 +3,7 @@ const electronConsole = electronRemote.getGlobal('console') as Console;
import Logger from '../../../../logger/logger';
const LOG = Logger.create(__filename, electronConsole);
import React, { createRef, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { createRef, FC, useCallback, useEffect, useMemo, useState } from 'react';
import CombinedGuild from '../../guild-combined';
import BaseElements from '../require/base-elements';
import TextInput from '../components/input-text';

View File

@ -3,7 +3,6 @@ const electronConsole = electronRemote.getGlobal('console') as Console;
import Logger from '../../../../logger/logger';
const LOG = Logger.create(__filename, electronConsole);
import moment from 'moment';
import React, { createRef, FC, useCallback, useEffect, useMemo, useState } from 'react';
import { ConnectionInfo } from '../../data-types';
import Globals from '../../globals';
@ -12,7 +11,6 @@ import ImageEditInput from '../components/input-image-edit';
import TextInput from '../components/input-text';
import SubmitOverlayLower from '../components/submit-overlay-lower';
import ElementsUtil from '../require/elements-util';
import ReactHelper from '../require/react-helper';
import GuildSubscriptions from '../require/guild-subscriptions';
export interface PersonalizeOverlayProps {

View File

@ -14,9 +14,7 @@ import { Channel } from '../../data-types';
import CombinedGuild from '../../guild-combined';
import Q from '../../q-module';
import ReactHelper from './react-helper';
import Overlay from '../components/overlay';
import ReactDOM from 'react-dom';
export interface HTMLElementWithRemoveSelf extends HTMLElement {
removeSelf: (() => void);
}

View File

@ -6,7 +6,7 @@ const LOG = Logger.create(__filename, electronConsole);
import { Changes, GuildMetadata, Resource } from "../../data-types";
import CombinedGuild from "../../guild-combined";
import React, { DependencyList, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { AutoVerifierChangesType } from "../../auto-verifier";
import { Conflictable, Connectable } from "../../guild-types";
import { EventEmitter } from 'tsee';

View File

@ -1,5 +1,4 @@
import { Changes, Channel, GuildMetadata, Member, Message, Resource, Token } from './data-types';
import { DefaultEventMap, EventEmitter } from 'tsee';
import { AutoVerifierChangesType } from './auto-verifier';
import { IDQuery, PartialMessageListQuery } from './auto-verifier-with-args';

View File

@ -1,4 +1,3 @@
import strcmp from "../../strcmp/strcmp";
import { Message, ShouldNeverHappenError } from "./data-types";
import Globals from "./globals";

View File

@ -17,8 +17,7 @@ import createChannel from './elements/channel';
import createMember from './elements/member';
import GuildsManager from './guilds-manager';
import createMessage from './elements/message';
import strcmp from '../../strcmp/strcmp';
interface SetMessageProps {
atTop: boolean;
atBottom: boolean;

View File

@ -1,7 +1,6 @@
import * as fs from 'fs/promises';
import * as path from 'path';
import * as crypto from 'crypto';
import * as FileType from 'file-type';
import { ExitCodes, ExitCode } from '../../exit-codes/exit-codes';