Code Monkey home page Code Monkey logo

Comments (17)

vjeux avatar vjeux commented on May 18, 2024 1

I don’t know, @azz built all the support for it.

from plugin-php.

camflan avatar camflan commented on May 18, 2024 1

@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.

azz avatar azz commented on May 18, 2024 1

@pjhartin Please raise bugs for those items!

@mgrip Sorry for the delay in responding. Fixing it in prettier/prettier#4038.

from plugin-php.

camflan avatar camflan commented on May 18, 2024

I'm having the same issue - not using globally installed prettier though.

from plugin-php.

mgrip avatar mgrip commented on May 18, 2024

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.

camflan avatar camflan commented on May 18, 2024

@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.

mgrip avatar mgrip commented on May 18, 2024

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.

camflan avatar camflan commented on May 18, 2024
❯: 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.

mgrip avatar mgrip commented on May 18, 2024

@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.

alexander-akait avatar alexander-akait commented on May 18, 2024

Confirm don't work as expected

from plugin-php.

mgrip avatar mgrip commented on May 18, 2024

Ok think I got something that will at least work for now. 2 main things

  1. you still need to specify the parser
  2. 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.

alexander-akait avatar alexander-akait commented on May 18, 2024

/cc @azz

from plugin-php.

mgrip avatar mgrip commented on May 18, 2024

@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.

mgrip avatar mgrip commented on May 18, 2024

Pretty sure this is working - gonna close for now

from plugin-php.

mgrip avatar mgrip commented on May 18, 2024

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.

camflan avatar camflan commented on May 18, 2024

from plugin-php.

philliphartin avatar philliphartin commented on May 18, 2024

@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)

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.