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

[New] order: Add support for TypeScript's "import equals"-expressions #1785

Merged
merged 1 commit into from
May 30, 2020
Merged

[New] order: Add support for TypeScript's "import equals"-expressions #1785

merged 1 commit into from
May 30, 2020

Conversation

manuth
Copy link
Contributor

@manuth manuth commented May 29, 2020

This PR will add support for TypeScript's import =-syntax.

TypeScript not only allows you to import modules using import path = require("path"), but also to import entities for easier access:

import { Rule } from "eslint";
import RuleContext = Rule.RuleContext;

As the 2nd sort of import doesn't refer to a module, the name of this import will be set to null.
The sorting-functions for alphabetized imports has been updated according to this change.

Object-imports (which have their name set to null) will be forced to be put at the end of the group.

This PR fixes #1244

@ljharb ljharb changed the title Add support for TypeScript's "import equals"-expressions [New] order: Add support for TypeScript's "import equals"-expressions May 29, 2020
@coveralls
Copy link

coveralls commented May 29, 2020

Coverage Status

Coverage increased (+0.003%) to 97.741% when pulling 62b554b on manuth:import-equals into 2e72af5 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 97.74% when pulling 2c61a52 on manuth:import-equals into 3f46ccf on benmosher:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 97.74% when pulling 2c61a52 on manuth:import-equals into 3f46ccf on benmosher:master.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending nits

src/rules/order.js Outdated Show resolved Hide resolved
src/rules/order.js Outdated Show resolved Hide resolved
tests/src/rules/order.js Outdated Show resolved Hide resolved
tests/src/rules/order.js Outdated Show resolved Hide resolved
tests/src/rules/order.js Outdated Show resolved Hide resolved
@manuth
Copy link
Contributor Author

manuth commented May 29, 2020

Sorry - totally forgot to have a look at the code-formatting of this project 😅

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i messed up the syntax in my suggestions

tests/src/rules/order.js Outdated Show resolved Hide resolved
tests/src/rules/order.js Outdated Show resolved Hide resolved
tests/src/rules/order.js Outdated Show resolved Hide resolved
@ljharb ljharb merged commit 62b554b into import-js:master May 30, 2020
@manuth manuth deleted the import-equals branch May 31, 2020 00:47
@manuth manuth restored the import-equals branch May 31, 2020 00:47
@manuth
Copy link
Contributor Author

manuth commented May 31, 2020

@ljharb will a minor release be created automatically?

@ljharb
Copy link
Member

ljharb commented May 31, 2020

No, I'll be cutting one after I clear through my current notification/PR backlog.

@manuth
Copy link
Contributor Author

manuth commented May 31, 2020

Awesome, thank you very much! 😄

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

Successfully merging this pull request may close these issues.

Support TypeScript import = require syntax
3 participants