Skip to content

bug(options): unexpected behavior with Options.normalize and Options.merge #13

@nberlette

Description

@nberlette

The expected behavior when passing overrides for instance-level options doesn't occur when providing the overrides as a second argument while formatting or checking code.

It seems particularly finicky with the ext option, which can result in problems when one tries to switch the formatter over to a different content type at the time of formatting. For example, if you go from formatting TS/JS code and then try to format some JSON, passing in { ext: "json" } for the option overrides argument, the Options class does not respect that new ext option, and the input code is handled as if it were TypeScript/JavaScript. That's bad.

The above example results in an error being thrown when using the WASM context; and for the Deno CLI context, either a blank string is returned or an error is also thrown. **That's another inconsistency that needs to be ironed out.((

Note: (to self) the whole Options class is a great candidate to just be nuked and entirely rewritten from the ground up without the over-engineering and verbosity that lead to these issues.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions