Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Commit c68b42d

Browse files
committed
Add explaining comment for \s in isStylelintComment regex
1 parent a163452 commit c68b42d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/general.js

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ const isEmptyOrSpaceOnly = text => {
6868
const wrapSelector = content => `.selector${(count += 1)} {${content}}\n`
6969
const wrapKeyframes = content => `@keyframes {${content}}\n`
7070

71+
/**
72+
* The reason we put a \s before .* in the last part of the regex is to make sure we don't
73+
* match stylelint-disable-line and stylelint-disable-next-line or, for now, any future extensions
74+
* as these line specific disables should not be placed outside a css TTL
75+
*/
7176
const isStylelintComment = comment => /^\s*stylelint-(?:enable|disable)(?:\s.*)?$/.test(comment)
7277

7378
exports.wrapKeyframes = wrapKeyframes

0 commit comments

Comments
 (0)