Actually support plugins field in config#3584
Conversation
|
Sec, this only squelches the warning. It doesn't actually work. |
|
Still one more bug to fix here |
|
|
||
| const option = constant.detailedOptionMap[key]; | ||
| let option = constant.detailedOptionMap[key]; | ||
| if (type === "api" && option === undefined) { |
There was a problem hiding this comment.
Otherwise we barf on unrecognized "plugins" in config file
| return Object.keys(object || {}).reduce((output, key) => { | ||
| output[dashify(key)] = object[key]; | ||
| const apiOption = constant.apiDetailedOptionMap[key]; | ||
| const cliKey = apiOption ? apiOption.name : key; |
There was a problem hiding this comment.
Need to map "plugins" to "plugin", else it always gets clobbered (even if --plugin isn't specified on CLI)
| const normalized = Object.assign({}, options || {}); | ||
| const filepath = normalized.filepath; | ||
|
|
||
| normalized.plugins = loadPlugins(normalized); |
There was a problem hiding this comment.
Need to load plugins first so getSupportInfo below can see Python
|
The original PR didn't have tests because it was largely just a refactor. We should start adding integration tests for this kind of thing. |
|
What do you think of adding an issue to track that and tackling the testing separately? On master right now, the It's not exactly a blocker, but it makes testing prettier-python take a bit more effort than it needs to. |
|
|
||
| const apiDetailedOptionMap = detailedOptions.reduce( | ||
| (current, option) => | ||
| option.forwardToApi && option.forwardToApi !== option.name |
There was a problem hiding this comment.
Isn't forwardToApi true in a lot of places?
There was a problem hiding this comment.
At this point they're already normalized to the camelcased strings per https://github.com/taion/prettier/blob/70313e67950edb34a8cab0911c5b3ab1a90b7db6/src/cli/constant.js#L425
No description provided.