Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Nov 12, 2023
1 parent 7284f8a commit 25a6e69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/language-css/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function clean(ast, newObj, parent) {
newObj.value
) {
newObj.value = newObj.value.replaceAll(
/([\d+.Ee-]+)([A-Za-z]*)/g,
/([\d+.e-]+)([a-z]*)/gi,
(match, numStr, unit) => {
const num = Number(numStr);
return Number.isNaN(num) ? match : num + unit.toLowerCase();
Expand Down Expand Up @@ -208,7 +208,7 @@ function clean(ast, newObj, parent) {
clean.ignoredProperties = ignoredProperties;

function cleanCSSStrings(value) {
return value.replaceAll("'", '"').replaceAll(/\\([^\dA-Fa-f])/g, "$1");
return value.replaceAll("'", '"').replaceAll(/\\([^\da-f])/gi, "$1");
}

export default clean;
9 changes: 5 additions & 4 deletions src/language-css/print/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ function printUnit(unit) {
}

const STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
const STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
const WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:e[+-]?\d+)?/gi;
const STANDARD_UNIT_REGEX = /[a-z]+/gi;
const WORD_PART_REGEX = /[$@]?[_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/gi;
const ADJUST_NUMBERS_REGEX = new RegExp(
STRING_REGEX.source +
"|" +
// eslint-disable-next-line regexp/no-misleading-capturing-group
`(${WORD_PART_REGEX.source})?` +
`(${NUMBER_REGEX.source})` +
`(${STANDARD_UNIT_REGEX.source})?`,
"g",
"gi",
);

function adjustStrings(value, options) {
Expand Down
2 changes: 1 addition & 1 deletion src/language-html/constants.evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getCssStyleTags = (property) =>
}

const tagNames = selectors.filter((selector) =>
/^[\dA-Za-z]+$/.test(selector),
/^[\da-z]+$/i.test(selector),
);

return tagNames.map((tagName) => [tagName, style.value]);
Expand Down
2 changes: 1 addition & 1 deletion src/language-html/embed/vue-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function isVueEventBindingExpression(eventBindingValue) {
const fnExpRE = /^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/;
// simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
const simplePathRE =
/^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
/^[$_a-z][\w$]*(?:\.[$_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$_a-z][\w$]*])*$/i;

// https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
const value = eventBindingValue.trim();
Expand Down

0 comments on commit 25a6e69

Please sign in to comment.