Eslint-plugin-import: `extensions`: how to specify a default while specifying granular extensions?

Created on 21 Jun 2016  路  7Comments  路  Source: benmosher/eslint-plugin-import

I'd like the default to be "always" but i'd like js and jsx to be "never". How do I specify this? The schema only allows a string, or an object, but not both.

accepted enhancement help wanted

Most helpful comment

I like your proposal:

... the schema would allow a string and an object - the string constitutes the default, and the object has granular overrides.

Don't think it constitutes a breaking change, since the first arg can still be a string or object, but the second one _must_ be an object if the first is a string, and the second must not be provided if the first is an object.

I'm not planning on working on this anytime soon. I'd be happy to accept and ship a PR, though.

All 7 comments

(Similarly, I should be able to specify "never" and have a specific extension be "always")

It's not clear to me how to ensure that.

Ah, interesting. I'm not sure how you'd do that, either. Sounds like a reasonable goal though.

My thinking was that the schema would allow a string _and_ an object - the string constitutes the default, and the object has granular overrides.

Any update on this?

I like your proposal:

... the schema would allow a string and an object - the string constitutes the default, and the object has granular overrides.

Don't think it constitutes a breaking change, since the first arg can still be a string or object, but the second one _must_ be an object if the first is a string, and the second must not be provided if the first is an object.

I'm not planning on working on this anytime soon. I'd be happy to accept and ship a PR, though.

Finally filed https://github.com/benmosher/eslint-plugin-import/pull/555 to fix this :-)

Yay, thanks! Waiting patiently now for the release :-)

Was this page helpful?
0 / 5 - 0 ratings