New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump eslint-config-stylelint from 13.1.1 to 14.0.0 #5536
Bump eslint-config-stylelint from 13.1.1 to 14.0.0 #5536
Conversation
We need to avoid the problems of CommonJS. See stylelint/eslint-config-stylelint#143 (comment). |
@dependabot rebase |
Bumps [eslint-config-stylelint](https://github.com/stylelint/eslint-config-stylelint) from 13.1.1 to 14.0.0. - [Release notes](https://github.com/stylelint/eslint-config-stylelint/releases) - [Changelog](https://github.com/stylelint/eslint-config-stylelint/blob/master/CHANGELOG.md) - [Commits](stylelint/eslint-config-stylelint@13.1.1...14.0.0) --- updated-dependencies: - dependency-name: eslint-config-stylelint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2c22ccc
to
8d90796
Compare
Let's update the globals, run |
16 problems left after $ npm run lint:js -- -f codeframe
...
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/__tests__/standalone-syntax.test.js:23:39:
21 | expect(results).toHaveLength(6);
22 |
> 23 | const safeParserExtensionsTest = /\.(css|pcss|postcss)$/i;
| ^
24 |
25 | results
26 | .filter((result) => !safeParserExtensionsTest.test(result.source))
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/color-hex-alpha/index.js:16:16:
14 | });
15 |
> 16 | const HEX = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
| ^
17 |
18 | /** @type {import('stylelint').StylelintRule} */
19 | const rule = (primary) => {
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/font-family-name-quotes/index.js:55:12:
53 | function quotesRequired(family) {
54 | return family.split(/\s+/).some((word) => {
> 55 | return /^(-?\d|--)/.test(word) || !/^[-\w\u{00A0}-\u{10FFFF}]+$/u.test(word);
| ^
56 | });
57 | }
58 |
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/indentation/index.js:610:17:
608 |
609 | source = source.replace(/^[^\r\n]+/, (firstLine) => {
> 610 | if (/(?:^|\n)([ \t]*)$/.test(root.raws.beforeStart)) {
| ^
611 | return RegExp.$1 + firstLine;
612 | }
613 |
error: 'RegExp.$1' static property is forbidden (regexp/no-legacy-features) at lib/rules/indentation/index.js:611:12:
609 | source = source.replace(/^[^\r\n]+/, (firstLine) => {
610 | if (/(?:^|\n)([ \t]*)$/.test(root.raws.beforeStart)) {
> 611 | return RegExp.$1 + firstLine;
| ^
612 | }
613 |
614 | return '';
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/max-empty-lines/index.js:164:12:
162 | const emptyCRLFLines = '\r\n'.repeat(repeatTimes);
163 |
> 164 | return /(\r\n)+/.test(str)
| ^
165 | ? str.replace(/(\r\n)+/g, ($1) => {
166 | if ($1.length / 2 > repeatTimes) {
167 | return emptyCRLFLines;
error: Capturing group number 2 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/mediaQueryListCommaWhitespaceChecker.js:32:40:
30 | }
31 |
> 32 | if ((execResult = /^([^\S\r\n]*\/\/([\s\S]*?))\r?\n/.exec(params.slice(index + 1)))) {
| ^
33 | index += execResult[1].length;
34 | }
35 | }
error: The quantifier '\d*?' can exchange characters with '0+'. Using any string accepted by /0+/, this can be exploited to cause at least polynomial backtracking (regexp/no-super-linear-backtracking) at lib/rules/number-no-trailing-zeros/index.js:55:23:
53 | }
54 |
> 55 | const match = /\.(\d*?)(0+)(?:\D|$)/.exec(valueNode.value);
| ^
56 |
57 | // match[1] is any numbers between the decimal and our trailing zero, could be empty
58 | // match[2] is our trailing zero(s)
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/string-no-newline/index.js:15:20:
13 |
14 | const ruleName = 'string-no-newline';
> 15 | const reNewLine = /(\r?\n)/;
| ^
16 |
17 | const messages = ruleMessages(ruleName, {
18 | rejected: 'Unexpected newline in string',
error: 'RegExp.leftContext' static property is forbidden (regexp/no-legacy-features) at lib/rules/string-no-newline/index.js:65:7:
63 | attributeNode.operator,
64 | // length of the contents before newline
> 65 | RegExp.leftContext,
| ^
66 | ].reduce(
67 | (index, str) => index + str.length,
68 | // index of the start of our attribute node in our source
error: 'RegExp.leftContext' static property is forbidden (regexp/no-legacy-features) at lib/rules/string-no-newline/index.js:99:6:
97 | valueNode.quote,
98 | // length of the contents before newline
> 99 | RegExp.leftContext,
| ^
100 | ].reduce((index, str) => index + str.length, valueNode.sourceIndex);
101 |
102 | report({
error: Capturing group number 2 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/unit-disallowed-list/index.js:28:11:
26 | const value = mediaFeatureNode.value.toLowerCase();
27 |
> 28 | return /((-?\w*)*)/.exec(value)[1];
| ^
29 | };
30 |
31 | function rule(listInput, options) {
error: Unexpected useless alternative. This alternative is a strict subset of '\d+(?:\.\d*)?' and can be removed (regexp/no-dupe-disjunctions) at lib/utils/isKeyframeSelector.js:17:25:
15 |
16 | // Percentages
> 17 | if (/^(?:\d+(?:\.\d*)?|\d+(?:\.\d+)?|\.\d+)%$/.test(selector)) {
| ^
18 | return true;
19 | }
20 |
warning: The quantifier can be removed because the quantifier is lazy and has a minimum of 1 (regexp/no-lazy-ends) at lib/utils/isStandardSyntaxMediaFeatureName.js:11:18:
9 | module.exports = function (mediaFeatureName) {
10 | // SCSS interpolation
> 11 | if (/#\{.+?\}|\$.+?/.test(mediaFeatureName)) {
| ^
12 | return false;
13 | }
14 |
error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/utils/isStandardSyntaxSelector.js:28:14:
26 |
27 | // Less :extend()
> 28 | if (/:extend(\(.*?\))?/.test(selector)) {
| ^
29 | return false;
30 | }
31 |
error: Unexpected obscure character range. The characters of '+-/' (U+002b - U+002f) are not obvious (regexp/no-obscure-range) at lib/utils/isStandardSyntaxUrl.js:43:35:
41 | // But in this case it is allowed to use only specific characters
42 | // Also forbidden "/" at the end of url
> 43 | if (url.includes('$') && /^[$\s\w+-/*'"]+$/.test(url) && !url.endsWith('/')) {
| ^
44 | return false;
45 | }
46 |
15 errors and 1 warning found. |
Fixed "require": true,
"testRule": true
},
+ "rules": {
+ "regexp/no-unused-capturing-group": ["error", {"fixable": true}]
+ },
"root": true
},
"remarkConfig": { EDIT: 7 problems left. We need to fix them manually. |
It seems the ESLint plugin doesn't resolve the CodeQL warning of the |
That's a shame as I'll now need to unpick that regex ourselves. It's a good thing that the CodeQL is there to catch these things, though. |
@@ -20,7 +20,7 @@ it('standalone with postcss-safe-parser', () => { | |||
|
|||
expect(results).toHaveLength(6); | |||
|
|||
const safeParserExtensionsTest = /\.(css|pcss|postcss)$/i; | |||
const safeParserExtensionsTest = /\.(?:css|pcss|postcss)$/i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/no-unused-capturing-group - ?:
creates a non-capturing group.
@@ -64,7 +64,7 @@ const rule = (primary, _secondaryOptions, context) => { | |||
const betweenBefore = between.slice(0, sliceIndex); | |||
const betweenAfter = between.slice(sliceIndex); | |||
|
|||
if (/^\s*\r?\n/.test(betweenAfter)) { | |||
if (/^\s*\n/.test(betweenAfter)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/optimal-quantifier-concatenation - \s*
includes \r?
already.
@@ -241,7 +241,7 @@ function insertCharAtIndex(str, index, char) { | |||
* @param {string} source | |||
*/ | |||
function blurVariables(source) { | |||
return source.replace(/[$@][^)\s]+|#{.+?}/g, '0'); | |||
return source.replace(/[$@][^)\s]+|#\{.+?\}/g, '0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/strict
lib/rules/indentation/index.js
Outdated
const matched = /(?:^|\n)([ \t]*)$/.exec(root.raws.beforeStart); | ||
|
||
if (matched) { | ||
return matched[1] + firstLine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/no-legacy-features - RegExp.$1
-> matched[1]
@@ -161,7 +161,7 @@ const rule = (primary, secondaryOptions, context) => { | |||
const emptyLFLines = '\n'.repeat(repeatTimes); | |||
const emptyCRLFLines = '\r\n'.repeat(repeatTimes); | |||
|
|||
return /(\r\n)+/g.test(str) | |||
return /(?:\r\n)+/.test(str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/no-useless-flag - g
flag is useless for .test()
@@ -29,7 +29,7 @@ module.exports = function mediaQueryListCommaWhitespaceChecker(opts) { | |||
index += execResult[0].length; | |||
} | |||
|
|||
if ((execResult = /^([^\S\r\n]*\/\/([\s\S]*?))\r?\n/.exec(params.slice(index + 1)))) { | |||
if ((execResult = /^([^\S\r\n]*\/\/[\s\S]*?)\r?\n/.exec(params.slice(index + 1)))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -52,7 +52,7 @@ function rule(actual, secondary, context) { | |||
return; | |||
} | |||
|
|||
const match = /\.(\d*?)(0+)(?:\D|$)/.exec(valueNode.value); | |||
const match = /\.(\d{0,100}?)(0+)(?:\D|$)/.exec(valueNode.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/no-super-linear-backtracking - *
can be potential ReDoS, so it changes to {0,100}
@@ -60,7 +60,7 @@ testRule({ | |||
|
|||
testRule({ | |||
ruleName, | |||
config: [/\.foo.*>.*\.bar/], | |||
config: [/\.foo[^>]*>.*\.bar/], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -62,7 +64,7 @@ function rule(actual) { | |||
// length of our operator , ie '=' | |||
attributeNode.operator, | |||
// length of the contents before newline | |||
RegExp.leftContext, | |||
match.input.slice(0, match.index), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -8,7 +8,7 @@ | |||
*/ | |||
module.exports = function (mediaFeatureName) { | |||
// SCSS interpolation | |||
if (/#{.+?}|\$.+?/.test(mediaFeatureName)) { | |||
if (/#\{.+?\}|\$.+/.test(mediaFeatureName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -40,7 +40,7 @@ module.exports = function (url) { | |||
// In url without quotes scss variable can be everywhere | |||
// But in this case it is allowed to use only specific characters | |||
// Also forbidden "/" at the end of url | |||
if (url.includes('$') && /^[$\s\w+-/*'"/]+$/.test(url) && !url.endsWith('/')) { | |||
if (url.includes('$') && /^[$\s\w+\-,./*'"]+$/.test(url) && !url.endsWith('/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See regexp/no-obscure-range and regexp/no-dupe-characters-character-class - [+-/]
means a range between between +
(index 43) and /
(index 47). It is the same as [+,-./]
.
I've fixed all regex violations! 🙌🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, thank you!
Bumps eslint-config-stylelint from 13.1.1 to 14.0.0.
Release notes
Sourced from eslint-config-stylelint's releases.
Changelog
Sourced from eslint-config-stylelint's changelog.
Commits
a488e36
14.0.0feeb356
npm audit fix19f9a2f
Prepare 14.0.0 (#143)64d409b
Add eslint-plugin-regexp (#142)a0b173b
Update CI configuration (#144)3076e99
Update configuration for ESM (#133)c97d3ce
Bump jest from 27.0.6 to 27.1.0 (#140)2eb9937
Bump eslint-plugin-jest from 24.3.6 to 24.4.0 (#139)67c176b
Bump eslint from 7.29.0 to 7.32.0 (#138)46eb3d0
Bump jest from 27.0.3 to 27.0.6 (#137)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)