@html-validate/prettier-config 2.2.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,12 +10,35 @@ npm install --save-dev @html-validate/prettier-config
10
10
 
11
11
  ## Usage
12
12
 
13
- In your `package.json` file:
13
+ ```
14
+ npm pkg set prettier="@html-validate/prettier-config"
15
+ npm pkg set scripts.prettier:check="prettier --check ."
16
+ npm pkg set scripts.prettier:write="prettier --write ."
17
+ ```
18
+
19
+ Or manually edit `package.json`:
14
20
 
15
21
  ```json
16
22
  {
23
+ "scripts": {
24
+ "prettier:check": "prettier --check .",
25
+ "prettier:write": "prettier --write ."
26
+ },
17
27
  "prettier": "@html-validate/prettier-config"
18
28
  }
19
29
  ```
20
30
 
21
- Prettier does not need to be installed separately, this package includes `prettier` and it's binary.
31
+ Prettier does not need to be installed separately, this package includes `prettier` and its binary.
32
+
33
+ ## lint-staged
34
+
35
+ To use lint-staged (included) configure the `pre-commit` hook to run husky with the `--config` flag:
36
+
37
+ ```bash
38
+ #!/bin/sh
39
+
40
+ configfile=$(node -p 'require.resolve("@html-validate/prettier-config/lint-staged")')
41
+ exec npm exec lint-staged -- --config "${configfile}"
42
+ ```
43
+
44
+ Lint-staged does not need to be installed separately, this package includes `lint-staged` and its binary.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require("path");
4
+ const { spawn } = require("child_process"); // eslint-disable-line security/detect-child-process
5
+
6
+ const pkgPath = path.dirname(require.resolve("lint-staged/package.json"));
7
+ const binary = path.join(pkgPath, "bin/lint-staged.js");
8
+
9
+ spawn("node", [binary, ...process.argv.slice(2)], {
10
+ stdio: "inherit",
11
+ }).on("exit", (code) => {
12
+ /* eslint-disable-next-line no-process-exit */
13
+ process.exit(code);
14
+ });
File without changes
package/lint-staged.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ [`*`]: "prettier --ignore-unknown --write",
3
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/prettier-config",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
4
  "description": "Prettier sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "prettier"
@@ -17,10 +17,12 @@
17
17
  "author": "David Sveningsson <ext@sidvind.com>",
18
18
  "main": "index.js",
19
19
  "bin": {
20
- "prettier": "prettier.js"
20
+ "lint-staged": "bin/lint-staged.js",
21
+ "prettier": "bin/prettier.js"
21
22
  },
22
23
  "files": [
23
- "*.js"
24
+ "*.js",
25
+ "bin"
24
26
  ],
25
27
  "scripts": {
26
28
  "prepare": "husky install",
@@ -31,25 +33,22 @@
31
33
  "commitlint": {
32
34
  "extends": "@html-validate"
33
35
  },
34
- "lint-staged": {
35
- "*.{js,json,md}": "prettier --write"
36
- },
37
36
  "prettier": ".",
38
37
  "release": {
39
38
  "extends": "@html-validate/semantic-release-config"
40
39
  },
41
40
  "dependencies": {
42
- "prettier": "2.7.1"
41
+ "lint-staged": "13.0.4",
42
+ "prettier": "2.8.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@html-validate/commitlint-config": "3.0.3",
46
- "@html-validate/semantic-release-config": "3.5.0",
47
- "husky": "8.0.1",
48
- "lint-staged": "13.0.2",
45
+ "@html-validate/commitlint-config": "3.0.7",
46
+ "@html-validate/semantic-release-config": "3.5.15",
47
+ "husky": "8.0.2",
49
48
  "npm-pkg-lint": "1.11.1"
50
49
  },
51
50
  "engines": {
52
- "node": ">= 14.0"
51
+ "node": ">= 14.13.1"
53
52
  },
54
53
  "publishConfig": {
55
54
  "access": "public"