简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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