导入应按字母顺序排序错误

时间:2018-11-13 22:53:45

标签: node.js eslint

我的文件中包含以下导入内容:

import axios from "axios";
import lodash from "lodash";
import PropTypes from "prop-types";
import React from "react";
import renderInCustomHtmlTag from "react-render-custom-html-tag";

我正在使用v5.9.0,但是由于某种原因,即使第3行似乎是字母顺序,我也遇到了错误。

我的陪同如下:

{
  "env": {
    "browser": true,
    "commonjs": true,
    "es6" : true,
    "jquery": true,
    "node": true
  },
  "extends": [
    "eslint:all",
    "plugin:react/recommended"
  ],
  "globals": {
    "$cgx": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "sourceType": "module"
  },
  "plugins": [
    "import",
    "jsx-a11y",
    "react"

  ],
  "rules": {
    "indent": ["error", 2],
    "max-len": [
      "error",
      {
        "code": 120
      }
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

问题可能是大写字母。似乎是因为它们的ASCII值较低,A = 65,a = 97。

https://eslint.org/docs/2.0.0/rules/sort-imports