Skip to content
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
merged 4 commits into from
Feb 3, 2024

Conversation

shufo
Copy link
Contributor

@shufo shufo commented Jan 1, 2024

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.

@shufo
Copy link
Contributor Author

shufo commented Jan 30, 2024

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']
); ?>

@shufo
Copy link
Contributor Author

shufo commented Jan 30, 2024

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.

@shufo
Copy link
Contributor Author

shufo commented Jan 30, 2024

@czosel Could you review this?

@czosel
Copy link
Collaborator

czosel commented Feb 3, 2024

Hi @shufo, sorry about the delay and thanks for the contribution! 💯

@czosel czosel merged commit ea27073 into prettier:main Feb 3, 2024
12 checks passed
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
@czosel
Copy link
Collaborator

czosel commented Feb 3, 2024

Released in v0.22.2 🎉

@shufo
Copy link
Contributor Author

shufo commented Feb 4, 2024

@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 (@&#8203;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 [@&#8203;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
[@&#8203;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
[@&#8203;czosel](https://togithub.com/czosel) in
[https://github.com/prettier/plugin-php/pull/2321](https://togithub.com/prettier/plugin-php/pull/2321)

#### New Contributors

- [@&#8203;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
([#&#8203;2290](https://togithub.com/prettier/prettier-php/issues/2290),
thanks [@&#8203;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"
([#&#8203;2269](https://togithub.com/prettier/prettier-php/issues/2269),
thanks [@&#8203;ferchoz](https://togithub.com/ferchoz))
- fix: make `/standalone` entry work with `require()`
([#&#8203;2247](https://togithub.com/prettier/prettier-php/issues/2247),
thanks [@&#8203;shufo](https://togithub.com/shufo))
- chore: upgrade deps
([#&#8203;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
([#&#8203;2258](https://togithub.com/prettier/prettier-php/issues/2258),
thanks [@&#8203;claytonrcarter](https://togithub.com/claytonrcarter)!)
- chore!: upgrade dependencies
([#&#8203;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
([#&#8203;2194](https://togithub.com/prettier/prettier-php/issues/2194),
thanks [@&#8203;WazzaJB](https://togithub.com/WazzaJB)!)
- Use `AstPath` getters
([#&#8203;2214](https://togithub.com/prettier/prettier-php/issues/2214),
thanks [@&#8203;fisker](https://togithub.com/fisker)!)
- Migrate to ESM
([#&#8203;2213](https://togithub.com/prettier/prettier-php/issues/2213),
thanks [@&#8203;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 [@&#8203;fisker](https://togithub.com/fisker) for many
contributions!

- feat: upgrade to prettier 3
([#&#8203;2200](https://togithub.com/prettier/prettier-php/issues/2200))
- Simplify `print()`
([#&#8203;2212](https://togithub.com/prettier/prettier-php/issues/2212))
- Convert tests to ES Modules
([#&#8203;2210](https://togithub.com/prettier/prettier-php/issues/2210))
- Fix standalone test
([#&#8203;2211](https://togithub.com/prettier/prettier-php/issues/2211))
- Update .gitattributes
([#&#8203;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
([#&#8203;1956](https://togithub.com/prettier/prettier-php/issues/1956),
[#&#8203;2201](https://togithub.com/prettier/prettier-php/issues/2201) -
thanks [@&#8203;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
([#&#8203;2186](https://togithub.com/prettier/prettier-php/issues/2186),
thanks [@&#8203;cseufert](https://togithub.com/cseufert)!)
- chore: upgrade dependencies
([#&#8203;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
([#&#8203;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 [@&#8203;fisker](https://togithub.com/fisker)!

- improve doc print and update prettier dependency
([#&#8203;1922](https://togithub.com/prettier/prettier-php/issues/1922))
- use `clean.ignoredProperties`
([#&#8203;2158](https://togithub.com/prettier/prettier-php/issues/2158))
- Remove handling `\r`
([#&#8203;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]
([#&#8203;2131](https://togithub.com/prettier/prettier-php/issues/2131),
thanks [@&#8203;genintho](https://togithub.com/genintho)!)
- chore: upgrade dependencies
([#&#8203;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
([#&#8203;2086](https://togithub.com/prettier/prettier-php/issues/2086),
thanks [@&#8203;cseufert](https://togithub.com/cseufert)!)
- Fix for function curly brace with attrs
([#&#8203;2089](https://togithub.com/prettier/prettier-php/issues/2089),
thanks [@&#8203;cseufert](https://togithub.com/cseufert)!)
- Deprecated PSR-2 braceStyle and use PER-CS instead
([#&#8203;2070](https://togithub.com/prettier/prettier-php/issues/2070),
thanks [@&#8203;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
([#&#8203;2062](https://togithub.com/prettier/prettier-php/issues/2062),
thanks [@&#8203;cseufert](https://togithub.com/cseufert)!)
- chore: upgrade dependencies
([#&#8203;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
([#&#8203;2054](https://togithub.com/prettier/prettier-php/issues/2054))
- chore: upgrade dependencies
([#&#8203;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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] singleQuote option from API call does not work on latest release
2 participants