【Vue3-TypeScript】如何使用vue3创建一个基于【webstorm开发】自动提示和自动格式化代码规则的工程!

开始执行Vue3工程【完美兼容【webstorm】TypeScript语法自动提示检测和代码自动化格式化-快捷键Ctrl+Alt+L】 

=======>最终生成的package.json的模板如下【其中eslint中的规则rules是个人习惯的一些规则配置】

{
  "name": "vue3_03",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "^3.0.0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^4.18.0",
    "@typescript-eslint/parser": "^4.18.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-standard": "^5.1.2",
    "@vue/eslint-config-typescript": "^7.0.0",
    "eslint": "^6.7.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^7.0.0",
    "typescript": "~4.1.5"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "@vue/standard",
      "@vue/typescript/recommended"
    ],
    "parserOptions": {
      "ecmaVersion": 2020
    },
    "rules": {
      "generator-star-spacing": "off",
      "no-unexpected-multiline": "off",
      "no-debugger": "off",
      "no-console": "off",
      "no-unused-vars": "warn",
      "no-mixed-spaces-and-tabs": [
        "warn",
        "smart-tabs"
      ],
      "semi": [
        "warn",
        "always"
      ],
      "indent": [
        "off"
      ],
      "camelcase": [
        "off",
        {
          "properties": "never"
        }
      ],
      "quotes": [
        "warn",
        "double",
        {
          "allowTemplateLiterals": true
        }
      ],
      "multiline-ternary": [
        "error",
        "never"
      ],
      "quote-props": "off",
      "prefer-const": "off",
      "dot-notation": "off",
      "operator-linebreak": "off",
      "prefer-promise-reject-errors": "off",
      "no-trailing-spaces": "warn",
      "space-in-parens": [
        "off",
        "always"
      ],
      "new-cap": "off",
      "no-tabs": "off",
      "comma-dangle": [
        "error",
        "only-multiline"
      ],
      "padded-blocks": [
        "warn",
        "never"
      ],
      "no-return-await": "off",
      "no-unused-expressions": "off",
      "spaced-comment": "off",
      "space-before-function-paren": "off",
      "brace-style": [
        "warn",
        "1tbs"
      ],
      "no-multiple-empty-lines": [
        "warn",
        {
          "max": 2
        }
      ],
      "object-curly-spacing": [
        "warn",
        "always"
      ],
      "object-curly-newline": [
        "warn",
        {
          "ImportDeclaration": {
            "multiline": true
          }
        }
      ],
      "vue/html-indent": [
        "off"
      ],
      "vue/no-unused-components": "warn",
      "vue/require-prop-types": "off",
      "vue/comment-directive": "warn"
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

vue create project_name

 

扫描二维码关注公众号,回复: 13302461 查看本文章

猜你喜欢

转载自blog.csdn.net/weixin_43343144/article/details/120926080