查看“︁JavaScript/Prettier”︁的源代码
来自康健生活
←
JavaScript/Prettier
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 引言 == <syntaxhighlight lang="bash"> npm install --save-dev --save-exact prettier</syntaxhighlight> == 过滤文件 == {{hc|.prettierignore|<syntaxhighlight lang="javascript"> # Ignore artifacts: build node_modules .git .idea</syntaxhighlight>}} == 格式化 == {{shc|<syntaxhighlight lang="bash"> npx prettier --write .</syntaxhighlight>|$}} === CI === {{shc|<syntaxhighlight lang="bash"> prettier --check .</syntaxhighlight>|$}} == ESLint == {{shc|<syntaxhighlight lang="bash"> npm i --save-dev eslint-config- prettier</syntaxhighlight>|$}} == 配置文件 == <pre> # .prettierrc or .prettierrc.yaml # TOML : .prettierrc.toml # CommonJS : prettier.config.js, .prettierrc.js, prettier.config.cjs, or .prettierrc.cjs # ES : prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs # https://prettier.nodejs.cn/docs/en/configuration.html trailingComma: "all" # <all|es5|none> 在对象或数组最后一个元素后面是否加逗号 tabWidth: 2 # 缩进长度 useTabs: false # 使用空格代替tab缩进 semi: true # 句末使用分号 singleQuote: true # 使用单引号 printWidth: 100 # 单行长度 quoteProps: 'consistent' # <as-needed|consistent|preserve 仅在必需时为对象的key添加引号 jsxSingleQuote: false # jsx中使用单引号 bracketSpacing: true # 对象前后添加空格 eg: { foo: bar } bracketSameLine: true # jsxBracketSameLine: false # 多属性html标签的末尾 '>' 符号折行放置 arrowParens: 'avoid' # always 单参数箭头函数参数周围使用圆括号 eg: (x) => x。avoid:省略括号 requirePragma: false # 无需顶部注释即可格式化 proseWrap: 'preserve' # <always|never|preserve> 不做任何操作,保持原样 insertPragma: true # 在preitter格式化的文件插入指令 htmlWhitespaceSensitivity: 'ignore' # <css|strict|ignore> 对HTML全局空白不敏感 vueIndentScriptAndStyle: false # 不对vue中的script及style标签缩进 endOfLine: 'lf' # <lf|crlf|cr|auto> 结束行形式 embeddedLanguageFormatting: 'off' # <off|auto> 对引用代码进行格式化 disableLanguages: ['md'] # 不格式化文件格式 eslintIntegration: false # 不让prettier使用eslint的代码格式进行校验 tslintIntegration: false # 不让prettier使用tslint的代码格式进行校验 stylelintIntegration: false # 不让prettier使用stylelint的代码格式进行校验 ignorePath: 'ignorePath' # 忽略文件配置 requireConfig: false singleAttributePerLine: true # 强制每行使用单个属性</pre> == 参考 == * https://prettier.io/docs/en/install.html
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
返回
JavaScript/Prettier
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。