Support reading editorconfig data (if present) and make those values available to pass through to commands.
For example, many formatting tools support configuring indentation via a CLI flag. Stylist could allow for something like:
processors:
- name: jsonfmt
includes:
- "**/*.{json}"
fix:
command: "jsonfmt --indent {{ .indent_size }}"
input: variadic
output: none
... where indent_size would be read from .editorconfig.
To implement:
-
We'd need to come up w/ some rules for how we resolve editorconfig values for a given batch of paths. Theoretically you can have values defined in .editorconfig per-file, though in practice most people likely have them defined per-filetype. If we're executing a command for a batch of files, which path do we use to determine the editor config values? Personally I think just using the first file will be fine, but we'd need to validate and document that.
-
After resolving editorconfig values, we'd need to run the command string through text/template. Might want to think about tools that don't expose flags and only support config files... maybe allow for specifying a config template that we render to /tmp and expose via a {{ .rendered_config_path }} var? Though if we want to do that, should create a separate issue.
Support reading editorconfig data (if present) and make those values available to pass through to commands.
For example, many formatting tools support configuring indentation via a CLI flag. Stylist could allow for something like:
... where
indent_sizewould be read from.editorconfig.To implement:
We'd need to come up w/ some rules for how we resolve editorconfig values for a given batch of paths. Theoretically you can have values defined in
.editorconfigper-file, though in practice most people likely have them defined per-filetype. If we're executing a command for a batch of files, which path do we use to determine the editor config values? Personally I think just using the first file will be fine, but we'd need to validate and document that.After resolving editorconfig values, we'd need to run the command string through
text/template. Might want to think about tools that don't expose flags and only support config files... maybe allow for specifying a config template that we render to/tmpand expose via a{{ .rendered_config_path }}var? Though if we want to do that, should create a separate issue.