Comments (17)
I donβt know, @azz built all the support for it.
from plugin-php.
@mgrip yep, those steps worked. Not sure why reinstalling prettier as prettier/prettier
works but my existing install would fail.
Thanks π
Sent with GitHawk
from plugin-php.
@pjhartin Please raise bugs for those items!
@mgrip Sorry for the delay in responding. Fixing it in prettier/prettier#4038.
from plugin-php.
I'm having the same issue - not using globally installed prettier though.
from plugin-php.
I believe you still need to specify the plugin manually, although that does seem to contradict the prettier docs. @azz or @vjeux do you guys have any more info on how plugins are intended to be run from a cli?
from plugin-php.
@mgrip I tried that as well, without luck.
The command I attempted,
yarn prettier --plugin=./node_modules/@prettier/plugin-php app/Http/Controllers/ReserveController.php
here's some more info,
β―: cat package.json | rg "prettier"
"prettier": "1.10.2",
"@prettier/plugin-php": "0.0.0-development",
"eslint-config-prettier": "^2.4.0",
"eslint-plugin-prettier": "^2.2.0",
"prettier-eslint": "^8.2.1",
β―: yarn --version
1.3.2
β―: yarn prettier --version
yarn run v1.3.2
$ /Users/camron/src/lodgetools/inntender/node_modules/.bin/prettier --version
1.10.2
edited to use the package.json from the correct branch
from plugin-php.
what's the error you get when manually specifying the plugin? I'm guessing the package might have to be updated on npm - there have been a lot of changes since @azz originally published it
from plugin-php.
β―: yarn prettier --plugin=./node_modules/@prettier/plugin-php app/Http/Controllers/ReserveController.php
yarn run v1.3.2
$ /Users/camron/src/lodgetools/inntender/node_modules/.bin/prettier --plugin=./node_modules/@prettier/plugin-php app/Http/Controllers/ReserveController.php
[error] app/Http/Controllers/ReserveController.php: SyntaxError: Unexpected token (1:2)
[error] > 1 | <?php
[error] | ^
[error] 2 |
[error] 3 | namespace InnTender\Http\Controllers;
[error] 4 |
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
from plugin-php.
@vjeux @azz do you guys know how the plugins are intended to be run from the cli? the docs make its seem like plugins are intended to be found automatically, but it doesn't seem like thats happening
from plugin-php.
Confirm don't work as expected
from plugin-php.
Ok think I got something that will at least work for now. 2 main things
- you still need to specify the parser
- while we're developing you should probably use the repos as dependencies rather than whats published on npm as things are getting updated very quickly
so this should work
yarn add --dev prettier/prettier prettier/plugin-php
prettier --parser=php /some/php/file.php
I can update the readme accordingly
from plugin-php.
/cc @azz
from plugin-php.
@camflan @pjhartin can you guys see if that worked when you have a chance? if so I'll close this out for now
from plugin-php.
Pretty sure this is working - gonna close for now
from plugin-php.
i believe its because prettier
would just add whatever the latest version published to npm is, prettier/prettier
references the git repo (and there are recent changes that the plugins rely on)
from plugin-php.
from plugin-php.
@mgrip Thanks, I followed your instructions and all seemed to work well.i did notice however that a number of phpDoc comments within my phone code were being stripped away by prettier though. So I'm not 100% on using it right now.
from plugin-php.
Related Issues (20)
- Backward compatibility for CommonJS
- `npx prettier . --check` doesn't check php files HOT 3
- Class and method braces with no body split onto multiple lines
- Brackets vanish in Recursive IIFE
- Attributes removed since 0.19.2 if method argument has an attribute with attributes in them and arrays and some new lines
- Comments in attributes (e.g. for an array item) are weirdly moved to somewhere completely else
- Some comment positions inside attributes can result in prettier failing with an exception
- Docs: specify if prettier follow psr-12 or something else
- Syntax error when attributes are defined to enum cases
- PHP 8.3 support HOT 3
- [bug] singleQuote option from API call does not work on latest release
- INC file extension not recognized
- Issue HOT 1
- Adjobscc.io
- Allow attributes to be placed above constructor properties
- Invoked import/require callable removes necessary parentheses
- Nguyenthaocc727
- parentheses bug. HOT 2
- does not respect prettier printWidth in overrides since v0.22.0 HOT 2
- Removes brackets from require_once which changes the evaluation of the expression (Laravel 11 index.php)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-php.