Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mediacurrent/prettier-config

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mediacurrent/prettier-config

Make sure all of your code is run through Prettier when you commit it to git. We achieve this by configuring prettier to run on git hooks using husky and lint-staged.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

prettier-config

Make sure all of your code is run through Prettier when you commit it to git. We achieve this by configuring prettier to run on git hooks using husky and lint-staged.

Install

npm install --save-dev prettier @mediacurrent/prettier-config

Extend

Can be extended two ways:

package.json

Add the following to you package.json

"prettier": "@mediacurrent/prettier-config"

This method does not allow overrides. If overrides are needed, use the next method.

.prettierrc.js

module.exports = {
  ...require("@mediacurrent/prettier-config"),
  // Override here
  semi: false,
};

Ignore File

Unfortunately, Prettier does not have a way to extend a shared .prettierignore file so the one in this repo must be copied and pasted in to a new .prettierignore file at the root of your project.

Pre-commit Hook

To have prettier format all files before commit (to prevent unformatted files from being committed), follow these steps.

Install packages

npm install --save-dev husky lint-staged

Add hooks to package.json

This will affect .js, .md, .mdx, .json, and .scss files. For this to work properly, eslint and sass-lint need to have been configured properly.

Add the following husky and lint-staged commands to your package.json.

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,md,mdx,json}": "['prettier --write']",
    "*.scss": "npm run lint:sass",
  }
}

Keywords

FAQs

Package last updated on 01 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc