All Projects → jgierer12 → Prettier Github

jgierer12 / Prettier Github

Licence: mit
Format code in GitHub comments with Prettier

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Prettier Github

Gpt2bot
Your new Telegram buddy powered by transformers
Stars: ✭ 228 (-6.56%)
Mutual labels:  bot
Tslint Plugin Prettier
Runs Prettier as a TSLint rule and reports differences as individual TSLint issues
Stars: ✭ 232 (-4.92%)
Mutual labels:  prettier
Typescript Starter
Quickly create and configure a new library or Node.js project
Stars: ✭ 2,953 (+1110.25%)
Mutual labels:  prettier
React Starter Kit
React, Redux, Webpack, Material UI, Boostrap 4, Code Splitting, HMR
Stars: ✭ 229 (-6.15%)
Mutual labels:  prettier
Udemy Course Grabber
A script/software for automatically enrolling/joining 100% discounted Udemy courses for free. Get Paid Udemy courses for free with just a few clicks.
Stars: ✭ 230 (-5.74%)
Mutual labels:  bot
Typescript Lib Starter
Typescript library starter
Stars: ✭ 235 (-3.69%)
Mutual labels:  prettier
Laravel Crawler Detect
A Laravel wrapper for CrawlerDetect - the web crawler detection library
Stars: ✭ 227 (-6.97%)
Mutual labels:  bot
Telegram channel downloader
一个电报群组、频道下载脚本,支持上传到GD、OD等rclone可以挂载的网盘。
Stars: ✭ 216 (-11.48%)
Mutual labels:  bot
Facebooktoolkit
a tool to get Facebook data, and some Facebook bots, and extra tools found on Facebook Toolkit ++.
Stars: ✭ 227 (-6.97%)
Mutual labels:  bot
First Timers Bot
A friendly bot that helps onboarding new Open Source Contributors
Stars: ✭ 239 (-2.05%)
Mutual labels:  bot
Get Me A Date
😍 Help me get a 💘 date tonight 🌛
Stars: ✭ 228 (-6.56%)
Mutual labels:  bot
Botui
🤖 A JavaScript framework to create conversational UIs
Stars: ✭ 2,607 (+968.44%)
Mutual labels:  bot
Anydlbot
An Open Source GPLv3 All-In-One Telegram Bot
Stars: ✭ 236 (-3.28%)
Mutual labels:  bot
Twitch Js
A community-centric, community-supported version of tmi.js
Stars: ✭ 225 (-7.79%)
Mutual labels:  bot
Publicleech
can be found on Telegram as https://telegram.dog/PublicLeechGroup
Stars: ✭ 236 (-3.28%)
Mutual labels:  bot
Python Telegram Bot
We have made you a wrapper you can't refuse
Stars: ✭ 17,209 (+6952.87%)
Mutual labels:  bot
Bastion
🚀 Get an enhanced Discord experience!
Stars: ✭ 234 (-4.1%)
Mutual labels:  bot
Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (-2.46%)
Mutual labels:  prettier
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (-1.23%)
Mutual labels:  prettier
Profiles
👍 Make JavaScript Great Again
Stars: ✭ 238 (-2.46%)
Mutual labels:  bot

Prettier GitHub Build Status

Format code in GitHub comments with Prettier

Installation

GitHub app

This is the recommended and easiest installation method. Install the Prettier GitHub app to some or all of your repos.

Self-hosted

  1. Deploy to now or Deploy to Heroku
  2. Setup
    1. Register a GitHub app
    2. Use whatever makes sense for you for App name, Description, Homepage URL and User authorization callback URL; leave Setup URL empty
    3. Set Webhook URL to your deployment URL, for example https://prettier-github.herokuapp.com/
    4. Set a Webhook secret and note it down
    5. Select Read & write access for Issues, Pull requests and Repository contents
    6. For Issues and Pull requests, check all Webhook checkboxes; for Repository contents, check only Commit comment
    7. Click on Create GitHub app
    8. Click on Generate private key and save the downloaded file
    9. Note down the app ID (displayed under your username in the right column)
  3. Configure environment variables of your deployment
    1. Set GITHUB_KEY to the downloaded private key
    2. Set GITHUB_ID to the app ID
    3. Set GITHUB_WEBHOOK_SECRET to the Webhook secret you configured

Usage

Whenever someone includes a JavaScript code block in a comment, it will be formatted using Prettier.

Before: Before

After: After

You can disable formatting per-comment by writing <!-- prettier-github disable --> anywhere in the comment (except code blocks)

Limitations

Due to lacking GitHub APIs, Prettier GitHub currently doesn't format reviews, review comments and commit comments. See #11

Configuration

Prettier GitHub will use the prettier field in the package.json of the respective repository for configuration. See Prettier's readme for available options. Additionally, you can set langs to an array specifying which languages should be formatted.

Example

package.json:

{
	...
	"prettier": {
		"singleQuote": true,
		"useTabs": true,
		"langs": [
			"js",
			"javascript"
		]
	}
	...
}

This will enforce single quotes and tabs, and will only format code blocks marked as js or javascript.

Development

  1. Generate personal access token with the repo scope for your GitHub account
  2. Install ngrok for localhost tunnelling
  3. Run ngrok http 3000 and note down the URL, for example http://2ab92a92.ngrok.io
  4. Set up a webhook for your testing repo
    1. Set Payload URL to the ngrok URL
    2. Set Content type to application/json
    3. Set a Secret and note it down
    4. Select Let me select individual events; then check Commit comment, Issue comment, Issues, Pull request, Pull request review and Pull request review comment and uncheck Push
  5. Copy .env.example
    1. Set GITHUB_TOKEN to the personal access token generated earlier
    2. Set GITHUB_WEBHOOK_SECRET to the Webhook secret you configured
  6. Run npm install and then npm start

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].