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

Can't extend custom TSLint config #51

Open
davidchin opened this issue Sep 11, 2018 · 8 comments
Open

Can't extend custom TSLint config #51

davidchin opened this issue Sep 11, 2018 · 8 comments

Comments

@davidchin
Copy link

I have a shared TSLint config that I use in multiple projects. i.e.:

{ "extends": "@bigcommerce/tslint-config" }

However, this doesn't work because @bigcommerce/tslint-config is not available in the environment. Do you have any idea on how to extend custom TSLint config?

@wingrunr21
Copy link
Contributor

We use the prepare step to download the config from GitHub and overwrite the one in the repo. If you have local overrides in your config you'll have to use multiple config files and have one require the other.

@arboleya
Copy link

@davidchin Were you able to get it working somehow?

@wingrunr21 Could you pls give some code sample of how you're getting around this problem?

@wingrunr21
Copy link
Contributor

Well, it's basically what I said above. We do this for our shared TSLint config

...
prepare:
  fetch:
    - url: 'https://raw.githubusercontent.com/GuildEducationInc/tslint-config-guild/v1.0.0/tslint.json'
      path: 'tslint.json'
...

@arboleya
Copy link

@wingrunr21 I believe this is to share the same config among multiple projects, right?

However, I'm still failing to see how this could solve the problem of the dependencies not being available in the environment -- as noted in the original question.

@wingrunr21
Copy link
Contributor

That’s not the original question. The very last sentence asks how to extend a shared config.

@arboleya
Copy link

I believe the root problem of this issue isn't related to what you're saying, unfortunately.

Here's the thing, when you try to extend some custom tslint config that comes from another npm package, it won't be available in the [codeclimate] environment where the analysis runs.

With that said, and back to your config again, it seems you made use of 2x tslint configs that comes from npm packages.

I wonder if those are available in the [codeclimate] environment when you push new code.

@wingrunr21
Copy link
Contributor

wingrunr21 commented Sep 22, 2018

Take it or leave it. We use this across many projects for both TSLint and ESLint configs and it properly brings our shared configs into our repos for CodeClimate analysis. I know it works. The only aspect that doesn't work is when our shared configs depend on upstream configs that aren't in the engine (eg tslint-no-circular-imports). The ESLint engine just fails to load those rule sets and fails the rule. The TSLint engine is a bit less robust.

You may want to go read the prepare docs. We aren't using 2x configs as the config in our repos is under the file tslint.json. The prepare step replaces that config with the one downloaded from GitHub. This basically "inlines" the shared config prior to the analysis. If your shared config is just a bunch of rule sets (as is the case with the @bigcommerce/tslint-config config) and doesn't depend on upstream shared configs, then this method will work seamlessly and is thus why I posted it here.

@arboleya
Copy link

The only aspect that doesn't work looks to me like the only problem.

But I got your points and how you override your config file.

Thank you for the insights.

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

No branches or pull requests

3 participants