Comments (19)
I am using an alternative solution for sublime. Just thought I'd share, in case there are any other eslint users.
I use this eslint plugin, to pass prettier rules to eslint
https://github.com/not-an-aardvark/eslint-plugin-prettier
This this plugin to warn me on errors inside sublime
https://github.com/roadhump/SublimeLinter-eslint
Then this package to simply autofix via eslint --fix
https://github.com/TheSavior/ESLint-Formatter
I like it because I can place the rules I want to pass to prettier in my eslint config file checked into git vs matching my rules in the jsPrettier user settings with my eslint config.
eg:
# .eslintrc.json
{
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": ["error", { "singleQuote": true , "bracketSpacing": false }]
}
}
from prettier.
Prettier seems great. I've been using a different sublime text plugin but it stopped working some time ago but it was pretty easy to swap out the node formatting package to use prettier. This is very much a WIP if your interested https://github.com/jlangston/sublime-jsprettier
from prettier.
@danreeves nice work! I figured a few might pop up around this. That said if one person's plugin is of better quality or offers a stronger feature set with either the editor or the formatter I'd be in favor around collaborating towards a more 'official' sublime prettier plugin we can add to package control. Doesn't matter if it's based off of the one I started or not. Either way this is great lots of promise around this formatter.
from prettier.
You can however put it as a build system in sublime text, where it's just the cli command with the current file as argument (and with --write
)
from prettier.
@jlangston hah, you beat me to it. Here's my WIP: https://github.com/danreeves/sublime-prettier
from prettier.
@jlangston agreed, I'm up for discussion. This is the first Sublime plugin I've made so I couldn't tell you about best practices in the space.
I noticed yours bundles some JS files and requires an npm install inside the package. Personally, I'd rather have the package defer to a global (or local to the project) installation of prettier
.
Yours does have a few nice options though; autoformat, file extensions.
from prettier.
@jlangston It doesn't support it yet but from what I've written so far it would be a pretty simple addition. I'm happy to get started on adding these features and maintain it.
from prettier.
Looks like @jonlabelle has already made a PR to packagecontrol.io, and his versions already supports using either a prepackaged or globally installed prettier
, so maybe lets just move on with his.
EDIT:
It doesn't work nicely with nvm however. Trying to figure out how to configure it right now...
from prettier.
This is how I handled it in Sublime
Similar to @dusty with a few minor concessions due to legacy code considerations.
from prettier.
@danreeves We can defer to a global install or bundle it in the repo. Does your plugin support formatting just a selection vs an entire file? If it's something you'd like to spearhead maintaining we can move with your repo and just add whatever features we feel are missing. Things like auto format aren't that hard to add. I think we just want it to be configurable and expose whatever options the formatter supports and be able to act on a selection or an entire file.
Also @scottwarren thanks for adding a PR but I do think we should probably have the prettier README link to whichever plugin we collectively nominate to back and get that one into Package control and link to that page from the prettier README so it's an easier install for users.
from prettier.
@viankakrisna Yep, that's the one 👍
@jlongster This issues was resolved by #318 so should be closed?
from prettier.
Not yet! Someone else needs to build :) A PR would be great (even if it's just a link to another package)
from prettier.
I feel the library is trending too fast for me to get inspired and learn how to write Sublime Text plugins ;)
from prettier.
Have added a link in #143
from prettier.
Anybody having this issue on windows? I'm using 0.11.0. Linux works fine
from prettier.
Hey @viankakrisna, if you're using the plugin linked from the readme you might get a better response from at its repo: https://github.com/jonlabelle/SublimeJsPrettier
You could also clarify the issue. I'm guessing it's the extra indentation of the function arguments, weird indeed.
from prettier.
yeah, overall it's just a wacky formatting. I'm using the one from the package control. is it the same?
from prettier.
will post the issue on its repo, i think it's the same
from prettier.
I think the issue is with prettier 0.11.0, 0.0.10 works fine
jonlabelle/SublimeJsPrettier#8 (comment)
jonlabelle/SublimeJsPrettier#9
Not really sure where the problem is
from prettier.
Related Issues (20)
- feat: add support for @let syntax in Angular HOT 2
- Issue formating large HTML file HOT 2
- [Vue] Incorrect syntax error for tag-like string in template literals
- Not formatting any xml files if file extension is not explicitly defined HOT 4
- Cannot find package 'prettier-plugin-svelte again HOT 2
- Ugly output in logical expression with long membe rexpression and object literal
- `--experimental-ternaries` along with `--no-semi` produces incorrect code
- Release 3.3 HOT 1
- Incorrect line breaks in object destructuring expressions when exceeding line width
- Ignore global gitignore or global prettierignore
- Add support for "with" keyword in import attributes HOT 1
- let multi variable declarators one line HOT 1
- Unexpected line break in `assert { type: "json" }`
- Some empty lines is being removed in markdown YAML frontmatter HOT 3
- Bug, prettier messed up my js file HOT 2
- resolveConfigFile bug? HOT 2
- 3.3.0 regression - link definitions / references in markdown cause incorrect wrapping with prose-wrap always
- How to remove the automatic add {" "} ? HOT 3
- handlebars attrbutes changed: {{@x.y.z}} becomes {{@x}} HOT 4
- Cannot read properties of undefined (reading 'unit') HOT 1
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 prettier.