M
M
Michail2022-01-13 07:18:20
Visual Studio Code
Michail, 2022-01-13 07:18:20

How to enable import before the file, and not before the index in which it is exported?

There are three files.

1.ts index.ts 2.ts
export const testA = 1;
export * from './1'

import {testA} from '.'
const testB = testA;


When I save the second file, vscode automatically adds an import before index.ts

It needs to be import * from '.' turned into import * from './2'

Here is my settings.js

{
    "git.ignoreWindowsGit27Warning": true,
    "git.autofetch": true,
    "angular.experimental-ivy": true,
    "files.autoSave": "afterDelay",
    "git.enableSmartCommit": true,
    "explorer.confirmDragAndDrop": false,
    "typescript.updateImportsOnFileMove.enabled": "always",
    "explorer.confirmDelete": false,
    "workbench.editor.untitled.hint": "hidden",
    "workbench.startupEditor": "none",
    "javascript.preferences.quoteStyle": "single",
    "typescript.preferences.includePackageJsonAutoImports": "on",
    "eslint.enable": true,
    "eslint.format.enable": true,
    "javascript.suggest.autoImports": true,
    "editor.codeActionsOnSave": {
        "source.addMissingImports": true,
        "source.fixAll.eslint": true,
        "source.organizeImports": true
    },
    "typescript.preferences.importModuleSpecifier": "relative"
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question