daidodo / format-imports-vscode

Format imports and exports for JavaScript and TypeScript in VS Code.
https://marketplace.visualstudio.com/items?itemName=dozerg.tsimportsorter
MIT License
62 stars 5 forks source link

Exception: Expected true but got false. #94

Open jeanalves28 opened 1 year ago

jeanalves28 commented 1 year ago

Code snippet triggering the exception

import React, { useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import profileIcon from '../images/profileIcon.svg';
import searchIcon from '../images/searchIcon.svg';
import SearchBar from './SearchBar';
import '../styles/App.css';

export default function Header() {
  const [search, setSearch] = useState(false);
  const { pathname } = useLocation();
  const searchClick = () => {
    setSearch(!search);
  };
  return (
    <main className="headerfix">
      <header className="headerfix">
        <button
          style={ { background: 'none', border: 'none', marginLeft: '90px' } }
          onClick={ searchClick }
        >
          <img
            src={ searchIcon }
            alt="profile-icon"
            data-testid="search-top-btn"
          />
        </button>
        <h1 data-testid="page-title">
          {pathname.replace(
            /(.+)(\b\w)((?!\b\w)\w+)/,
            (all, p1, p2, p3) => `${p2.toUpperCase()}${p3}`,
          )}
        </h1>
        <Link to="/profile">
          <img
            alt="profile-icon"
            data-testid="profile-top-btn"
            src={ profileIcon }
          />
        </Link>
      </header>
      {
        search && <SearchBar />
      }
    </main>
  );
}

All Logs

(Please open the output channel for "JS/TS Import/Export Sorter" and copy/paste ALL logs here)


[2023-02-09T22:20:47.680] [ERROR] vscode.formatDocument - Found exception: Error: Expected true but got false.
    at p (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1145)
    at t.assertTrue (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:474)
    at Object.compose (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1739587)
    at l (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1741826)
    at l (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1741954)
    at t.composeParts (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1742036)
    at d.composeDecl (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1766893)
    at d.composeImport (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1765794)
    at d.compose (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1764763)
    at c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1780315
    at Array.map (<anonymous>)
    at compose (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1780305)
    at c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1780217
    at Array.map (<anonymous>)
    at compose (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1780207)
    at c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1756734
    at t.formatSource (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1756747)
    at l (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:2:1757717)
    at t.formatDocument (c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:23:492676)
    at c:\Users\merce\.vscode\extensions\dozerg.tsimportsorter-7.6.1\out\extension.js:23:487875
    at async Promise.all (index 0)