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
Changes from 10 commits
8d90796
a3f280e
1ddb5a2
a08087b
2a5df2b
236cfa9
eef37f3
d31be21
ea7cc13
5377589
0300f01
53053c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/optimal-quantifier-concatenation - |
||
decl.raws.between = betweenBefore + betweenAfter.replace(/^[^\S\r\n]*/, ''); | ||
} else { | ||
decl.raws.between = betweenBefore + context.newline + betweenAfter; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/strict |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,13 +303,13 @@ const rule = (primary, secondaryOptions = {}, context) => { | |
parentheticalDepth += 1; | ||
} | ||
|
||
const followsOpeningBrace = /{[ \t]*$/.test(source.slice(0, newlineIndex)); | ||
const followsOpeningBrace = /\{[ \t]*$/.test(source.slice(0, newlineIndex)); | ||
|
||
if (followsOpeningBrace) { | ||
parentheticalDepth += 1; | ||
} | ||
|
||
const startingClosingBrace = /^[ \t]*}/.test(source.slice(match.startIndex + 1)); | ||
const startingClosingBrace = /^[ \t]*\}/.test(source.slice(match.startIndex + 1)); | ||
|
||
if (startingClosingBrace) { | ||
parentheticalDepth -= 1; | ||
|
@@ -607,8 +607,10 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { | |
let source = root.source.input.css; | ||
|
||
source = source.replace(/^[^\r\n]+/, (firstLine) => { | ||
if (/(?:^|\n)([ \t]*)$/.test(root.raws.beforeStart)) { | ||
return RegExp.$1 + firstLine; | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/no-legacy-features - |
||
} | ||
|
||
return ''; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/no-useless-flag - |
||
? str.replace(/(\r\n)+/g, ($1) => { | ||
if ($1.length / 2 > repeatTimes) { | ||
return emptyCRLFLines; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
index += execResult[1].length; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/no-super-linear-backtracking - |
||
|
||
// match[1] is any numbers between the decimal and our trailing zero, could be empty | ||
// match[2] is our trailing zero(s) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const validateOptions = require('../../utils/validateOptions'); | |
const valueParser = require('postcss-value-parser'); | ||
|
||
const ruleName = 'string-no-newline'; | ||
const reNewLine = /(\r?\n)/; | ||
const reNewLine = /\r?\n/; | ||
|
||
const messages = ruleMessages(ruleName, { | ||
rejected: 'Unexpected newline in string', | ||
|
@@ -52,7 +52,9 @@ function rule(actual) { | |
|
||
parseSelector(ruleNode.selector, result, ruleNode, (selectorTree) => { | ||
selectorTree.walkAttributes((attributeNode) => { | ||
if (!reNewLine.test(attributeNode.value)) { | ||
const match = reNewLine.exec(attributeNode.value); | ||
|
||
if (!match) { | ||
return; | ||
} | ||
|
||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
].reduce( | ||
(index, str) => index + str.length, | ||
// index of the start of our attribute node in our source | ||
|
@@ -88,15 +90,21 @@ function rule(actual) { | |
} | ||
|
||
valueParser(value).walk((valueNode) => { | ||
if (valueNode.type !== 'string' || !reNewLine.test(valueNode.value)) { | ||
if (valueNode.type !== 'string') { | ||
return; | ||
} | ||
|
||
const match = reNewLine.exec(valueNode.value); | ||
|
||
if (!match) { | ||
return; | ||
} | ||
|
||
const openIndex = [ | ||
// length of the quote | ||
valueNode.quote, | ||
// length of the contents before newline | ||
RegExp.leftContext, | ||
match.input.slice(0, match.index), | ||
].reduce((index, str) => index + str.length, valueNode.sourceIndex); | ||
|
||
report({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return false; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. See regexp/no-obscure-range and regexp/no-dupe-characters-character-class - |
||
return false; | ||
} | ||
|
||
|
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.