Git Product home page Git Product logo

prettier-plugin-brace-style's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

prettier-plugin-brace-style's Issues

Dependency conflicts

Dependency information

    "prettier": "^3.0.3",
    "prettier-plugin-brace-style": "^0.3.0",

Steps to reproduce

Just npm install

The current behavior

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/prettier
npm WARN   dev prettier@"^3.0.3" from the root project
npm WARN   2 more (prettier-plugin-brace-style, @prettier/sync)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer prettier@"~2.8.4" from [email protected]
npm WARN node_modules/prettier-plugin-brace-style/node_modules/prettier-plugin-merge
npm WARN   optional prettier-plugin-merge@"~0.2.0" from [email protected]
npm WARN   node_modules/prettier-plugin-brace-style
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/prettier
npm WARN   peer prettier@"~2.8.4" from [email protected]
npm WARN   node_modules/prettier-plugin-brace-style/node_modules/prettier-plugin-merge
npm WARN     optional prettier-plugin-merge@"~0.2.0" from [email protected]
npm WARN     node_modules/prettier-plugin-brace-style

The expected behavior

No conflicts. This creates issues in some of my CI.

Strange Behavior for Stroustrup

Dependency information

package.json

"dependencies": {
        "react": "^18.2.0",
        "react-dom": "^18.2.0"
    },
    "devDependencies": {
        "@figma/plugin-typings": "^1.76.0",
        "@prettier/sync": "^0.5.1",
        "@types/react": "^18.2.43",
        "@types/react-dom": "^18.2.17",
        "@typescript-eslint/eslint-plugin": "^6.14.0",
        "@typescript-eslint/parser": "^6.14.0",
        "@vitejs/plugin-react": "^4.2.1",
        "eslint": "^8.55.0",
        "eslint-plugin-react-hooks": "^4.6.0",
        "eslint-plugin-react-refresh": "^0.4.5",
        "prettier": "^3.2.5",
        "prettier-plugin-brace-style": "^0.5.0",
        "prop-types": "^15.8.1",
        "typescript": "^5.2.2",
        "vite": "^5.0.8",
        "vite-plugin-singlefile": "^0.13.5"
    }

.prettierrc

{
    "semi": true,
    "trailingComma": "none",
    "singleQuote": true,
    "tabWidth": 4,
    "printWidth": 100,
    "plugins": ["prettier-plugin-brace-style"],
    "braceStyle": "stroustrup"
}

Steps to reproduce

  1. Create an empty function.
  2. Make sure prettier is enabled to format on save file.
  3. Save.

The current behavior

I have an empty code block like the following:

registerCallbacks() {}

When I save my file, it changes it to the following:

}
egisterCallbacks() {}

If I uninstall the plugin, the bug doesn't happen anymore. Is it conflicting with something else in VS code?

The expected behavior

No change to the code block on save.

VSCode Format selection functionality doesn't work with this plugin

Dependency information

VSCode 1.85.1
prettier 3.1.1
prettier-plugin-brace-style 0.5.0

Steps to reproduce

Select a block to format and use editor.action.formatSelection in VSCode.

The current behavior

VSCode has this cool feature called Format selection (editor.action.formatSelection) which allows me to only format my own blocks of a file without having to change it completely. The only reason for me to use this plugin would be to use prettier as formatter for this feature. Otherwise I would just use a relative feature in eslint and use it as formatter, because eslint doesn't have an api for Format selection and with your plugin so does prettier.

The expected behavior

Prettier has some kind of api for format selection which should be supported by the plugin.

This plugin does not play nicely with "prettier-plugin-tailwindcss"

Dependency information

For reference: https://tailwindcss.com/blog/automatic-class-sorting-with-prettier

The official prettier-plugin-tailwindcss will nicely sort your tailwind classes into an opinionated order. I would love to be able to use this classnames plugin, but unfortunately when I add it to my tailwind config it breaks the sorting that the official plugin provides.

Steps to reproduce

Add these plugins to your .prettierrc.json: (order doesn't matter)
"plugins": [
"prettier-plugin-tailwindcss",
"prettier-plugin-classnames"
]

The current behavior

Class sorting breaks while line wrapping still works

The expected behavior

Both class sorting and line wrapping work in harmony

Format array of objects

Is your feature request related to a problem? Please describe

Could this be also applied to array of objects, like the below?

  await func(
    {
      a: '',
      b: '',
    },
    {
      a: '',
      b: '',
    }
  );

Describe the solution you'd like

In 1tbs, it should look like

  await func({
    a: '',
    b: '',
  }, {
    a: '',
    b: '',
  });

and like so in allman

  await func({
    a: '',
    b: '',
  }, 
  {
    a: '',
    b: '',
  });

Describe alternatives you've considered

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.