R
R
romaro2022-04-05 15:16:40
Visual Studio Code
romaro, 2022-04-05 15:16:40

How to get back indent formatting after connecting ESLint plugin?

Tried different combinations of settings, but nothing helps. I also tried disabling linter. But in vain: in .js files, when saving, the indents are no longer adjusted. In .json files, they only fit on save, but it doesn't work on paste.

I would like the indents to align both when inserting and when saving files.

I think that you need to configure it through the VSCode plugin , and not the linter itself. But I did not find the alignment setting there.

My settings file:

{
    "files.autoSave": "onWindowChange",
    "eslint.enable": true,
    "eslint.format.enable": true,
    "html.hover.documentation": false,
    "html.format.templating": true,
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features",
        "editor.codeActionsOnSave": {
            "source.fixAll.eslint": false
        }
    },
    "[javascript]": {
        "editor.defaultFormatter": "dbaeumer.vscode-eslint"
    },
    "[typescript]": {
        "editor.defaultFormatter": "dbaeumer.vscode-eslint"
    },
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    },
    "editor.formatOnSave": true,
    "editor.hover.enabled": true,
    "editor.hover.delay": 1000,
    "editor.formatOnPaste": true,
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs": "active",
    "editor.tokenColorCustomizations": {
        "[Default Dark+]": {
            "textMateRules": [
                {
                    "scope": "variable.scss",
                    "settings": {
                        "foreground": "#4be772",
                        "fontStyle": "bold"
                    }
                },
            ],
        },
    },
    "emmet.extensionsPath": [
        "C:\\Users\\Roma\\AppData\\Roaming\\Code\\User\\snippets"
    ],
    "emmet.includeLanguages": {
        "ejs": "html",
        "njk": "html"
    },
    "liveServer.settings.AdvanceCustomBrowserCmdLine": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
    "sync.gist": "38f4936617e51ce953b17c2d12e818af",
    "liveServer.settings.donotShowInfoMsg": true,
    "files.associations": {
        "*.njk": "html"
    },
    "javascript.updateImportsOnFileMove.enabled": "always",
    "remote.SSH.remotePlatform": {
        "localhost": "linux"
    },
    "remote.SSH.defaultForwardedPorts": [],
    "remote.SSH.configFile": "C:\\Users\\Roma\\.ssh\\config",
    "git.ignoredRepositories": [
        "public",
        "node_modules",
        "package-lock.json"
    ],
    "ecsstractor_port.element_separator": "",
    "ecsstractor_port.modifier_separator": "",
    "ecsstractor_port.destination": "tab",
    "explorer.compactFolders": false,
    "workbench.startupEditor": "none",
    "workbench.sideBar.location": "left",
    "workbench.colorTheme": "Default Dark+",
    "settingsSync.ignoredExtensions": [
        "workbench.colorTheme",
        "Default High Contrast",
        "Default Dark+"
    ],
}


And the linter file:

module.exports = {
    parserOptions: {
        sourceType: 'module',
        ecmaVersion: 2021,
    },
    extends: [
        'eslint:recommended',
        'plugin:node/recommended'
    ],
    rules: {
        semi: ['error', 'always'],
        quotes: ['error', 'single']
    }
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bugs-bunny, 2022-04-05
@bugs-bunny

As far as I know, Prettier was responsible for the indentation , and in principle it can be configured both at the global level and at the project level.
Well, or edit the field in your file (settings.json):
{"editor.tabSize": 2}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question