Skip to content

Commit 487996e

Browse files
committed
feat: add prettier-plugin-packagejson plugin to configuration
1 parent ab5b22d commit 487996e

File tree

5 files changed

+111
-6
lines changed

5 files changed

+111
-6
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
run: yarn semantic-release
3030
env:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<!-- markdownlint-disable --><!-- textlint-disable -->
2+
23
# 📓 Changelog
4+
35
All notable changes to this project will be documented in this file. See
46
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
57

68
# 1.0.0 (2023-03-06)
79

8-
910
### Features
1011

11-
* **prettier:** create `prettier` configuration ([b60a66d](https://github.com/JanSzewczyk/prettier-config/commit/b60a66d4a66a98b2d00c33e627596d727ef400cf))
12-
* **semantic-release:** add `semantic-release` configuration ([edafa98](https://github.com/JanSzewczyk/prettier-config/commit/edafa984e6ba1c7ce2ba02b5320befcce25aa562))
12+
- **prettier:** create `prettier` configuration ([b60a66d](https://github.com/JanSzewczyk/prettier-config/commit/b60a66d4a66a98b2d00c33e627596d727ef400cf))
13+
- **semantic-release:** add `semantic-release` configuration ([edafa98](https://github.com/JanSzewczyk/prettier-config/commit/edafa984e6ba1c7ce2ba02b5320befcce25aa562))

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
11
# @szum-tech/prettier-config
22

3+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/JanSzewczyk/prettier-config)
4+
[![GitHub pull requests](https://img.shields.io/github/issues-pr/JanSzewczyk/prettier-config)](https://github.com/JanSzewczyk/prettier-config/pulls)
5+
[![GitHub issues](https://img.shields.io/github/issues/JanSzewczyk/prettier-config)](https://github.com/JanSzewczyk/prettier-config/issues)
6+
![GitHub Repo stars](https://img.shields.io/github/stars/JanSzewczyk/prettier-config?style=social)
7+
8+
[![released](https://github.com/JanSzewczyk/prettier-config/actions/workflows/publish.yml/badge.svg?branch=main)](https://github.com/JanSzewczyk/prettier-config/actions/workflows/publish.yml)
9+
10+
[![npm](https://img.shields.io/npm/v/@szum-tech/prettier-config)](https://www.npmjs.com/package/@szum-tech/prettier-config)
11+
![npm](https://img.shields.io/npm/dm/@szum-tech/prettier-config)
12+
13+
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
14+
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/JanSzewczyk/prettier-config/blob/main/LICENSE)
15+
316
---
417

518
[Prettier](https://prettier.io/) shareable configuration.
19+
20+
# Table of contents
21+
22+
- [Features](#features)
23+
- [Technologies](#technologies)
24+
- [Usage](#usage)
25+
- [Installation](#installation)
26+
- [Set configuration](#set-configuration)
27+
- [Add scripts](#add-scripts)
28+
- [Changelog](#changelog)
29+
- [License](#license)
30+
31+
# Features
32+
33+
- [Opinionated code formatter with support for: JavaScript, Typescript, JSX, ...](https://prettier.io/)
34+
- [Sort the keys of a `package.json` file](https://github.com/matzkoh/prettier-plugin-packagejson#readme)
35+
36+
# Technologies
37+
38+
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/JanSzewczyk/prettier-config/prettier-plugin-packagejson)
39+
40+
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/JanSzewczyk/prettier-config/dev/prettier)
41+
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/JanSzewczyk/prettier-config/dev/semantic-release)
42+
43+
I also used my packages:
44+
45+
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/JanSzewczyk/prettier-config/dev/@szum-tech/semantic-release-preset)
46+
47+
# Usage
48+
49+
## Installation
50+
51+
[@szum-tech/prettier-config](https://www.npmjs.com/package/@szum-tech/prettier-config) is available as an [npm package](https://www.npmjs.com/package/@szum-tech/prettier-config).
52+
53+
**npm:**
54+
55+
```shell
56+
npm install -D prettier @szum-tech/prettier-config
57+
```
58+
59+
**yarn:**
60+
61+
```shell
62+
yarn add -D prettier @szum-tech/prettier-config
63+
```
64+
65+
## Set configuration
66+
67+
Full documentation on how to create a Prettier configuration can be found [here](https://prettier.io/docs/en/configuration.html).
68+
69+
Below are the recommended ways to add it:
70+
71+
### 1. Create config file
72+
73+
First create `prettier.config.js` file in root project directory. Then:
74+
75+
```js
76+
module.exports = require("@szum-tech/prettier-config");
77+
```
78+
79+
### 2. Add to `package.json` file
80+
81+
```json
82+
{
83+
"prettier": "@szum-tech/prettier-config"
84+
}
85+
```
86+
87+
> **Note** You can ignore files by adding it to `.prettierignore`.
88+
89+
## Add scripts
90+
91+
Optional, can add scripts to `package.json` file :
92+
93+
```json
94+
{
95+
"scripts": {
96+
"prettier:check": "prettier --check .",
97+
"prettier:write": "prettier --write ."
98+
}
99+
}
100+
```
101+
102+
# Changelog
103+
104+
The [changelog](https://github.com/JanSzewczyk/prettier-config/blob/main/CHANGELOG.md) is regularly updated to reflect what's changed in each new release.
105+
106+
# License
107+
108+
This project is licensed under the terms of the [MIT license](https://github.com/JanSzewczyk/prettier-config/blob/main/LICENCE).

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ module.exports = {
77
trailingComma: "none",
88
bracketSpacing: true,
99
bracketSameLine: false,
10-
printWidth: 100
10+
printWidth: 100,
11+
plugins: ["prettier-plugin-packagejson"]
1112
};

release.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
module.exports = {
33
branches: ["main"],
44
extends: "@szum-tech/semantic-release-preset"
5-
};
5+
};

0 commit comments

Comments
 (0)