任何人,请帮助我
将Typescript安装到我的Nuxt项目中并对其进行配置后,我得到以下警告:
WARN Compiled with 1 warnings
Module Warning (from ./node_modules/eslint-loader/dist/cjs.js): friendly-errors 11:28:18
Failed to load config "@nuxtjs" to extend from.
Referenced from: /home/x/nuxt-project/.eslintrc.js friendly-errors 11:28:18
You may use special comments to disable some warnings. friendly-errors 11:28:18
Use // eslint-disable-next-line to ignore the next line. friendly-errors 11:28:18
Use /* eslint-disable */ to ignore all warnings in a file. friendly-errors 11:28:18
这是什么意思以及如何解决?
**这是我的配置步骤:
buildModules: ['@nuxt/typescript-build']
**这是我的eslintrc.js
配置:
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint',
ecmaFeatures: {
legacyDecorators: true
}
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended',
'eslint:recommended',
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/recommended'
],
plugins: [
'vue'
],
// add your custom rules here
rules: {
'semi': [2, 'never'],
'no-console': 'off',
'vue/max-attributes-per-line': 'off',
"vue/html-self-closing": ["error", {
"html": {
"void": "always",
"normal": "never",
"component": "any"
}
}]
}
}
答案 0 :(得分:1)
对此没有任何经验,但是@nuxtjs eslint的Github表示以下内容:
如果您使用的是TypeScript,请遵循“用法”部分,将@ nuxtjs / eslint-config替换为@ nuxtjs / eslint-config-typescript。 在您的.eslintrc中,您所需要做的就是:
{
"extends": [
"@nuxtjs/eslint-config-typescript"
]
}
因此,基本上,您必须运行npm i @nuxtjs/eslint-config-typescript -D
,然后更新eslint扩展配置