You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-f, --config [file] read options from a custom configuration file
102
+
-F, --no-config disable searching for configuration file
103
+
-s, --sort-keys sort object keys (not when prettifying)
104
+
-E, --extensions [ext] file extensions to process for directory walk
105
+
(default: ["json","JSON"])
106
+
-i, --in-place overwrite the input files
107
+
-t, --indent [num|char] number of spaces or specific characters
108
+
to use for indentation (default: 2)
109
+
-c, --compact compact error display
110
+
-M, --mode [mode] set other parsing flags according to a format
111
+
type (default: "json")
112
+
-C, --comments recognize and ignore JavaScript-style comments
113
+
-S, --single-quoted-strings support single quotes as string delimiters
114
+
-T, --trailing-commas ignore trailing commas in objects and arrays
115
+
-D, --no-duplicate-keys report duplicate object keys as an error
116
+
-V, --validate [file] JSON schema file to use for validation
117
+
-e, --environment [env] which specification of JSON Schema the
118
+
validation file uses
119
+
-l, --log-files print only the parsed file names to stdout
120
+
-q, --quiet do not print the parsed json to stdout
121
+
-n, --continue continue with other files if an error occurs
122
+
-p, --pretty-print prettify the input instead of stringifying
123
+
the parsed object
124
+
-P, --pretty-print-invalid force pretty-printing even for invalid input
125
+
-r, --trailing-newline ensure a line break at the end of the output
126
+
-R, --no-trailing-newline ensure no line break at the end of the output
127
+
--prune-comments omit comments from the prettified output
128
+
--strip-object-keys strip quotes from object keys if possible
129
+
(JSON5)
130
+
--enforce-double-quotes surrounds all strings with double quotes
131
+
--enforce-single-quotes surrounds all strings with single quotes
132
+
(JSON5)
133
+
--trim-trailing-commas omit trailing commas from objects and arrays
134
+
(JSON5)
135
+
-v, --version output the version number
136
+
-h, --help output usage information
137
+
138
+
You can use BASH patterns for including and excluding files (only files).
139
+
Patterns are case-sensitive and have to use slashes as a path separators.
140
+
A pattern to exclude from processing starts with "!".
141
+
142
+
Parsing mode can be "cjson" or "json5" to enable other flags automatically.
143
+
If no files or directories are specified, stdin will be parsed. Environments
144
+
for JSON schema validation are "json-schema-draft-04", "json-schema-draft-06"
145
+
or "json-schema-draft-07". If not specified, it will be auto-detected.
146
+
147
+
### Configuration
148
+
149
+
In addition to the command line parameters, the options can be supplied from the following files:
150
+
151
+
package.json, key jsonlint
152
+
.jsonlintrc
153
+
.jsonlintrc.json
154
+
.jsonlintrc.yaml
155
+
.jsonlintrc.yml
156
+
.jsonlintrc.js
157
+
.jsonlintrc.cjs
158
+
jsonlint.config.js
159
+
jsonlint.config.cjs
160
+
161
+
The automatic search for one of the following locations above can be disabled by the command-line parameter `-F|--no-config`. A concrete configuration file can be specified by the command-line parameter `-f|--config [file]`. Parameters from the command line will have higher priority than parameters from a configuration file.
162
+
163
+
The configuration is an object with the following properties, described above, which can be entered either in the kebab-case or in the camel-case:
164
+
165
+
| Parameter | Alias |
166
+
| --------- | ----- |
167
+
| patterns ||
168
+
| sort-keys | sortKeys |
169
+
| extensions ||
170
+
| in-place | inPlace |
171
+
| indent ||
172
+
| compact ||
173
+
| mode ||
174
+
| comments ||
175
+
| single-quoted-strings | singleQuotedStrings |
176
+
| trailing-commas | trailingCommas |
177
+
| duplicate-keys | duplicateKeys |
178
+
| validate ||
179
+
| environment ||
180
+
| log-files | logFiles |
181
+
| quiet ||
182
+
| continue ||
183
+
| pretty-print | prettyPrint |
184
+
| pretty-print-invalid | prettyPrintInvalid |
185
+
| trailing-newline | trailingNewline'
186
+
| prune-comments | pruneComments |
187
+
| strip-object-keys | stripObjectKeys |
188
+
| enforce-double-quotes | enforceDoubleQuotes |
189
+
| enforce-single-quotes | enforceSingleQuotes |
190
+
| trim-trailing-commas | trimTrailingCommas |
191
+
192
+
The parameter `config` will be ignored in configuration files. The extra parameter `patterns` can be set to an array of strings with paths or patterns instead of putting them to the command line.
0 commit comments