最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why should absolute imports come before relative imports? - Stack Overflow

programmeradmin3浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论