Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order's newlines-between doesn't work with multiline import statements #313

Closed
singles opened this issue May 6, 2016 · 6 comments
Closed

Comments

@singles
Copy link
Contributor

singles commented May 6, 2016

Settings newlines-between: always

Not working examples:

import FurtherStepsHeadline // invalid error report here: There should be no empty line within import group  import/order
   from '../../../../../../app/components/pages/contentFunnel/donePartials/FurtherStepsHeadline';
import { expect } from 'chai';

import RangeType, { // invalid error report here: There should be no empty line within import group  import/order
    isFullRange,
    isPartialRange,
} from '../../../../app/lib/dateRange';
local: {
    launch_url: 'http://localhost:${APPLICATION_PORT}',
    selenium_host: 'localhost',
    selenium_port: 4444,
    selenium: {
        start_process: true,
        server_path: require('selenium-server-standalone-jar').path, // invalid error report here: There should be no empty line within import group  import/order
        cli_args: {
            'webdriver.chrome.driver': require('chromedriver').path
        }
    },
    desiredCapabilities: {
        browserName: 'chrome'
    }
},

I will fix this ASAP.

@benmosher
Copy link
Member

For that last one: might want to iterate body in Program + BlockStatement visitors vs. checking all CallExpressions.

I think that would match what people expect for require. Also, should be able to reuse the same visitor implementation for both, each has a body Array of statements.

@jfmengels
Copy link
Collaborator

jfmengels commented May 6, 2016

I thought of another case when newlines-between: "never":

import { expect } from 'chai';
import 'loud-rejection';
import _ from 'lodash';

In this case, loud-rejection will be ignored as it isn't assigned to a variable (see jfmengels/eslint-plugin-import-order#5 for the discussion if you're interested). I haven't tested it, but I have a suspicion that this would trigger an error too.

Could you add test for it, and fix it there's an error?

@singles
Copy link
Contributor Author

singles commented May 9, 2016

@jfmengels Yeah, I'll have a look.

@benmosher
Copy link
Member

@singles Should this be closed now that 339 is merged?

@jfmengels
Copy link
Collaborator

Yes :)

@benmosher
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants