Skip to content
This repository has been archived by the owner. It is now read-only.

How to use it with prettier API? #108

Open
shreyas-a opened this issue Jul 5, 2018 · 1 comment
Open

How to use it with prettier API? #108

shreyas-a opened this issue Jul 5, 2018 · 1 comment
Labels

Comments

@shreyas-a
Copy link

@shreyas-a shreyas-a commented Jul 5, 2018

When I try to use it with following configuration, it throws

TypeError: Cannot read property 'toString' of null

prettier.format("print('Hello, world!')", {
  parser: 'python',
  plugins: ['@prettier/plugin-python'],
});
@azz
Copy link
Member

@azz azz commented Jul 29, 2018

I can't reproduce this error:

azz at macOS in ~/code/tmp on master [+!?]
$ cat format.js 
let prettier = require('prettier')

let result = prettier.format("print('Hello, world!')", {
  plugins: ['@prettier/plugin-python'],
  parser: 'python'
})

console.log(result)
azz at macOS in ~/code/tmp on master [+!?]
$ node format.js 
print("Hello, world!")


azz at macOS in ~/code/tmp on master [+!?]
$ yarn list prettier
yarn list v1.3.2
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ @prettier/plugin-python@0.0.0-development
│  └─ prettier@1.9.2
└─ prettier@1.13.7
@azz azz added the question label Jul 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.