Skip to content

Extension not respecting Prettier config #70

@mikededo

Description

@mikededo

Describe the bug

The extension is not respecting the Prettier config file. In my case it is defined as a .prettierrc.json.

To Reproduce

The configuration we are using is for Prettier is:

// .prettierrc.json
{
    "printWidth": 100,
    "tabWidth": 4,
    "trailingComma": "none",
    "singleQuote": true
}

Expected behavior

The following line 84 columns and it does not break the printWidth prop of the config file:

import { ComponentOne, ComponentTwo, ComponentThree } from '@company/some-library';

When formatting the code with VSCode, the line is kept as it should, since it respects Prettier. Furthermore, the sorter should not wrap the line, nor change the tabWidth.

Actual behavior

When running the extension, the code gets formatted to the following:

import {
  ComponentOne,
  ComponentTwo,
  ComponentThree
} from '@company/some-library';

As I supose, it breaks the line since it overflows the default 80 columns. Also, it uses a tabWidth of 2, which is not the expected.

OS (please complete the following information):

  • OS: Manjaro Linux
  • Version: 5.15 Linux Kernel

VS Code (please complete the following information):

  • Version: 1.66.0

package.json (please remove any sensitive info)

I'm not allowed to share the package.json file.

.prettierrc/.prettierrc.js/prettier.config.js/.prettierrc.toml (if any)

filename: .prettierrc.json

{
    "printWidth": 100,
    "tabWidth": 4,
    "trailingComma": "none",
    "singleQuote": true
}

Installed VS Code extensions

[Execute $ code --list-extensions in terminal to get the list. How to run VS Code from terminal in MacOS]

aaron-bond.better-comments
adpyke.codesnap
akamud.vscode-theme-onedark
albert.TabOut
bierner.github-markdown-preview
bierner.markdown-checkbox
bierner.markdown-emoji
bierner.markdown-footnotes
bierner.markdown-preview-github-styles
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
dozerg.tsimportsorter
dsznajder.es7-react-js-snippets
eamodio.gitlens
esbenp.prettier-vscode
formulahendry.auto-rename-tag
Gruntfuggly.todo-tree
helgardrichard.helium-icon-theme
mhutchie.git-graph
miquelddg.dart-barrel-file-generator
ms-azuretools.vscode-docker
ms-vscode.vscode-typescript-next
pflannery.vscode-versionlens
redhat.vscode-yaml
richie5um2.vscode-sort-json
rid9.datetime
sburg.vscode-javascript-booster
VisualStudioExptTeam.vscodeintellicode
wix.glean
wmaurer.change-case
yzhang.markdown-all-in-one

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions