import-js/eslint-plugin-import

v2.20.2 import/order triggered only after adding newline

Open

#1,711 opened on Mar 31, 2020

View on GitHub
 (4 comments) (2 reactions) (0 assignees)JavaScript (4,946 stars) (1,540 forks)batch import
bughelp wantedimport/export ordering

Description

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?

Contributor guide