Magnus Buvarp
Magnus Buvarp

Reputation: 976

Why should absolute imports come before relative imports?

I'm importing some resources in my Vue file. The fact that it's Vue, though, have nothing to do with my question, I believe.

I import them as such:

import Vue from 'vue'
import { mapState, mapMutations } from 'vuex'
import ChessPiece from '../assets/classes/chesspiece'
import 'vue-awesome/icons/rotate-left'
import 'vue-awesome/icons/search'

ESLint then tells me:

Absolute imports should come before relative imports

I'm just wondering, why is this?

Upvotes: 5

Views: 8676

Answers (1)

Daniel Tran
Daniel Tran

Reputation: 6169

It's just an coding convention to make everything cleaner.

Usually absolute imports comes from external library, and relative imports from your code.

Upvotes: 14

Related Questions