Skip to content

prettier-tslint ignores defaultFormatterOptions #1489

Open
@tobiaskohlbau

Description

@tobiaskohlbau
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Linux but most likely all
  • Vetur version: 0.22.6
  • VS Code version: 1.39.2

Problem

If prettier-tslint is selected within vetur.format.defaultFormatter.ts the options from vetur.format.defaultFormatterOptions are not used. In addition it's nowhere documented that prettier-tslint assumes the settings from prettier like for e.g.:

"vetur.format.defaultFormatterOptions": {
        "prettier": {
            "singleQuote": true
        }
    }

The issue is that the options are not passed into the execution of prettier-tslint. Only the default { parser } is passed in.

const prettierifiedCode = prettierTslint({
prettierOptions: { parser },
text: code,
filePath: fileFsPath,
fallbackPrettierOptions: prettierOptions
});

It should be the otherway arround, that the { parser } is the fallback and the specified options are used instead. I've attached my solution below which I've build and loaded into vscode and looks good to me.

If this issue gets acknowledged I will prepare a PR to fix this. In advance I suppose the same issue applies to prettierEslintify.

Solution

    const prettierifiedCode = prettierTslint({
      prettierOptions: prettierOptions,
      text: code,
      filePath: fileFsPath,
      fallbackPrettierOptions: { parser }
    });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions