Fanfou Wiki

我等采石之人,当心怀建造大教堂之愿景。

用户工具

站点工具


prettier

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
prettier [2021/07/18 20:35] adminprettier [2021/11/08 18:02] (当前版本) admin
行 1: 行 1:
 ====== Prettier ====== ====== Prettier ======
 +  * https://prettier.io/docs/en/index.html
  
-**安装**+===== 安装 =====
  
 <code bash> <code bash>
-yarn add --dev --exact prettier+npm install --save-dev --save-exact prettier
 </code> </code>
  
-**配置*+===== 配置 ===== 
-<code bash> +  https://prettier.io/docs/en/options.html
-echo {}> .prettierrc.json +
-</code>+
  
-<file .prettierignore>+<file javascript .prettierrc.js> 
 +module.exports = { 
 +  // https://github.com/google/gts/blob/main/.prettierrc.json 
 +  bracketSpacing: false, 
 +  singleQuote: true, 
 +  trailingComma: "es5", 
 +  arrowParens: "avoid", 
 +  overrides: [ 
 +    { 
 +      files: ["*.html", "*.tsx", "*.vue"], 
 +      options: { 
 +        printWidth: 120, 
 +      }, 
 +    }, 
 +  ], 
 +}; 
 + 
 +</file> 
 + 
 +===== Ignoring Code ===== 
 +  * https://prettier.io/docs/en/ignore.html 
 + 
 +<file ignore .prettierignore>
 # Ignore artifacts: # Ignore artifacts:
 build build
 coverage coverage
- 
-# Ignore all HTML files: 
-*.html 
  
 </file> </file>
  
-**使用**+===== 使用 ===== 
 <code bash> <code bash>
-yarn prettier --write .+npx prettier --write --ignore-unknown .
 </code> </code>
 +
 +===== Pre-commit Hook =====
 +  * https://prettier.io/docs/en/precommit.html#option-1-lint-stagedhttpsgithubcomokonetlint-staged
 +
 +<code bash>
 +npx mrm@2 lint-staged
 +</code>
 +
prettier.1626611757.txt.gz · 最后更改: 2021/07/18 20:35 由 admin