From 663380e721f1baf644c124d205d71ca87f98f72d Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Fri, 20 Oct 2023 12:44:58 -0700 Subject: [PATCH] mark unused vars as errors Reviewed By: lblasa Differential Revision: D50500690 fbshipit-source-id: 6f739fe25c232ecfe842337af4399681e85f6a13 --- desktop/.eslintrc.js | 2 +- desktop/app/src/init.tsx | 1 - desktop/flipper-plugin/src/ui/Container.tsx | 2 +- desktop/flipper-plugin/src/ui/NUX.tsx | 1 - desktop/flipper-plugin/src/ui/renderSplitLayout.tsx | 10 ++-------- .../flipper-server-core/src/devices/ios/IOSBridge.tsx | 2 +- desktop/flipper-server-core/src/server/utilities.tsx | 3 --- desktop/flipper-ui-browser/src/global.tsx | 2 ++ desktop/flipper-ui-core/src/chrome/PluginActions.tsx | 2 +- .../components/sidebar/inspector/ColorInspector.tsx | 7 ------- desktop/scripts/build-flipper-server-release.tsx | 2 +- desktop/scripts/build-utils.tsx | 2 +- desktop/scripts/start-flipper-server-dev.tsx | 2 +- desktop/scripts/tsc-plugins.tsx | 1 - 14 files changed, 11 insertions(+), 28 deletions(-) diff --git a/desktop/.eslintrc.js b/desktop/.eslintrc.js index 3f6c79bf9..c66b79852 100644 --- a/desktop/.eslintrc.js +++ b/desktop/.eslintrc.js @@ -204,7 +204,7 @@ module.exports = { 'no-dupe-class-members': 0, '@typescript-eslint/no-redeclare': 1, '@typescript-eslint/no-unused-vars': [ - 1, + 2, { ignoreRestSiblings: true, varsIgnorePattern: '^_', diff --git a/desktop/app/src/init.tsx b/desktop/app/src/init.tsx index 577c77f62..697d66c49 100644 --- a/desktop/app/src/init.tsx +++ b/desktop/app/src/init.tsx @@ -22,7 +22,6 @@ import { checkPortInUse, getAuthToken, getEnvironmentInfo, - hasAuthToken, setupPrefetcher, startFlipperServer, startServer, diff --git a/desktop/flipper-plugin/src/ui/Container.tsx b/desktop/flipper-plugin/src/ui/Container.tsx index bb3e10e1f..a7afb9c1c 100644 --- a/desktop/flipper-plugin/src/ui/Container.tsx +++ b/desktop/flipper-plugin/src/ui/Container.tsx @@ -7,7 +7,7 @@ * @format */ -import React, {CSSProperties, forwardRef} from 'react'; +import React from 'react'; import styled from '@emotion/styled'; import { normalizePadding, diff --git a/desktop/flipper-plugin/src/ui/NUX.tsx b/desktop/flipper-plugin/src/ui/NUX.tsx index b01b62f7b..1f7326375 100644 --- a/desktop/flipper-plugin/src/ui/NUX.tsx +++ b/desktop/flipper-plugin/src/ui/NUX.tsx @@ -16,7 +16,6 @@ import React, { } from 'react'; import {Badge, Tooltip, Typography, Button} from 'antd'; import styled from '@emotion/styled'; -import {keyframes} from '@emotion/css'; import reactElementToJSXString from 'react-element-to-jsx-string'; import {SandyPluginContext} from '../plugin/PluginContext'; import {createState} from 'flipper-plugin-core'; diff --git a/desktop/flipper-plugin/src/ui/renderSplitLayout.tsx b/desktop/flipper-plugin/src/ui/renderSplitLayout.tsx index f74de535f..62ccfab3f 100644 --- a/desktop/flipper-plugin/src/ui/renderSplitLayout.tsx +++ b/desktop/flipper-plugin/src/ui/renderSplitLayout.tsx @@ -7,15 +7,9 @@ * @format */ -import React, {CSSProperties, forwardRef} from 'react'; +import React, {CSSProperties} from 'react'; import styled from '@emotion/styled'; -import { - normalizePadding, - normalizeSpace, - PaddingProps, - Spacing, - theme, -} from './theme'; +import {normalizeSpace, Spacing, theme} from './theme'; import type {SplitLayoutProps} from './Layout'; import {Sidebar} from './Sidebar'; diff --git a/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx b/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx index 51f5230f7..1a50a26a8 100644 --- a/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx +++ b/desktop/flipper-server-core/src/devices/ios/IOSBridge.tsx @@ -27,7 +27,7 @@ export const ERR_NO_IDB_OR_XCODE_AVAILABLE = export const ERR_PHYSICAL_DEVICE_LOGS_WITHOUT_IDB = 'Cannot provide logs from a physical device without idb.'; -// eslint-disable-next-line @typescript-eslint/naming-convention +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars type iOSSimulatorDevice = { state: 'Booted' | 'Shutdown' | 'Shutting Down'; availability?: string; diff --git a/desktop/flipper-server-core/src/server/utilities.tsx b/desktop/flipper-server-core/src/server/utilities.tsx index 5e4aaf213..46764bbd5 100644 --- a/desktop/flipper-server-core/src/server/utilities.tsx +++ b/desktop/flipper-server-core/src/server/utilities.tsx @@ -7,10 +7,7 @@ * @format */ -import os from 'os'; -import xdgBasedir from 'xdg-basedir'; import net from 'net'; -import fs from 'fs-extra'; import fetch from 'node-fetch'; import {EnvironmentInfo} from 'flipper-common'; import semver from 'semver'; diff --git a/desktop/flipper-ui-browser/src/global.tsx b/desktop/flipper-ui-browser/src/global.tsx index 39705a833..edc96f165 100644 --- a/desktop/flipper-ui-browser/src/global.tsx +++ b/desktop/flipper-ui-browser/src/global.tsx @@ -7,6 +7,8 @@ * @format */ +// otherwise there is an error with `declare global` +// eslint-disable-next-line @typescript-eslint/no-unused-vars import type {RenderHost} from 'flipper-ui-core'; declare global { diff --git a/desktop/flipper-ui-core/src/chrome/PluginActions.tsx b/desktop/flipper-ui-core/src/chrome/PluginActions.tsx index 9ec4d225a..a2001a365 100644 --- a/desktop/flipper-ui-core/src/chrome/PluginActions.tsx +++ b/desktop/flipper-ui-core/src/chrome/PluginActions.tsx @@ -19,7 +19,7 @@ import {useCallback} from 'react'; import {useDispatch, useSelector} from 'react-redux'; import {PluginDefinition} from '../plugin'; import {startPluginDownload} from '../reducers/pluginDownloads'; -import {loadPlugin, switchPlugin} from '../reducers/pluginManager'; +import {switchPlugin} from '../reducers/pluginManager'; import { getActiveClient, getPluginDownloadStatusMap, diff --git a/desktop/plugins/public/ui-debugger/components/sidebar/inspector/ColorInspector.tsx b/desktop/plugins/public/ui-debugger/components/sidebar/inspector/ColorInspector.tsx index 3eef54560..bef843794 100644 --- a/desktop/plugins/public/ui-debugger/components/sidebar/inspector/ColorInspector.tsx +++ b/desktop/plugins/public/ui-debugger/components/sidebar/inspector/ColorInspector.tsx @@ -27,13 +27,6 @@ type Props = { color: Color; }; -const DefaultColor: Color = { - r: 255, - g: 255, - b: 255, - a: 1, -}; - const CenteredContentContainer = styled.div(AutoMarginStyle); const ObjectContainer = styled.div(ObjectContainerStyle); const NumberValue = styled.span(NumberAttributeValueStyle); diff --git a/desktop/scripts/build-flipper-server-release.tsx b/desktop/scripts/build-flipper-server-release.tsx index 7201b742e..3dddd977c 100644 --- a/desktop/scripts/build-flipper-server-release.tsx +++ b/desktop/scripts/build-flipper-server-release.tsx @@ -437,7 +437,7 @@ async function buildServerRelease() { await fs.mkdirp(path.join(dir, 'static', 'defaultPlugins')); await prepareDefaultPlugins(argv.channel === 'insiders'); - await compileServerMain(false); + await compileServerMain(); await copyStaticResources(dir, versionNumber); await linkLocalDeps(dir); await downloadIcons(path.join(dir, 'static')); diff --git a/desktop/scripts/build-utils.tsx b/desktop/scripts/build-utils.tsx index c99f843f5..cd6c4d750 100644 --- a/desktop/scripts/build-utils.tsx +++ b/desktop/scripts/build-utils.tsx @@ -279,7 +279,7 @@ export function genMercurialRevision(): Promise { .catch(() => null); } -export async function compileServerMain(dev: boolean) { +export async function compileServerMain() { console.log('⚙️ Compiling server sources...'); await exec(`cd ${serverDir} && yarn build`); console.log('✅ Compiled server sources.'); diff --git a/desktop/scripts/start-flipper-server-dev.tsx b/desktop/scripts/start-flipper-server-dev.tsx index aae4740e5..af87be91b 100644 --- a/desktop/scripts/start-flipper-server-dev.tsx +++ b/desktop/scripts/start-flipper-server-dev.tsx @@ -102,7 +102,7 @@ async function copyStaticResources() { async function restartServer() { try { - await compileServerMain(true); + await compileServerMain(); await launchServer(true, ++startCount === 1); // only open on the first time } catch (e) { console.error( diff --git a/desktop/scripts/tsc-plugins.tsx b/desktop/scripts/tsc-plugins.tsx index 28912149b..a04ea5067 100644 --- a/desktop/scripts/tsc-plugins.tsx +++ b/desktop/scripts/tsc-plugins.tsx @@ -16,7 +16,6 @@ import {EOL} from 'os'; import pmap from 'p-map'; import {rootDir} from './paths'; import yargs from 'yargs'; -import {isPluginJson} from 'flipper-common'; const argv = yargs .usage('yarn tsc-plugins [args]')