Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

allow other projects to use extends for our tslint.json #265

Closed
HamletDRC opened this issue Sep 20, 2016 · 8 comments
Closed

allow other projects to use extends for our tslint.json #265

HamletDRC opened this issue Sep 20, 2016 · 8 comments
Milestone

Comments

@HamletDRC
Copy link
Member

for PR #263

@HamletDRC HamletDRC modified the milestone: 2.0.11 Sep 22, 2016
@dsifford
Copy link
Contributor

@HamletDRC Thanks for your work on this. Absolutely amazing job!

I may be wrong, but I believe that in order for other projects to reference this using extends, you need to have a rulesDirectory set in your tslint.json file.

So, in this case, it would be "rulesDirectory": "./".

I was getting errors in Atom until I went in and made that change. 👍

@dsifford
Copy link
Contributor

Also, after making that change and simply adding it using extends, tslint threw "requires type checking" errors for no-for-in-array and restrict-plus-operands.

That said, because those two rules aren't documented and I'm not really sure what they are, it may very well just be an issue on my side, but I figured I'd toss this out there as well.

For now , I just changed those two rules to false and everything is working great.

Thanks again!

@HamletDRC
Copy link
Member Author

@dsifford no-for-in-array and restrict-plus-operands require you to configure tslint with --type-check and --program. Those are tslint rules, so more info is available here: https://github.com/palantir/tslint

For the rulesDirectory... I think that you need to add a rulesDirectory for tslint-microsoft-contrib in your main tslint configuration. Did you have a rulesDirectory already in your config? How do you run tslint, from command line or grunt?

@dsifford
Copy link
Contributor

dsifford commented Sep 23, 2016

@HamletDRC Thanks for the info Re: no-for-in-array and restrict-plus-operands.

You are correct that the extends does work if I add "rulesDirectory": "node_modules/tslint-microsoft-contrib" to my tslint.json. Having said that, I'm extending tslint:latest and tslint-react as well and both of those repos specify the rulesDirectory on their end. Wasn't sure if doing it that way was "best practice" or not.

Totally up to you, though I still would prefer it defined on your end.

Thanks so much again for your work on this. Super, super impressive!

@HamletDRC
Copy link
Member Author

Sure, I can add this. However... I won't cut a new release for it unless there is some other larger, more critical issue.

Thanks for the kind words. You know... you're free to help out. It's just a simple "git clone && npm install && grunt create-rule --rule-name=my-cool-rule" away :)

@dsifford
Copy link
Contributor

How do you run tslint, from command line or grunt?

Whoops, missed this question! I run it both from the command line and also using the linter-tslint Atom package.

@vyorkin
Copy link

vyorkin commented Feb 5, 2017

@HamletDRC @dsifford

no-for-in-array and restrict-plus-operands require require you to configure tslint with --type-check and --program. Those are tslint rules, so more info is available here: https://github.com/palantir/tslint

I think it would be useful to add this info to README, e.g. here, something very simple like:

  1. do this:
{
  "rulesDirectory": "node_modules/tslint-microsoft-contrib",
  "extends": "tslint-microsoft-contrib"
}
  1. use it like this: tslint --type-check --project tsconfig.json src/**/*.ts

examples:

https://github.com/palantir/tslint-react#usage
https://github.com/google/eslint-config-google#using-the-google-config-with-eslintrecommended

should I submit a PR?

@HamletDRC
Copy link
Member Author

@vyorkin I updated the readme. If you'd like to add/edit anything then feel free to submit a PR.

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

No branches or pull requests

3 participants