-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 🐛 singleQuote option does not work on format API #2303
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By this fix, it will format double quote to single quote as expected. $ cat test.mjs
import prettier from "prettier/standalone";
import * as prettierPluginPhp from "./src/index.mjs";
console.log(
await prettier.format(
`<?php echo link_to_route("frontend.users.user.show", $users["name"], $users['_id']); ?>`,
{
plugins: [prettierPluginPhp],
singleQuote: true,
parser: "php",
}
)
); $ node test.mjs
<?php echo link_to_route(
'frontend.users.user.show',
$users['name'],
$users['_id']
); ?> |
Option display will not be changed like below. # PR branch
$ yarn run prettier | grep single-quote
--jsx-single-quote Use single quotes in JSX.
--single-quote Use single quotes instead of double quotes.
# main branch
$ yarn run prettier | grep single-quote
--jsx-single-quote Use single quotes in JSX.
--single-quote Use single quotes instead of double quotes. |
@czosel Could you review this? |
Hi @shufo, sorry about the delay and thanks for the contribution! 💯 |
czosel
pushed a commit
to czosel/plugin-php
that referenced
this pull request
Feb 3, 2024
* fix: 🐛 singleQuote option does not work on format API * test: 💍 add test for singleQuote option from api call * refactor: 💡 add comment * style: 💄 apply formatter
Released in |
@czosel Thank you so much! |
tisnamuliarta
referenced
this pull request
in tisnamuliarta/laravel-shadcn
Mar 11, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@prettier/plugin-php](https://togithub.com/prettier/prettier-php) | [`^0.18.9` -> `^0.22.0`](https://renovatebot.com/diffs/npm/@prettier%2fplugin-php/0.18.9/0.22.2) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@prettier%2fplugin-php/0.22.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@prettier%2fplugin-php/0.22.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@prettier%2fplugin-php/0.18.9/0.22.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@prettier%2fplugin-php/0.18.9/0.22.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>prettier/prettier-php (@​prettier/plugin-php)</summary> ### [`v0.22.2`](https://togithub.com/prettier/plugin-php/releases/tag/v0.22.2) [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.22.1...v0.22.2) #### What's Changed - Make chain breaking as similar to original prettier (js) as much as possible by [@​eldair](https://togithub.com/eldair) in [https://github.com/prettier/plugin-php/pull/2320](https://togithub.com/prettier/plugin-php/pull/2320) - fix: 🐛 singleQuote option does not work on format API by [@​shufo](https://togithub.com/shufo) in [https://github.com/prettier/plugin-php/pull/2303](https://togithub.com/prettier/plugin-php/pull/2303) - chore: upgrade dependencies by [@​czosel](https://togithub.com/czosel) in [https://github.com/prettier/plugin-php/pull/2321](https://togithub.com/prettier/plugin-php/pull/2321) #### New Contributors - [@​eldair](https://togithub.com/eldair) made their first contribution in [https://github.com/prettier/plugin-php/pull/2320](https://togithub.com/prettier/plugin-php/pull/2320) **Full Changelog**: prettier/plugin-php@v0.22.1...v0.22.2 ### [`v0.22.1`](https://togithub.com/prettier/plugin-php/releases/tag/v0.22.1) [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.22.0...v0.22.1) - fix the entry ([#​2290](https://togithub.com/prettier/prettier-php/issues/2290), thanks [@​fisker](https://togithub.com/fisker)) ### [`v0.22.0`](https://togithub.com/prettier/plugin-php/releases/tag/v0.22.0) [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.21.0...v0.22.0) - feat: make format compatible with "PER Coding Style 2.0" ([#​2269](https://togithub.com/prettier/prettier-php/issues/2269), thanks [@​ferchoz](https://togithub.com/ferchoz)) - fix: make `/standalone` entry work with `require()` ([#​2247](https://togithub.com/prettier/prettier-php/issues/2247), thanks [@​shufo](https://togithub.com/shufo)) - chore: upgrade deps ([#​2289](https://togithub.com/prettier/prettier-php/issues/2289)) ### [`v0.21.0`](https://togithub.com/prettier/plugin-php/releases/tag/v0.21.0): 0.21.0 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.20.1...v0.21.0) - fix(match): Indent match conditions ([#​2258](https://togithub.com/prettier/prettier-php/issues/2258), thanks [@​claytonrcarter](https://togithub.com/claytonrcarter)!) - chore!: upgrade dependencies ([#​2262](https://togithub.com/prettier/prettier-php/issues/2262)) #### Breaking changes This release drops support for node v14. ### [`v0.20.1`](https://togithub.com/prettier/plugin-php/releases/tag/v0.20.1) [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.20.0...v0.20.1) **This package is now pure ESM.** - vscode documentation update ([#​2194](https://togithub.com/prettier/prettier-php/issues/2194), thanks [@​WazzaJB](https://togithub.com/WazzaJB)!) - Use `AstPath` getters ([#​2214](https://togithub.com/prettier/prettier-php/issues/2214), thanks [@​fisker](https://togithub.com/fisker)!) - Migrate to ESM ([#​2213](https://togithub.com/prettier/prettier-php/issues/2213), thanks [@​fisker](https://togithub.com/fisker)!) ### [`v0.20.0`](https://togithub.com/prettier/plugin-php/releases/tag/v0.20.0) [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.7...v0.20.0) Many thanks to [@​fisker](https://togithub.com/fisker) for many contributions! - feat: upgrade to prettier 3 ([#​2200](https://togithub.com/prettier/prettier-php/issues/2200)) - Simplify `print()` ([#​2212](https://togithub.com/prettier/prettier-php/issues/2212)) - Convert tests to ES Modules ([#​2210](https://togithub.com/prettier/prettier-php/issues/2210)) - Fix standalone test ([#​2211](https://togithub.com/prettier/prettier-php/issues/2211)) - Update .gitattributes ([#​2209](https://togithub.com/prettier/prettier-php/issues/2209)) ### Breaking Change This adds support for Prettier v3. It also drops compatibility with Prettier v1 and v2. ### [`v0.19.7`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.7): 0.19.7 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.6...v0.19.7) - fix(match): Support empty lines and comments in match expressions ([#​1956](https://togithub.com/prettier/prettier-php/issues/1956), [#​2201](https://togithub.com/prettier/prettier-php/issues/2201) - thanks [@​claytonrcarter](https://togithub.com/claytonrcarter)!) ### [`v0.19.6`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.6): 0.19.6 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.5...v0.19.6) - Add support for final class const ([#​2186](https://togithub.com/prettier/prettier-php/issues/2186), thanks [@​cseufert](https://togithub.com/cseufert)!) - chore: upgrade dependencies ([#​2193](https://togithub.com/prettier/prettier-php/issues/2193)) ### [`v0.19.5`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.5): 0.19.5 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.4...v0.19.5) - fix: add option for PHP 8.2 ([#​2179](https://togithub.com/prettier/prettier-php/issues/2179)) *Note*: This allows setting `phpVersion` to `8.2` - Support for PHP 8.2 is still incomplete, though! ### [`v0.19.4`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.4): 0.19.4 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.3...v0.19.4) This release includes several internal cleanups and updates, thanks to contributions by [@​fisker](https://togithub.com/fisker)! - improve doc print and update prettier dependency ([#​1922](https://togithub.com/prettier/prettier-php/issues/1922)) - use `clean.ignoredProperties` ([#​2158](https://togithub.com/prettier/prettier-php/issues/2158)) - Remove handling `\r` ([#​2157](https://togithub.com/prettier/prettier-php/issues/2157)) - dependency updates ### [`v0.19.3`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.3): 0.19.3 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.2...v0.19.3) - feat: add support for readonly classes \[PHP 8.2] ([#​2131](https://togithub.com/prettier/prettier-php/issues/2131), thanks [@​genintho](https://togithub.com/genintho)!) - chore: upgrade dependencies ([#​2134](https://togithub.com/prettier/prettier-php/issues/2134)) ### [`v0.19.2`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.2): 0.19.2 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.1...v0.19.2) #### Deprecations The `psr2` setting for the `braceStyle` option has been renamed to `per-cs` to be more in line with future PER releases (see [https://github.com/prettier/plugin-php/issues/2060](https://togithub.com/prettier/plugin-php/issues/2060) for details). `psr2` will continue to work for now, but will be removed in a future release. #### Bugfixes - Support expressions in new statement ([#​2086](https://togithub.com/prettier/prettier-php/issues/2086), thanks [@​cseufert](https://togithub.com/cseufert)!) - Fix for function curly brace with attrs ([#​2089](https://togithub.com/prettier/prettier-php/issues/2089), thanks [@​cseufert](https://togithub.com/cseufert)!) - Deprecated PSR-2 braceStyle and use PER-CS instead ([#​2070](https://togithub.com/prettier/prettier-php/issues/2070), thanks [@​cseufert](https://togithub.com/cseufert)!) ### [`v0.19.1`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.1): 0.19.1 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.19.0...v0.19.1) - fix for inline closure ([#​2062](https://togithub.com/prettier/prettier-php/issues/2062), thanks [@​cseufert](https://togithub.com/cseufert)!) - chore: upgrade dependencies ([#​2068](https://togithub.com/prettier/prettier-php/issues/2068)) ### [`v0.19.0`](https://togithub.com/prettier/plugin-php/releases/tag/v0.19.0): 0.19.0 [Compare Source](https://togithub.com/prettier/prettier-php/compare/v0.18.9...v0.19.0) - fix: formatting of long cases in match statement ([#​2054](https://togithub.com/prettier/prettier-php/issues/2054)) - chore: upgrade dependencies ([#​2059](https://togithub.com/prettier/prettier-php/issues/2059)) Breaking Change: - Dropped support for Node v12. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/tisnamuliarta/laravel-shadcn). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIzMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes #2302.
singleQuote
option regression on format API.Related Issue
How it has been tested?
Added test for format api call. Please point out if this test method is not allowed in this project.