简体   繁体   English

为什么绝对进口来自相对进口?

[英]Why should absolute imports come before relative imports?

I'm importing some resources in my Vue file. 我正在我的Vue文件中导入一些资源。 The fact that it's Vue, though, have nothing to do with my question, I believe. 不过,事实上它是Vue,与我的问题无关,我相信。

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: 然后ESLint告诉我:

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. 通常绝对导入来自外部库,以及来自代码的相对导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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