Allow extends
See original GitHub issueAn option allowExtends
could enable extending.
The model I have in mind is https://github.com/stylelint/stylelint/blob/master/src/postcssPlugin.js#L69. Hopefully we can avoid using require()
directly, though, because it is synchronous. Open to other implementation ideas, of course, if they are comparably simple.
Whatever the implementation, key requirements are:
- extend configurations of JSON or YAML format.
extends
accepts a single string or an array of strings.extends
lookups can be absolute or relative paths, or a node_module name.- merging of
extends
occurs in the order of the array, so the last item takes priority over the first item (merges on top of it).
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
extends - JavaScript - MDN Web Docs - Mozilla
The extends keyword is used in class declarations or class expressions to create a class that is a child of another class.
Read more >Handbook - Interfaces
One of TypeScript's core principles is that type checking focuses on the shape that values have. This is sometimes called “duck typing” or...
Read more >TypeScript Extend Interface
Summary: in this tutorial, you will learn how to extend an interface that allows you to copy properties and methods of one interface...
Read more >Extending object-like types with interfaces in TypeScript
Extending multiple interfaces refers to the concept of composition where the interface is designed to extend attributes it needs.
Read more >Allow class to extend from a Generic #35382
My suggestion meets these guidelines: This wouldn't be a breaking change in existing TypeScript/JavaScript code; This wouldn't change the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep you’re totally right. We found a better way.
🤔The ESLint RFC I found through the Prettier issue is very interesting. I agree with the premise that ESLint’s current configuration complexity should be considered a warning to others, rather than something to emulate. And I really like the idea of demanding a JS file, allowing people to implement their own imports, merges, transforms, etc., rather than trying to appease every developer’s desire with configuration-loader magic.
I’ve looked at a few packages that try to implement generic
extends
patterns, and they just don’t seem generic enough that I want to include them in Cosmiconfig.I’m not completely opposed to the idea of adding an
extends
option that always expects a custom merge function as its argument. Thinking through what that means, though …extends
property in the loaded configuration. (What about those who will want a different property name, or a nested property?)extends
to be an array of strings. (What about those who will want torequire()
modules directly into theirextends
array?)extends
?)Cosmiconfig’s value really lies in step 4: the rest is highly likely to vary across implementations, and is fairly straightforward to implement. So I still lean towards not trying to add a generic
extends
pattern in Cosmiconfig, instead allowing users who wantextends
, or someextends
-like system, to use Cosmiconfig behind the scenes to look up and load files.