import-js/eslint-plugin-import

v2.20.2 import/order triggered only after adding newline

开放

#1,711 创建于 2020年3月31日

 (4 条评论) (2 个反应) (0 位负责人)JavaScript (1,549 个派生)batch import
bughelp wantedimport/export ordering

仓库指标

星标
 (5,938 个星标)
PR 合并指标
 (平均合并 138天 22小时) (30 天内合并 3 个 PR)

描述

OS: Ubuntu 18 Node: 12.16.1 Eslint: 6.8.0 (bundled with CRA) Eslint-plugin-import: 2.20.2 (bundled with CRA) Eslint-config-create-react-app: 5.2.1 (bundled with CRA, source)

Steps to reproduce

  1. Install create-react-app
  2. Add import/order rule with groups via EXTEND_ESLINT
  3. Run it - no errors occured
  4. Add newline before function App() { (2 newline between import and function now)
  5. Save - now error occured
./src/App.js
  Line 4:1:  `./logo.svg` import should occur before import of `react`  import/order

Search for the keywords to learn more about each error.

Or

  1. Checkout https://github.com/koutsenko/sort-imports
  2. Run it - it will print error
  3. Remove one of two newlines between import and function statements
  4. Import error will gone.

Question: why import rules are triggered by adding newline?

贡献者指南