prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.14k stars 455 forks source link

Apparently 'eslint -fix' not being called for *.svelte files with prettiereslintIntegration #840

Closed SteveALee closed 5 years ago

SteveALee commented 5 years ago

I have the extension set to use prettiereslint integration and for a .js file the eqeqeq error is getting fixed correctly on file save.

However the same code in a .svelte file is not working.

eslint-plugin-svelte3 is installed to handle the .svelte file and eslint --fix works fine as does clicking on the lightbulb in vscode. It's just the fix on file save that is not working.

There's a project here that exhibits the problem. see the 2 files in src/

FYI I previously raised an issue on eslint-plugin-svelt3 and it appears the lint --fixmay not be being called by prittier on file save. Perhaps due to file extension?

ntotten commented 5 years ago

This is our parser inference. The extension is likely not detecting the type of the file correctly. As a workaround, you can specify the parser in a prettier config file "overrides" property and set the parser. See: https://prettier.io/docs/en/options.html#parser

{
    // ...
    "overrides":[{
        "files": "*.html", // replace this by more specific extension if needed
        "options": {
            "parser": "html"
        }
    }]
}

Duplicate of #487

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.