admin管理员组

文章数量:1245127

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 e before relative imports

I'm just wondering, why is this?

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 e before relative imports

I'm just wondering, why is this?

Share Improve this question asked Dec 10, 2017 at 1:05 Magnus BuvarpMagnus Buvarp 9767 silver badges19 bronze badges 2
  • 1 It probably the linter preference github./benmosher/eslint-plugin-import/blob/master/docs/… – Nandu Kalidindi Commented Dec 10, 2017 at 1:11
  • 1 probably a carry-over or as a result from/of eslint-config-airbnb. – codeislife Commented Mar 12, 2018 at 23:49
Add a ment  | 

1 Answer 1

Reset to default 14

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

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

本文标签: javascriptWhy should absolute imports come before relative importsStack Overflow