组中的导入源必须按字母顺序排列。找不到正确的顺序

时间:2019-03-19 17:54:31

标签: reactjs tslint ts-loader

我下面有这个简单的代码,在构建时遇到了这个错误,但对我来说不清楚我的导入顺序。

  import * as React from 'react';
    import './App.css';
    import logo from './logo.svg';
    import { DefaultButton } from 'office-ui-fabric-react/lib/Button';


    class App extends React.Component {
      public render() {
        return (
          <div className="App">
            <DefaultButton
      text='See Button'
      primary={ true }
      href='#/components/button'
    />
            <header className="App-header">
              <img src={logo} className="App-logo" alt="logo" />
              <h1 className="App-title">Welcome to React</h1>
            </header>
            <p className="App-intro">
              To get started, edit <code>src/App.tsx</code> and save to reload.
            </p>
          </div>
        );
      }
    }

    export default App;

1 个答案:

答案 0 :(得分:1)

在您的tslint.json中设置它们:

  "rules": {
    "ordered-imports": [false],
    "object-literal-sort-keys": [false]
  }