Skip to content

Support a converter for no-reference-import rule #368

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

Conversation

moznion
Copy link
Contributor

@moznion moznion commented Apr 1, 2020

PR Checklist

Overview

Support a rule no-reference-import.

If this patch was applied,

{
  "rules": {
    "no-reference-import": true
  }
}

this rule will be converted to

    "rules": {
        "@typescript-eslint/triple-slash-reference": [
            "error",
            {
                "path": "always",
                "types": "prefer-import",
                "lib": "always",
            }
        ]
    }

Note

I think "path": "always" and "lib": "always" are not needed, but path one is necessary because if that was omitted, the ESLint points out the violation caused by reference of path.

reploducing code:

/// <reference path="foo" />
/// <reference types="bar" />
/// <reference lib="buz" />
import b from "bar";

Originally the lib's one isn't needed, but I put it on the code for consistency.
(I wonder if this should be an issue of typescript-eslint?)

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

This looks great, thanks! 🙌

Yeah I found the typescript-eslint docs page a little confusing... but since this works, and it's similar to what they recommend, it works for me 🤷‍♂.

@JoshuaKGoldberg JoshuaKGoldberg merged commit 9623e76 into typescript-eslint:master Apr 1, 2020
@moznion moznion deleted the support_converter_no-reference-import branch April 1, 2020 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A converter for no-reference-import is missing
2 participants