How to order imports with tslint's import-ordering rule

后端 未结 3 707
情歌与酒
情歌与酒 2021-02-05 00:07

On my project tslint\'s \"import-ordering\" rule is used

import CopyLensModal from \'./CopyLensModal\';
import FetchStatus from \'../../../../../state/generic/mo         


        
3条回答
  •  灰色年华
    2021-02-05 01:00

    In file tslint.json add

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

    For example, then file tslint.json will look like this

    {
      "extends": [
        "tslint:recommended",
        "tslint-react",
        "tslint-config-prettier"
      ],
      "linterOptions": {
        "exclude": [
          "config/**/*.js",
          "node_modules/**/*.ts",
          "coverage/lcov-report/*.js"
        ]
      },
      "rules": {
        "ordered-imports": [false],
        "object-literal-sort-keys": [false]
      }
    }
    

提交回复
热议问题