Code Format Plugin
Install
$ npm install ksr-cfp
Usage
prettier requires at least version 10.13.0 of Node
$ ksr-cfp -d FilePath -p .prettierrc.json -c true
Options
Param | Required | Default | Alias | Introduce |
---|---|---|---|---|
-d | false | . | --directory | File Path |
-p | false | -path | --find-config-path and --config | |
-c | false | false | --cli | excute CLI |
Format Configuration Schema
{
"parser": "babel",
"printWidth": 120,
"semi": true,
"singleQuote": true,
"pugAttributeSeparator":"always",
"pugClosingBracketPosition":"new-line",
"pugCommentPreserveSpaces":"keep-all",
"pugSortAttributes":"as-is",
"tslintIntegration":"false" ,
"stylelintIntegration" : "false",
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
Support
File Suffix or Valid options | Plugin |
---|---|
* .pug |
@prettier/plugin-pug |
* .ts |
@typescript-eslint/typescript-estree |
* .css、* .scss、* .less |
postcss-scss and postcss-less |
* .json 、* .json5 |
@babel/parser parseExpression |
* .md |
remark-parse |
* .html、* .vue 、* .ag(angular) |
angular-html-parser |
* .yaml |
yaml and yaml-unist-parser |
graphql | graphql/language |
babel , babel-flow | @babel/parser |
babel-ts | typescript |
flow | flow-parse |