Skip to content

import/order doesn't sort assets that aren't assigned to a variable (e.g. import './file.css') #1639

@moonray

Description

@moonray

When sorting imports, any assets that aren't assigned to a variable are ignored, and break/mess with sorting of other imports.

e.g.

import mapboxgl from 'mapbox-gl';

import './file.json';
import './file.css';
import './file.png';
import React from 'react';
import { ToastContainer } from 'react-toastify';

import { ErrorBoundary } from '@app/components';
import { useAccount, useUser } from 'src/state';

import mygif from './file.gif';
import Routes from './Routes';

If I change the above and assign assets to a variable, sorting is applied as expected.

import mapboxgl from 'mapbox-gl';
import React from 'react';
import { ToastContainer } from 'react-toastify';

import { ErrorBoundary } from '@app/components';
import { useAccount, useUser } from 'src/state';

import b from './file.css';
import mygif from './file.gif';
import a from './file.json';
import c from './file.png';
import Routes from './Routes';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions