@prantlf/jsonlint 11.1.0 → 11.1.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 +1 -1
- package/lib/cli.js +7 -2
- package/package.json +24 -17
- package/web/jsonlint.html +3 -3
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ By default, `jsonlint` will either report a syntax error with details or pretty-
|
|
|
100
100
|
the parsed object
|
|
101
101
|
-P, --pretty-print-invalid force pretty-printing even for invalid input
|
|
102
102
|
-r, --trailing-newline ensure a line break at the end of the output
|
|
103
|
+
-R, --no-trailing-newline ensure no line break at the end of the output
|
|
103
104
|
--prune-comments omit comments from the prettified output
|
|
104
105
|
--strip-object-keys strip quotes from object keys if possible
|
|
105
106
|
(JSON5)
|
|
@@ -324,7 +325,6 @@ Licensed under the [MIT License].
|
|
|
324
325
|
|
|
325
326
|
[MIT License]: http://en.wikipedia.org/wiki/MIT_License
|
|
326
327
|
[pure JavaScript version]: http://prantlf.github.com/jsonlint/
|
|
327
|
-
[jsonlint.com]: http://jsonlint.com
|
|
328
328
|
[JSON]: https://tools.ietf.org/html/rfc8259
|
|
329
329
|
[JSON5]: https://spec.json5.org
|
|
330
330
|
[JSON Schema]: https://json-schema.org
|
package/lib/cli.js
CHANGED
|
@@ -33,6 +33,7 @@ const commander = require('commander')
|
|
|
33
33
|
.option('-p, --pretty-print', 'prettify the input instead of stringifying the parsed object')
|
|
34
34
|
.option('-P, --pretty-print-invalid', 'force pretty-printing even for invalid input')
|
|
35
35
|
.option('-r, --trailing-newline', 'ensure a line break at the end of the output')
|
|
36
|
+
.option('-R, --no-trailing-newline', 'ensure no line break at the end of the output')
|
|
36
37
|
.option('--prune-comments', 'omit comments from the prettified output')
|
|
37
38
|
.option('--strip-object-keys', 'strip quotes from object keys if possible (JSON5)')
|
|
38
39
|
.option('--enforce-double-quotes', 'surrounds all strings with double quotes')
|
|
@@ -135,9 +136,13 @@ function parse (source, file) {
|
|
|
135
136
|
|
|
136
137
|
function processFile (file) {
|
|
137
138
|
file = path.normalize(file)
|
|
138
|
-
|
|
139
|
+
const original = fs.readFileSync(file, 'utf8')
|
|
140
|
+
let source = parse(original, file)
|
|
139
141
|
if (options.inPlace) {
|
|
140
|
-
|
|
142
|
+
const lines = original.split(/\?r\n/)
|
|
143
|
+
const newLine = !lines[lines.length - 1]
|
|
144
|
+
if (options.trailingNewline === true ||
|
|
145
|
+
(options.trailingNewline !== false && newLine)) {
|
|
141
146
|
source += '\n'
|
|
142
147
|
}
|
|
143
148
|
fs.writeFileSync(file, source)
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prantlf/jsonlint",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "JSON/CJSON/JSON5 parser, syntax and schema validator and pretty-printer.",
|
|
5
5
|
"author": "Ferdinand Prantl <prantlf@gmail.com> (http://prantl.tk)",
|
|
6
6
|
"contributors": [
|
|
7
|
+
"Ondrej Medek <xmedeko@gmail.com>",
|
|
7
8
|
"Greg Inman <ginman@itriagehealth.com>",
|
|
8
9
|
"Paul Vollmer <mail@paulvollmer.net> (http://paulvollmer.net)",
|
|
9
10
|
"Zach Carter <zach@carter.name> (http://zaa.ch)"
|
|
@@ -58,28 +59,28 @@
|
|
|
58
59
|
"text"
|
|
59
60
|
]
|
|
60
61
|
},
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
"release": {
|
|
63
|
+
"plugins": [
|
|
64
|
+
"@semantic-release/commit-analyzer",
|
|
65
|
+
"@semantic-release/release-notes-generator",
|
|
66
|
+
"@semantic-release/changelog",
|
|
67
|
+
"@semantic-release/npm",
|
|
68
|
+
[
|
|
69
|
+
"@semantic-release/github",
|
|
70
|
+
{
|
|
71
|
+
"failComment": false
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"@semantic-release/git"
|
|
70
75
|
]
|
|
71
76
|
},
|
|
72
|
-
"keywords": [
|
|
73
|
-
"json",
|
|
74
|
-
"validation",
|
|
75
|
-
"lint",
|
|
76
|
-
"jsonlint"
|
|
77
|
-
],
|
|
78
77
|
"dependencies": {
|
|
79
78
|
"ajv": "6.12.6",
|
|
80
79
|
"commander": "9.2.0"
|
|
81
80
|
},
|
|
82
81
|
"devDependencies": {
|
|
82
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
83
|
+
"@semantic-release/git": "^10.0.1",
|
|
83
84
|
"@types/node": "17.0.30",
|
|
84
85
|
"@typescript-eslint/eslint-plugin": "5.21.0",
|
|
85
86
|
"@typescript-eslint/parser": "5.21.0",
|
|
@@ -94,5 +95,11 @@
|
|
|
94
95
|
"terser": "5.13.1",
|
|
95
96
|
"test": "0.6.0",
|
|
96
97
|
"typescript": "4.6.4"
|
|
97
|
-
}
|
|
98
|
+
},
|
|
99
|
+
"keywords": [
|
|
100
|
+
"json",
|
|
101
|
+
"validation",
|
|
102
|
+
"lint",
|
|
103
|
+
"jsonlint"
|
|
104
|
+
]
|
|
98
105
|
}
|
package/web/jsonlint.html
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
<body>
|
|
80
80
|
<header>
|
|
81
81
|
<h1>JSON Lint</h1>
|
|
82
|
-
<p>Enter data and optionally schema in the form below to validate them
|
|
82
|
+
<p>Enter data and optionally schema in the form below to validate them.</p>
|
|
83
83
|
</header>
|
|
84
84
|
<main>
|
|
85
85
|
<section>
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
</div>
|
|
112
112
|
<div>
|
|
113
113
|
<input type="checkbox" checked id="duplicate-object-keys">
|
|
114
|
-
<label for="
|
|
114
|
+
<label for="duplicate-object-keys">Allow duplicate object keys</label>
|
|
115
115
|
</div>
|
|
116
116
|
</div>
|
|
117
117
|
<div>
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
</main>
|
|
180
180
|
<hr>
|
|
181
181
|
<footer>
|
|
182
|
-
<small>Copyright © 2012-
|
|
182
|
+
<small>Copyright © 2012-2022 Zachary Carter, Ferdinand Prantl. See the <a href="https://github.com/prantlf/jsonlint#json-lint">project pages</a> to learn about command-line validation and programmatic usage.</small>
|
|
183
183
|
<!-- See http://tholman.com/github-corners/ -->
|
|
184
184
|
<a href="http://github.com/prantlf/jsonlint" class="github-corner" title="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
|
|
185
185
|
</footer>
|