I\xe2\x80\x99m 尝试使用新的 ESLint 配置文件eslint.config.js (因为旧的 ESLint 配置文件.eslintrc.* 和 package.json 将在 ESLint 9.0.0 中弃用)。推荐的 ESLint 规则是由"extends": "eslint:recommended"
旧配置文件中的属性启用的,但该属性在依赖于语句的新配置文件中不再存在import
。
所以我import
在 eslint.config.js 中尝试了这个:
import config from \'eslint-config-standard\';\n\nexport default [\n {\n rules: config.rules\n }\n];\n
Run Code Online (Sandbox Code Playgroud)\n但我得到了这个TypeError
:
$ npm exec eslint .\nOops! Something went wrong! :(\n\nESLint: 8.39.0\n\nTypeError: Key "rules": Key "import/export": Could not find plugin "import".\n
Run Code Online (Sandbox Code Playgroud)\n如何解决这个问题呢?
\n\xe2\x80\x9c使用预定义配置\xe2\x80\x9d 部分对此进行了描述:
\nimport eslint from "@eslint/js";\n\nexport default [\n eslint.configs.recommended\n];\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
1206 次 |
最近记录: |