Fanfou Wiki

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

用户工具

站点工具


prettier

差别

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

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
prettier [2021/10/21 17:18] adminprettier [2021/11/08 18:02] (当前版本) admin
行 1: 行 1:
 ====== Prettier ====== ====== Prettier ======
 +  * https://prettier.io/docs/en/index.html
  
-**安装**+===== 安装 =====
  
 <code bash> <code bash>
行 7: 行 8:
 </code> </code>
  
-**配置*+===== 配置 ===== 
-<code bash> +  https://prettier.io/docs/en/options.html
-echo {} > .prettierrc.yml +
-</code>+
  
-<file yaml .prettier.yml+<file javascript .prettierrc.js
-# 单行代码的最大宽度 +module.exports = { 
-printWidth80 +  // https://github.com/google/gts/blob/main/.prettierrc.json 
-# 使用制表符 (tab) 缩进行而不是空格 (space) +  bracketSpacing: false, 
-useTabs: false +  singleQuote: true, 
-# 指定每个缩进级别的空格数 +  trailingComma"es5", 
-tabWidth: 2 +  arrowParens"avoid", 
-# 在语句末尾打印分号 +  overrides: 
-semi: true +    { 
-# 使用单引号而不是双引号 +      files: ["*.html", "*.tsx", "*.vue"], 
-singleQuotefalse +      options: { 
-# 换行格式 +        printWidth: 120, 
-endOfLinelf +      }, 
- +    }, 
-overrides: +  ], 
-  files: "*.html" +};
-    options: +
-      printWidth: 120 +
-      tabWidth: 2 +
-  - files: "*.vue" +
-    options: +
-      printWidth: 120 +
-      tabWidth: 2 +
-  - files: "*.tsx" +
-    options: +
-      printWidth: 120 +
-      tabWidth: 2+
  
 </file> </file>
  
-<file .prettierignore>+===== 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>
-npx 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.1634807937.txt.gz · 最后更改: 2021/10/21 17:18 由 admin