How to disable Named imports must be alphabetized - tslint ?
I am getting error:
Named imports must be alphabetized.
I don't know how to disable this error.
My tsconfig.json configuration is:
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": [
"es6",
"dom"
],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": false,
"strictNullChecks": false,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true
},
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts"
]
}
Open tslint.json
and add ordered-imports
to rules
and restart the server (npm) if is running.
"rules": {
"ordered-imports": false
}
From this Rule of ordered-imports
Named imports must be alphabetized (i.e. “import {A, B, C} from “foo”;”)
- The exact ordering can be controlled by the named-imports-order option.
- “longName as name” imports are ordered by “longName”.
Add this line to your tsconfig
file:
"rules": {
"named-imports-order": "any"
}
Hope it helps.
"ordered-imports": false,
works for me in VS Code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With