记录vue-cli3.0+typescript我的项目:Eslint+prettier遇到的一些报错以及失去的解决办法
1、始终报错 error Delete ‘........’,或者是warning Delete、warning Insert ‘..’这种找不到问题的谬误

解决办法 可执行代码:
npm run lint --fix

2、typescript数据指定类型始终报错意外的类型这种问题

这里是因为我没有配置typescrpt,须要在.prettierrc.js加上配置
parser: 'typescript'

而后重新启动我的项目就能够了
3、发现怎么配置度有很多报错,查了各种材料原来是.prettierrc.js和.eslintrc.js配置问题,一开始去配置tslint.json,然而很多博主都说eslint进行保护了不必他,这里上一下新的.prettierrc.js和.eslintrc.js配置文档,1-2作为记录就不删除了,以便当前回顾时候看看本人走过的路

module.exports = {    printWidth: 120, // 换行字符串阈值    tabWidth: 4, // 设置工具每一个程度缩进的空格数    singleQuote: true, // 用单引号    semi: false, // 句末是否加分号    trailingComma: 'none', // 最初一个对象元素加逗号    bracketSpacing: true, // 对象,数组加空格    jsxBracketSameLine: true, // jsx > 是否另起一行    arrowParens: 'always', // (x) => {} 是否要有小括号    parser: 'typescript' // 指定应用哪一种解析器}

module.exports = {    root: true,    env: {    node: true    },    extends: [            'plugin:vue/essential',                '@vue/prettier',        '@vue/typescript',        'plugin:prettier/recommended' // add prettier-eslint plugin which will uses the `.prettierrc.js` config    ],    rules: {        'prettier/prettier': 'error',        'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',        'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'    },    parserOptions: {        parser: '@typescript-eslint/parser'    },    overrides: [        {            files: ['**\_\_tests\_\_\*.{j,t}s?(x)'],            env: {                mocha: true               }        }    ]}

以上就是今日做我的项目遇到的坑以及解决的办法