Skip to content

Commit aa5fbbb

Browse files
committed
config(lint): stricter eslint configuration
and several newly-found unneeded regex escapes.
1 parent 0700f97 commit aa5fbbb

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.eslintrc

-7
This file was deleted.

.eslintrc.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"extends": "eslint:recommended",
9+
"parserOptions": {
10+
"ecmaVersion": 2018
11+
}
12+
}

lib/parseValues.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ var parser = new Parser({
136136
"url\\((\\s*)(\"(?:[^\\\\\"]|\\\\.)*\")(\\s*)\\)": urlMatch,
137137
"url\\((\\s*)('(?:[^\\\\']|\\\\.)*')(\\s*)\\)": urlMatch,
138138
"url\\((\\s*)((?:[^\\\\)'\"]|\\\\.)*)(\\s*)\\)": urlMatch,
139-
"([\\w\-]+)\\((\\s*)": nestedItemMatch,
139+
"([\\w-]+)\\((\\s*)": nestedItemMatch,
140140
"(\\s*)(\\))": nestedItemEndMatch,
141141
",(\\s*)": commaMatch,
142142
"\\s+$": endSpacingMatch,
143143
"\\s+": spacingMatch,
144-
"[^\\s,\)]+": itemMatch
144+
"[^\\s,)]+": itemMatch
145145
}
146146
});
147147

lib/stringify.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function escape(str, identifier) {
1313
if (identifier) {
1414
return str.replace(identifierEscapeRegexp, "\\$1");
1515
} else {
16-
return str.replace(/(^[^A-Za-z_\\-]|^\-\-|[^A-Za-z_0-9\\-])/g, "\\$1");
16+
return str.replace(/(^[^A-Za-z_\\-]|^--|[^A-Za-z_0-9\\-])/g, "\\$1");
1717
}
1818
}
1919

@@ -60,6 +60,6 @@ function stringify(tree) {
6060
str = str + tree.after;
6161
}
6262
return str;
63-
};
63+
}
6464

6565
module.exports = stringify;

0 commit comments

Comments
 (0)