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)
- prettier formatWithCursor very slowed when use with *.min.js HOT 1
- [CSS] Remove extra indent for multiline `:where`, `:is` and `:not` selectors
- Ranged formatting for `yield` in iterators breaks with tuples HOT 1
- Ugly logical expression break in Vue `v-if`
- [bug] [yaml] list indent fix can result in invalid yaml or change the meaning of existing yaml
- HTML 'strict' whitespace sometimes injecting a '>'
- Bug with type assertion around yield expression
- Prettier breaks Markdown alert syntax
- Prettier changes meaning of HTML+JS code when using tags that look like self-closing HOT 3
- Comment in last line of YAML files gets leading newline trimmed HOT 1
- Typescript: Prettier incorrectly breaks up constructor properties from modifiers when there is a decorator and comment before it HOT 1
- [Documentation] Pre-Commit Hook Usage case caveat
- Still the error "Error: Comment "Hello" was not printed. Please report this error!" even though I have added a comment in the Doc. HOT 1
- [JavaScript] Comments between ternary operator formatting result is ugly HOT 2
- Prettier wrong formatting of Angular flow HOT 3
- Markdown undesirable formatting behaviour when new text added to paragraph HOT 2
- Error when file names HOT 4
- Can we have a CLI flag that allows ignoring .gitignore and/or .prettierignore please? HOT 2
- Unstable block comment for implemented interfaces (TypeScript) (moved and non-idempotent)
- Markdown lists with extra indent lead to unstable formatting behavior
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.