-
Notifications
You must be signed in to change notification settings - Fork 41
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
Option to extend another unibeautify config #184
Comments
As an alternative, I don't know whether the The TSLint config seems to have |
IMHO, it would be nice if you could just give the directory (as in |
@lassik extending would make it more flexible when projects want to use a config file from their own node package. e.g.:
|
I was under the impression that Unibeautify is supposed to be a long-lived project for universal use which just happens to be implemented in JS/Node. Therefore I would avoid baking in very Node-specific shortcuts. Also, there's a very long Unix tradition that Can the nearest node-modules be found easily via a relative pathname (i.e. is it usually at a fixed location relative to things in the repo)? Another option (which is occasionally done elsewhere in Unix) is to have |
@lassik That is correct but node-sass is using I think there is something like this: https://www.npmjs.com/package/find-node-modules or what do you mean? I think it would be well enough to have it with a relative/absolute path to a file or a directory. Cosmiconfig can then take care of the rest. So for example:
|
Additionally we could do something like:
so users could use presets defined by the community? @Glavin001 what do you think about this? |
I opened a separate issue about the presets. If we have a presets mechanism, exposing it via IMHO, absolute pathnames like Sorry about all the nitpicking, I do like the main idea. Let's see what @Glavin001 has to say :) |
💯% agree.
Also agree. Node.js is an implementation detail.
I definitely do not want to have too much magic or unexpected behaviour.
The I want users to be explicit when defining their Unibeautify configuration. For example, Also, I also want to be careful when dealing with complex cases involving merging.
We can make this work. Currently we resolve the Unibeautify configuration given the directory of either the file being formatted or the project. Lots to think about 🤔 |
Glad you brought this up :) This is an important point. A pathname given in a configuration file should always be resolved relative to the directory of that configuration file (except for some very exceptional cases where there is an obvious precedent to the contrary). I've come across at least a couple file formats where the designers neglected to take this into account, resolving pathnames relative to some non-obvious directory (in the worst case, the directory varies based on where the file is included from, or what tool or environment variables one happens to be using). As a user, it always results in metaphorical hair-pulling trying to figure the thing out. If there's a need to specify pathnames relative to the project root, I would recommend an explicit syntax like |
Good point! It's possible we'll have to resort to specifying the merging rules on an option-by-option basis. But that's not too bad IMHO as long as the result is intuitive. |
💯% agree. I want the experience to be as intuitive as possible.
Similar to how VSCode has some variables which are substituted:
We may have to compare the advantages and disadvantages of a few different options. I'd like to look at how TSLint, ESLint, Prettier, etc handle these things and why. |
Some projects like webpack or TSLint have the ability to extend their config file. So we could have a different file in a subdirectory that extends or overrides parts of the one found in the root of a project.
.unibeautifyrc.json @ root
.unibeautifyrc.json @ app
.unibeautifyrc.json @ server
EDIT: as @lassik said, it would be nice if it just looks a dir up when no file name is specified
The text was updated successfully, but these errors were encountered: