Coder Social home page Coder Social logo

Sublime Text Plugin about prettier HOT 19 CLOSED

prettier avatar prettier commented on May 1, 2024 26
Sublime Text Plugin

from prettier.

Comments (19)

dusty avatar dusty commented on May 1, 2024 14

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.

jlangston avatar jlangston commented on May 1, 2024 6

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.

jlangston avatar jlangston commented on May 1, 2024 6

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

Haroenv avatar Haroenv commented on May 1, 2024 5

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.

danreeves avatar danreeves commented on May 1, 2024 5

@jlangston hah, you beat me to it. Here's my WIP: https://github.com/danreeves/sublime-prettier

from prettier.

danreeves avatar danreeves commented on May 1, 2024 4

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

danreeves avatar danreeves commented on May 1, 2024 2

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

danreeves avatar danreeves commented on May 1, 2024 2

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.

slashwhatever avatar slashwhatever commented on May 1, 2024 2

This is how I handled it in Sublime

Similar to @dusty with a few minor concessions due to legacy code considerations.

from prettier.

jlangston avatar jlangston commented on May 1, 2024 1

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

danreeves avatar danreeves commented on May 1, 2024 1

@viankakrisna Yep, that's the one 👍

@jlongster This issues was resolved by #318 so should be closed?

from prettier.

jlongster avatar jlongster commented on May 1, 2024

Not yet! Someone else needs to build :) A PR would be great (even if it's just a link to another package)

from prettier.

OrkoHunter avatar OrkoHunter commented on May 1, 2024

I feel the library is trending too fast for me to get inspired and learn how to write Sublime Text plugins ;)

from prettier.

scottwarren avatar scottwarren commented on May 1, 2024

Have added a link in #143

from prettier.

viankakrisna avatar viankakrisna commented on May 1, 2024

image
Anybody having this issue on windows? I'm using 0.11.0. Linux works fine

from prettier.

danreeves avatar danreeves commented on May 1, 2024

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.

viankakrisna avatar viankakrisna commented on May 1, 2024

yeah, overall it's just a wacky formatting. I'm using the one from the package control. is it the same?

from prettier.

viankakrisna avatar viankakrisna commented on May 1, 2024

will post the issue on its repo, i think it's the same

from prettier.

viankakrisna avatar viankakrisna commented on May 1, 2024

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)

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.