kcmr / vsce-remove-unused-imports

VS Code extension to remove unused ES6 imports inside JavaScript and TypeScript files
https://marketplace.visualstudio.com/items?itemName=kuscamara.remove-unused-imports
MIT License
17 stars 5 forks source link

Error on remove imports with TSX #1

Closed DavidBabel closed 2 years ago

DavidBabel commented 2 years ago

Hey there, i see some recent activity so i post my issue here :

image

My guess is a fail on typescript or jsx.

File :

import { PlusCircleOutlined } from "@ant-design/icons";
import { useQuery } from "@apollo/client";
import { Card } from "antd";
import type { NextPage } from "next";
import { useTranslation } from "react-i18next";

import { Title } from "@/_layout/Title";
import { ButtonLink } from "@/ButtonLink";
import { LoadingOrError } from "@/LoadingOrError";
import { NoDataFound } from "@/NoDataFound";
import { VideoCard } from "@/VideoCard";
import { Query, QueryFindFirstUserArgs } from "~/@types/generated/graphqlTypes";
import { whereIdIs } from "~/front/gql/helpers/graphql.helpers";
import { ONE_USER_QUERY } from "~/front/gql/queries";
import { useSession } from "~/front/hooks";

const colProps = {
  md: { span: 12 },
  span: 24,
  xl: { span: 6 },
};

const VideosPage: NextPage = () => {
  const { user } = useSession();
  const { t } = useTranslation();

  const { loading, data, error } = useQuery<Query, QueryFindFirstUserArgs>(
    ONE_USER_QUERY,
    whereIdIs(user?.id),
  );

  if (loading || error) {
    return <LoadingOrError error={error} loading={loading} />;
  }
  const userData = data?.findFirstUser;
  if (!userData) {
    return <NoDataFound dataName={String(t("pages.videos.no-datas"))} />;
  }

  return (
    <>

    </>
  );
};

export default VideosPage;
2022-02-05 12:26:33.168] [exthost] [error] SyntaxError: 'Const declarations' require an initialization value. (27:73)
    at Object._raise (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:119:2828)
    at Object.raiseWithData (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:119:2769)
    at Object.raise (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:119:2237)
    at Object.parseVar (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:26148)
    at Object.parseVarStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:22659)
    at Object.parseStatementContent (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:15356)
    at Object.parseStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:14313)
    at Object.parseStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:40542)
    at Object.parseBlockOrModuleBlockBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:24575)
    at Object.parseBlockBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:24421)
    at Object.parseBlock (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:24135)
    at Object.parseFunctionBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:5866)
    at /Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:39846
    at Object.forwardNoArrowParamsConversionAt (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:43861)
    at Object.parseFunctionBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:39801)
    at Object.parseArrowExpression (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:5266)
    at Object.parseParenAndDistinguishExpression (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:88794)
    at Object.parseParenAndDistinguishExpression (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:55371)
    at Object.parseExprAtom (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:82133)
    at Object.parseExprAtom (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:5294)
    at Object.parseExprSubscripts (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:76077)
    at Object.parseUpdate (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:75665)
    at Object.parseMaybeUnary (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:75261)
    at Object.parseExprOps (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:72396)
    at Object.parseMaybeConditional (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:71963)
    at Object.parseMaybeAssign (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:71230)
    at Object.parseMaybeAssign (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:54310)
    at /Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:70785
    at Object.allowInAnd (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:11333)
    at Object.parseMaybeAssignAllowIn (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:123:70765)
    at Object.parseVar (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:26054)
    at Object.parseVarStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:22659)
    at Object.parseStatementContent (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:15356)
    at Object.parseStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:14313)
    at Object.parseStatement (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:40542)
    at Object.parseBlockOrModuleBlockBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:24575)
    at Object.parseBlockBody (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:24421)
    at Object.parseProgram (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:13187)
    at Object.parseTopLevel (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:12945)
    at Object.parseTopLevel (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:121:57785)
    at Object.parse (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:43635)
    at Object.ioe [as parse] (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:124:44217)
    at Object.Oge [as parse] (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:2304:6728)
    at hL (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:17:889)
    at M_ (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:2304:7360)
    at q_ (/Users/davidbabel/.vscode/extensions/kuscamara.remove-unused-imports-1.0.4/dist/extension.js:2304:7610)
    at r._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:95:31080)
    at r.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:95:31622)
    at t._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:99:13802)
    at t._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:99:13486)
    at t._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:99:12148)
    at t._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:99:10826)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:99:8922
    at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
    at r.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:18942)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:114:34341
    at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
    at r.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:18942)
    at n._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:23523)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:21057
    at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
    at w.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:15770)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:14900
    at Socket.T (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:114:13813)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) remove-unused-imports.main {"value":"kuscamara.remove-unused-imports","_lower":"kuscamara.remove-unused-imports"}
kcmr commented 2 years ago

Hi! Thank you for reporting the issue. I'll try to look at it next week. In the meantime, could you share a repo where the error can be reproduced?

kcmr commented 2 years ago

Hi @DavidBabel

It is fixed with the last version (1.0.5).

Thanks for using it and reporting the issue :)