1.1.2 • Published 2 years ago

chen-table-edit v1.1.2

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Recommended IDE Setup

Type Support For .vue Imports in TS

Since TypeScript cannot handle type information for .vue imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue imports (for example to get props validation when using manual h(...) calls), you can enable Volar's Take Over mode by following these steps:

  1. Run Extensions: Show Built-in Extensions from VS Code's command palette, look for TypeScript and JavaScript Language Features, then right click and select Disable (Workspace). By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
  2. Reload the VS Code window by running Developer: Reload Window from the command palette.

You can learn more about Take Over mode here.

https://juejin.cn/post/7085257325165936648

eslint

npm install eslint --save-dev npm init @eslint/config IDE-setting: format On Save "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, IDE-plugin: eslint https://eslint.bootcss.com/docs/rules/

vue-eslint

https://eslint.vuejs.org/rules/

stylelint

npm install --save-dev postcss-html stylelint-config-recommended-vue stylelint-config-recommended-scss stylelint-config-standard-scss IDE-plugin: stylelint IDE-setting: format On Save "editor.codeActionsOnSave": { "source.fixAll.stylelint": true }, "stylelint.validate": "scss", "css", "vue" 创建文件:.stylelintrc.js module.exports = { 'defaultSeverity': 'error', 'extends': 'stylelint-config-standard-scss', 'stylelint-config-recommended-vue/scss' , "files": "/*.vue", "/.scss", "**/.css", 'rules': { // 不要使用已被 autoprefixer 支持的浏览器前缀 'media-feature-name-no-vendor-prefix': true, 'at-rule-no-vendor-prefix': true, 'selector-no-vendor-prefix': true, 'property-no-vendor-prefix': true, 'value-no-vendor-prefix': true, "indentation": [4, { "except": "value" }], } }; 创建文件:.stylelintignore

.stylelintignore

旧的不需打包的样式库

*.min.css

测试和打包目录

/test/ /dist/ package.json add script: "lint:css": "stylelint */.{html,vue,css,sass,scss}"

中文文档:https://cloud.tencent.com/developer/doc/1267 官方文档:https://stylelint.io/user-guide/rules/list/ stylelint-config-recommended-vue文档:https://github.com/ota-meshi/stylelint-config-recommended-vue

stylelint-order

npm install stylelint --save-dev npm install stylelint-order --save-dev npm install stylelint-config-property-sort-order-smacss --save-dev .stylelintrc.js中增加 "extends": "stylelint-config-property-sort-order-smacss",

husky 和 ​​lint-staged:

npm install --save-dev husky lint-staged npx husky install npm set-script prepare "husky install" npx husky add .husky/pre-commit "npx lint-staged"

package.json加入: "lint-staged": { "example/.{vue,ts,js,json}": "eslint --fix", "example/.{scss,css,vue}": "stylelint --fix" },