npm-pkg-lint 3.9.1 → 3.9.2
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/dist/index.js +5 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6934,7 +6934,8 @@ var types = {
|
|
|
6934
6934
|
var DEFAULT_OPTIONS = {
|
|
6935
6935
|
mode: "json",
|
|
6936
6936
|
ranges: false,
|
|
6937
|
-
tokens: false
|
|
6937
|
+
tokens: false,
|
|
6938
|
+
allowTrailingCommas: false
|
|
6938
6939
|
};
|
|
6939
6940
|
function getStringValue(value, token, json5 = false) {
|
|
6940
6941
|
let result = "";
|
|
@@ -7026,6 +7027,7 @@ function parse(text, options) {
|
|
|
7026
7027
|
ranges: options.ranges
|
|
7027
7028
|
});
|
|
7028
7029
|
const json5 = options.mode === "json5";
|
|
7030
|
+
const allowTrailingCommas = options.allowTrailingCommas || json5;
|
|
7029
7031
|
function nextNoComments() {
|
|
7030
7032
|
const nextType = tokenizer.next();
|
|
7031
7033
|
if (nextType && options.tokens) {
|
|
@@ -7194,7 +7196,7 @@ function parse(text, options) {
|
|
|
7194
7196
|
}
|
|
7195
7197
|
if (tokenType === tt.Comma) {
|
|
7196
7198
|
tokenType = next();
|
|
7197
|
-
if (
|
|
7199
|
+
if (allowTrailingCommas && tokenType === tt.RBrace) {
|
|
7198
7200
|
break;
|
|
7199
7201
|
}
|
|
7200
7202
|
} else {
|
|
@@ -7233,7 +7235,7 @@ function parse(text, options) {
|
|
|
7233
7235
|
tokenType = next();
|
|
7234
7236
|
if (tokenType === tt.Comma) {
|
|
7235
7237
|
tokenType = next();
|
|
7236
|
-
if (
|
|
7238
|
+
if (allowTrailingCommas && tokenType === tt.RBracket) {
|
|
7237
7239
|
break;
|
|
7238
7240
|
}
|
|
7239
7241
|
} else {
|