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

How to use Standard with TypeScript in Sublime Text 3? #1357

Open
gaborluk opened this issue Aug 13, 2019 · 4 comments

Comments

@gaborluk
Copy link

commented Aug 13, 2019

Now that TSLint is deprecated, is there a way to use Standard and TypeScript and SublimeLinter together? Using the docs, I have managed to make Standard and TypeScript, as well as Standard and SublimeLinter play together respectively, but I don't know how to go about integrating all three. Has anyone managed to do it? Your help would be much appreciated.

@feross

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

This is related to #1283, but I'll leave this issue open in case other users have tips about specifica workaround to get Standard, TypeScript, and Sublime working nicely together.

Eventually, I'd like to improve this experience substantially, but that discussion is happening in #1283.

@feross feross added the question label Aug 13, 2019

@gaborluk

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

Thank you, @feross. I think you may have (partially) misinterpreted my question, which may be my bad, I apologize if I phrased it confusingly. I was looking for a recommended way of making these three work nicely together, in other words, I wasn't (yet) experiencing a particular problem that the participants on #1283 seem to be having.

In any case, I have since figured out a way. So for all of those in the same shoes as I was in yesterday, you will need to use ESLint directy, as opposed to Standard which uses it internally. The components you'll need are:

The eslint-config-standard-with-typescript usage instructions will give you all the npm dependencies you need. (Please note: Since @typescript-eslint/eslint-plugin, a dependency of eslint-config-standard-with-typescript, has just been updated to version 2.0.0 introducing breaking changes, if you follow the install instructions verbatim from the usage instructions above, you will be experiencing issues. To temporarily circumvent those while support for the new dependency version is added, install @typescript-eslint/eslint-plugin at version 1.13.0 instead. All other dependencies are fine at the moment.)

Other than these, you will need an .eslintrc.json (as shown in the usage instructions above), and may need a tsconfig.json.

For SublimeLinter to work properly, add this in Preferences > Package settings > SublimeLinter > Settings:

// SublimeLinter Settings - User
{
  "linters": {
    "eslint": {
      "selector": "source.ts"
    }
  }
}

If you need the linting to happen for a different file type, get your hands on the proper selector by opening a blank file, setting its file type to the desired one, and going to Tools > Developer > Show Scope Name for the scope string. Copy this string to the selector field in the above code snippet, and you should be all set. (selector docs)

@mightyiam

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2019

@gaborluk

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

Good idea, @mightyiam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.