Skip to content

Commit 61c868c

Browse files
committedJan 24, 2022
v2.13.4
1 parent eb4609a commit 61c868c

File tree

5 files changed

+126
-23
lines changed

5 files changed

+126
-23
lines changed
 

‎CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<a name="2.13.4"></a>
2+
## [2.13.4](https://github.com/jshint/jshint/compare/2.13.3...v2.13.4) (2022-01-24)
3+
4+
### Bug Fixes
5+
6+
* Remove shelljs ([eb4609a](https://github.com/jshint/jshint/commit/eb4609a))
7+
18
<a name="2.13.3"></a>
29
## [2.13.3](https://github.com/jshint/jshint/compare/2.13.2...v2.13.3) (2022-01-05)
310

‎dist/jshint-rhino.js

+58-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env rhino
22
var window = {};
3-
/*! 2.13.3 */
3+
/*! 2.13.4 */
44
var JSHINT;
55
if (typeof window === 'undefined') window = {};
66
(function () {
@@ -1442,14 +1442,15 @@ function isUndefined(arg) {
14421442
var undefined;
14431443

14441444
/** Used as the semantic version number. */
1445-
var VERSION = '4.17.20';
1445+
var VERSION = '4.17.21';
14461446

14471447
/** Used as the size to enable large array optimizations. */
14481448
var LARGE_ARRAY_SIZE = 200;
14491449

14501450
/** Error message constants. */
14511451
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
1452-
FUNC_ERROR_TEXT = 'Expected a function';
1452+
FUNC_ERROR_TEXT = 'Expected a function',
1453+
INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
14531454

14541455
/** Used to stand-in for `undefined` hash values. */
14551456
var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -1582,10 +1583,11 @@ function isUndefined(arg) {
15821583
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
15831584
reHasRegExpChar = RegExp(reRegExpChar.source);
15841585

1585-
/** Used to match leading and trailing whitespace. */
1586-
var reTrim = /^\s+|\s+$/g,
1587-
reTrimStart = /^\s+/,
1588-
reTrimEnd = /\s+$/;
1586+
/** Used to match leading whitespace. */
1587+
var reTrimStart = /^\s+/;
1588+
1589+
/** Used to match a single whitespace character. */
1590+
var reWhitespace = /\s/;
15891591

15901592
/** Used to match wrap detail comments. */
15911593
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@@ -1595,6 +1597,18 @@ function isUndefined(arg) {
15951597
/** Used to match words composed of alphanumeric characters. */
15961598
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
15971599

1600+
/**
1601+
* Used to validate the `validate` option in `_.template` variable.
1602+
*
1603+
* Forbids characters which could potentially change the meaning of the function argument definition:
1604+
* - "()," (modification of function parameters)
1605+
* - "=" (default value)
1606+
* - "[]{}" (destructuring of function parameters)
1607+
* - "/" (beginning of a comment)
1608+
* - whitespace
1609+
*/
1610+
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
1611+
15981612
/** Used to match backslashes in property paths. */
15991613
var reEscapeChar = /\\(\\)?/g;
16001614

@@ -2423,6 +2437,19 @@ function isUndefined(arg) {
24232437
});
24242438
}
24252439

2440+
/**
2441+
* The base implementation of `_.trim`.
2442+
*
2443+
* @private
2444+
* @param {string} string The string to trim.
2445+
* @returns {string} Returns the trimmed string.
2446+
*/
2447+
function baseTrim(string) {
2448+
return string
2449+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
2450+
: string;
2451+
}
2452+
24262453
/**
24272454
* The base implementation of `_.unary` without support for storing metadata.
24282455
*
@@ -2756,6 +2783,21 @@ function isUndefined(arg) {
27562783
: asciiToArray(string);
27572784
}
27582785

2786+
/**
2787+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
2788+
* character of `string`.
2789+
*
2790+
* @private
2791+
* @param {string} string The string to inspect.
2792+
* @returns {number} Returns the index of the last non-whitespace character.
2793+
*/
2794+
function trimmedEndIndex(string) {
2795+
var index = string.length;
2796+
2797+
while (index-- && reWhitespace.test(string.charAt(index))) {}
2798+
return index;
2799+
}
2800+
27592801
/**
27602802
* Used by `_.unescape` to convert HTML entities to characters.
27612803
*
@@ -13924,7 +13966,7 @@ function isUndefined(arg) {
1392413966
if (typeof value != 'string') {
1392513967
return value === 0 ? value : +value;
1392613968
}
13927-
value = value.replace(reTrim, '');
13969+
value = baseTrim(value);
1392813970
var isBinary = reIsBinary.test(value);
1392913971
return (isBinary || reIsOctal.test(value))
1393013972
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
@@ -16296,6 +16338,12 @@ function isUndefined(arg) {
1629616338
if (!variable) {
1629716339
source = 'with (obj) {\n' + source + '\n}\n';
1629816340
}
16341+
// Throw an error if a forbidden character was found in `variable`, to prevent
16342+
// potential command injection attacks.
16343+
else if (reForbiddenIdentifierChars.test(variable)) {
16344+
throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
16345+
}
16346+
1629916347
// Cleanup code by stripping empty strings.
1630016348
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
1630116349
.replace(reEmptyStringMiddle, '$1')
@@ -16409,7 +16457,7 @@ function isUndefined(arg) {
1640916457
function trim(string, chars, guard) {
1641016458
string = toString(string);
1641116459
if (string && (guard || chars === undefined)) {
16412-
return string.replace(reTrim, '');
16460+
return baseTrim(string);
1641316461
}
1641416462
if (!string || !(chars = baseToString(chars))) {
1641516463
return string;
@@ -16444,7 +16492,7 @@ function isUndefined(arg) {
1644416492
function trimEnd(string, chars, guard) {
1644516493
string = toString(string);
1644616494
if (string && (guard || chars === undefined)) {
16447-
return string.replace(reTrimEnd, '');
16495+
return string.slice(0, trimmedEndIndex(string) + 1);
1644816496
}
1644916497
if (!string || !(chars = baseToString(chars))) {
1645016498
return string;

‎dist/jshint.js

+58-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! 2.13.3 */
1+
/*! 2.13.4 */
22
var JSHINT;
33
if (typeof window === 'undefined') window = {};
44
(function () {
@@ -1440,14 +1440,15 @@ function isUndefined(arg) {
14401440
var undefined;
14411441

14421442
/** Used as the semantic version number. */
1443-
var VERSION = '4.17.20';
1443+
var VERSION = '4.17.21';
14441444

14451445
/** Used as the size to enable large array optimizations. */
14461446
var LARGE_ARRAY_SIZE = 200;
14471447

14481448
/** Error message constants. */
14491449
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
1450-
FUNC_ERROR_TEXT = 'Expected a function';
1450+
FUNC_ERROR_TEXT = 'Expected a function',
1451+
INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
14511452

14521453
/** Used to stand-in for `undefined` hash values. */
14531454
var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -1580,10 +1581,11 @@ function isUndefined(arg) {
15801581
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
15811582
reHasRegExpChar = RegExp(reRegExpChar.source);
15821583

1583-
/** Used to match leading and trailing whitespace. */
1584-
var reTrim = /^\s+|\s+$/g,
1585-
reTrimStart = /^\s+/,
1586-
reTrimEnd = /\s+$/;
1584+
/** Used to match leading whitespace. */
1585+
var reTrimStart = /^\s+/;
1586+
1587+
/** Used to match a single whitespace character. */
1588+
var reWhitespace = /\s/;
15871589

15881590
/** Used to match wrap detail comments. */
15891591
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@@ -1593,6 +1595,18 @@ function isUndefined(arg) {
15931595
/** Used to match words composed of alphanumeric characters. */
15941596
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
15951597

1598+
/**
1599+
* Used to validate the `validate` option in `_.template` variable.
1600+
*
1601+
* Forbids characters which could potentially change the meaning of the function argument definition:
1602+
* - "()," (modification of function parameters)
1603+
* - "=" (default value)
1604+
* - "[]{}" (destructuring of function parameters)
1605+
* - "/" (beginning of a comment)
1606+
* - whitespace
1607+
*/
1608+
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
1609+
15961610
/** Used to match backslashes in property paths. */
15971611
var reEscapeChar = /\\(\\)?/g;
15981612

@@ -2421,6 +2435,19 @@ function isUndefined(arg) {
24212435
});
24222436
}
24232437

2438+
/**
2439+
* The base implementation of `_.trim`.
2440+
*
2441+
* @private
2442+
* @param {string} string The string to trim.
2443+
* @returns {string} Returns the trimmed string.
2444+
*/
2445+
function baseTrim(string) {
2446+
return string
2447+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
2448+
: string;
2449+
}
2450+
24242451
/**
24252452
* The base implementation of `_.unary` without support for storing metadata.
24262453
*
@@ -2754,6 +2781,21 @@ function isUndefined(arg) {
27542781
: asciiToArray(string);
27552782
}
27562783

2784+
/**
2785+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
2786+
* character of `string`.
2787+
*
2788+
* @private
2789+
* @param {string} string The string to inspect.
2790+
* @returns {number} Returns the index of the last non-whitespace character.
2791+
*/
2792+
function trimmedEndIndex(string) {
2793+
var index = string.length;
2794+
2795+
while (index-- && reWhitespace.test(string.charAt(index))) {}
2796+
return index;
2797+
}
2798+
27572799
/**
27582800
* Used by `_.unescape` to convert HTML entities to characters.
27592801
*
@@ -13922,7 +13964,7 @@ function isUndefined(arg) {
1392213964
if (typeof value != 'string') {
1392313965
return value === 0 ? value : +value;
1392413966
}
13925-
value = value.replace(reTrim, '');
13967+
value = baseTrim(value);
1392613968
var isBinary = reIsBinary.test(value);
1392713969
return (isBinary || reIsOctal.test(value))
1392813970
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
@@ -16294,6 +16336,12 @@ function isUndefined(arg) {
1629416336
if (!variable) {
1629516337
source = 'with (obj) {\n' + source + '\n}\n';
1629616338
}
16339+
// Throw an error if a forbidden character was found in `variable`, to prevent
16340+
// potential command injection attacks.
16341+
else if (reForbiddenIdentifierChars.test(variable)) {
16342+
throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
16343+
}
16344+
1629716345
// Cleanup code by stripping empty strings.
1629816346
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
1629916347
.replace(reEmptyStringMiddle, '$1')
@@ -16407,7 +16455,7 @@ function isUndefined(arg) {
1640716455
function trim(string, chars, guard) {
1640816456
string = toString(string);
1640916457
if (string && (guard || chars === undefined)) {
16410-
return string.replace(reTrim, '');
16458+
return baseTrim(string);
1641116459
}
1641216460
if (!string || !(chars = baseToString(chars))) {
1641316461
return string;
@@ -16442,7 +16490,7 @@ function isUndefined(arg) {
1644216490
function trimEnd(string, chars, guard) {
1644316491
string = toString(string);
1644416492
if (string && (guard || chars === undefined)) {
16445-
return string.replace(reTrimEnd, '');
16493+
return string.slice(0, trimmedEndIndex(string) + 1);
1644616494
}
1644716495
if (!string || !(chars = baseToString(chars))) {
1644816496
return string;

‎package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jshint",
3-
"version": "2.13.3",
3+
"version": "2.13.4",
44
"homepage": "http://jshint.com/",
55
"description": "Static analysis tool for JavaScript",
66
"author": {

0 commit comments

Comments
 (0)
Please sign in to comment.