简体   繁体   English

为什么用于导入订单的 Eslint 插件在 CRA 中不起作用?

[英]Why Eslint plugin for import order doesn't work in CRA?

I installed eslint-plugin-import-order and add it to eslintConfig in package.json .我安装了eslint-plugin-import-order并将其添加到eslintConfigpackage.json中。

Error I have:我有错误:

Definition for rule 'import/order' was not found (import/order)

Please, help me to deal with it.请帮我处理它。

Sandbox: https://codesandbox.io/s/elegant-elbakyan-pilnc沙盒: https://codesandbox.io/s/elegant-elbakyan-pilnc

Note: eslint-plugin-import-order has been deprecated.注意: eslint-plugin-import-order已被弃用。 Please use this https://github.com/benmosher/eslint-plugin-import请使用这个https://github.com/benmosher/eslint-plugin-import

create a .eslintrc.json file and add the plugin like below.创建一个.eslintrc.json文件并添加如下插件。

{
  ....,
  "extends": ["eslint:recommended", "plugin:import/errors", "plugin:import/warnings"],

  "plugins": ["import"],
  
  .....
}

Restart your local server once to ensure the changes are reflected.重新启动一次本地服务器以确保反映更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM