Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

extends config option works only from commandline #570

Open
cueedee opened this issue Jul 15, 2016 · 3 comments
Open

extends config option works only from commandline #570

cueedee opened this issue Jul 15, 2016 · 3 comments

Comments

@cueedee
Copy link

cueedee commented Jul 15, 2016

When employing the coffeelint API directly instead of through the commandline, passing in a config containing an extends option, it is simply ignored.

coffeelint.lint(
    someFile
    extends: 'coffeelint-config-foobar'
    literate
)

Caught while fully expecting extends to work from grunt-coffeelint.

@AsaAyers
Copy link
Collaborator

This was as designed because when using the app you may not have file
system access. For example, coffeelint.com uses the api.

I'm mobile, but for what I remember I think there's an undocumented way to
solve this.

coffeelint should probably error in this case and require you to pass a
processed/complete config.

On Jul 15, 2016 8:07 AM, "David Bouman" [email protected] wrote:

When employing the coffeelint API directly instead of through the
commandline, passing in a config containing an extends option, it is
simply ignored.

coffeelint.lint(
someFile
extends: 'coffeelint-config-foobar'
literate
)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#570, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAT1h4AyWdbaWT1QKgpN7YjVrubjL7lcks5qV4WLgaJpZM4JNYN_
.

@cueedee
Copy link
Author

cueedee commented Jul 18, 2016

Does it make sense to get different results between invoking the coffeelint cli versus, say, grunt-coffeelint when both get fed the same coffeelint.json config?

Why not turn it around; make extends work from the coffeelint.lint() API and only error on the rare (?) occasion the API finds itself in a context where it cannot resolve the base config?

To have that error would make perfect sense then and there, and you would be opening up to a very useful use-case for all the times that file system access is simply a given.

@AsaAyers
Copy link
Collaborator

configfinder is the way to handle this. Take a look at linter-coffeelint for an example.

CoffeeLint walks up the path looking for a coffeelint.json or a package.json that has a coffeeLint key. If it gets to the root of the filesystem it looks in your home directory for a coffeelint.json. configfinder does all of this work for you and when it finds a file it will flatten it by merging any extends and coffeelint.lint expects a flat configuration.

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

2 participants