Unibeautify / unibeautify

One Beautifier to rule them all, One Beautifier to clean them, One Beautifier to bring them all and in the darkness sheen them
https://unibeautify.com/
MIT License
544 stars 41 forks source link

Add feature to specify path to beautifier config file #223

Closed stevenzeck closed 5 years ago

stevenzeck commented 5 years ago

Closes #221.

This pull request adds a new option in Unibeautify's config: beautifier_config_path. If this there and prefer_beautifier_config is true, it will use that config file instead of letting the Unibeautify beautifier find the file on its own.

lassik commented 5 years ago

Could the two options be combined into one? E.g. use_beautifier_config whose value could be false (use Unibeautify's settings), true (use beautifier's own config from the default place) or a string (use beautifier's own config from that filename)? 🤔

What's the general opinion on options whose values can have more than one datatype?

stevenzeck commented 5 years ago

@Glavin001 thoughts on @lassik comment? Should be simple:

const resolveConfigPath:
    | string
    | undefined = typeof beautifierOptions.prefer_beautifier_config === "string"
    ? beautifierOptions.prefer_beautifier_config
    : filePath;
Glavin001 commented 5 years ago

Good idea. 👍

Glavin001 commented 5 years ago

The docs will need to be updated https://unibeautify.com/docs/options-for-beautifiers

stevenzeck commented 5 years ago

@Glavin001 pushed.