You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each of the packages above have their own unique cli and options which is great if you love a completely different experience and like to read documentation on how to use it.
While the discussions are going on for v2.0 I would like to propose adding support for plugins. This way there is only 1 way to use the prettier cli, not multiple ways.
The other advantage of adding support for plugins is that they can work together. For example when parsing markdown files each of the js blocks and be parsed using eslint, or each of the scss blocks could be parsed with the stylelint plugin. That way not only are all the files formatted correctly according to eslint/stylelint/etc. they're also formatted correctly in markdown files. Another example would be with vue files and script, and style tags since you can specify the language that's used.
Here's a rough concept of what the plugin api could look like.
exportdefault{// this defines the languages that this plugin supports. This is determined in 3 different ways// 1. By the file extension// 2. By the language attr/element// - `<script>` This assumes the language is js// - `<script lang="js">` same thing as above// - `<style>` // assumes css// - `<style lang="css">` same thing as above// - `<style lang="scss">` changes language to css// 3. By the codeblock language// // - ```js// const foo = ''// ```// - ```scss// .foo { background: blue; }// ```// They can pass in string/array/regexlang: ['js','jsx'],// runs before the file is returned/writtenhandler({// any options that are passed to prettier, this way if a // plugin needs access to one of them they have it
options,// the code that's going to formatted
content,}){// the modified content would be returnedreturncontent},}
The text was updated successfully, but these errors were encountered:
Currently the prettier eco system is a little bit spread out and confusing to work with when you're trying to get it to work with other packages.
Each of the packages above have their own unique cli and options which is great if you love a completely different experience and like to read documentation on how to use it.
While the discussions are going on for v2.0 I would like to propose adding support for plugins. This way there is only 1 way to use the prettier cli, not multiple ways.
The other advantage of adding support for plugins is that they can work together. For example when parsing markdown files each of the js blocks and be parsed using eslint, or each of the scss blocks could be parsed with the stylelint plugin. That way not only are all the files formatted correctly according to eslint/stylelint/etc. they're also formatted correctly in markdown files. Another example would be with vue files and script, and style tags since you can specify the language that's used.
Here's a rough concept of what the plugin api could look like.
The text was updated successfully, but these errors were encountered: