Skip to content

import/order doesn't work #1490

@thany

Description

@thany

Let's say these are my imports:

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import ListIcons from 'FrontEndBase/components/molecules/lists/ListIcons';
import Heading from 'FrontEndBase/components/atoms/text/Heading';

This is the order I want. So, in my .eslintrc:

"import/order": "error"

And it correctly gives me no error on those imports. So far so good 😀

Next I try to make it spew out an error by mixing up my imports:

import ListIcons from 'FrontEndBase/components/molecules/lists/ListIcons';
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import Heading from 'FrontEndBase/components/atoms/text/Heading';

And still no error.
Wait. That's wrong. Imports 'react' and 'prop-types' do exist in node_modules and the others don't. So the ones that don't, should not be considered external and should not be allowed to be mixed in with external. So why are they? External should come first by default.

The imports are correctly processed, and the ones starting with FrontEndBase are definitely in our project, hence not external.

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