
ESlint + StyleLint + Prettier 己經現今前端開發協作相當重要的工具,他可以讓團隊有一致的程式碼風格及規範,並透過 Vscode 開發工具,能夠協助修正一些錯誤。
npx create-next-app@latest --typescript npm run dev
code --install-extension dbaeumer.vscode-eslint code --install-extension [email protected] code --install-extension esbenp.prettier-vscode code --install-extension rvest.vs-code-prettier-eslint cd .. npm i --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier eslint-plugin-react prettier prettier-plugin-organize-imports prettier-plugin-tailwindcss stylelint-config-standard-scss
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"[html,javascript,json,xml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"stylelint.validate": ["css", "scss", ".module.scss"],
"eslint.alwaysShowStatus": true,
"eslint.debug": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "html", "vue", "json", "javascriptreact", "typescript", "typescriptreact"],
"eslint.options": {
"extensions": [".html", ".js", ".vue", ".jsx", "json", ".tsx"]
}
}
{
"extends": ["next/core-web-vitals","eslint:recommended"]
}
{
"extends": "stylelint-config-standard-scss",
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
}
],
"declaration-block-trailing-semicolon": null,
"no-descending-specificity": null,
"color-hex-case": "upper",
"block-no-empty": true,
"color-hex-length": "long",
"selector-type-no-unknown": [
true,
{
"ignoreTypes": []
}
],
"selector-pseudo-element-no-unknown": [
true,
{
"ignorePseudoElements": []
}
],
"comment-no-empty": true,
"shorthand-property-no-redundant-values": true,
"value-no-vendor-prefix": true,
"property-no-vendor-prefix": true,
"number-leading-zero": "never",
"no-empty-first-line": true,
"order/properties-order": [
"position",
"top",
"right",
"bottom",
"left",
"z-index",
"display",
"justify-content",
"align-items",
"float",
"clear",
"overflow",
"overflow-x",
"overflow-y",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"border",
"border-style",
"border-width",
"border-color",
"border-top",
"border-top-style",
"border-top-width",
"border-top-color",
"border-right",
"border-right-style",
"border-right-width",
"border-right-color",
"border-bottom",
"border-bottom-style",
"border-bottom-width",
"border-bottom-color",
"border-left",
"border-left-style",
"border-left-width",
"border-left-color",
"border-radius",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"font-size",
"font-family",
"font-weight",
"text-align",
"text-justify",
"text-indent",
"text-overflow",
"text-decoration",
"white-space",
"color",
"background",
"background-position",
"background-repeat",
"background-size",
"background-color",
"background-clip",
"opacity",
"filter",
"list-style",
"outline",
"visibility",
"box-shadow",
"text-shadow",
"resize",
"transition"
]
}
}
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 120
}