@prettier/plugin-pug
Advanced tools
Comparing version 1.16.0 to 1.16.1-0
# Next | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.16.0...main) | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.16.1...main) | ||
# 1.16.1 | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.16.0...1.16.1) | ||
- Prevent wrong quotation ([#255]) | ||
[#255]: https://github.com/prettier/plugin-pug/issues/255 | ||
# 1.16.0 | ||
@@ -6,0 +14,0 @@ |
{ | ||
"name": "@prettier/plugin-pug", | ||
"version": "1.16.0", | ||
"version": "1.16.1-0", | ||
"description": "Prettier Pug Plugin", | ||
@@ -43,4 +43,4 @@ "main": "dist/index.js", | ||
"@types/jest": "~26.0.24", | ||
"@types/node": "~16.0.0", | ||
"@types/prettier": "~2.3.1", | ||
"@types/node": "~16.3.1", | ||
"@types/prettier": "~2.3.2", | ||
"@typescript-eslint/eslint-plugin": "~4.28.2", | ||
@@ -53,3 +53,3 @@ "@typescript-eslint/parser": "~4.28.2", | ||
"eslint-plugin-inclusive-language": "~2.1.1", | ||
"eslint-plugin-jsdoc": "~35.4.1", | ||
"eslint-plugin-jsdoc": "~35.4.3", | ||
"eslint-plugin-prettier": "~3.4.0", | ||
@@ -56,0 +56,0 @@ "eslint-plugin-spellcheck": "~0.0.19", |
@@ -919,27 +919,31 @@ import type { BuiltInParserName, Options, RequiredOptions } from 'prettier'; | ||
val = this.formatStyleAttribute(val); | ||
} else if (isQuoted(val)) { | ||
val = makeString(val.slice(1, -1), this.quotes); | ||
} else if (val === 'true') { | ||
// The value is exactly true and is not quoted | ||
return; | ||
} else if (token.mustEscape) { | ||
val = format(val, { parser: '__js_expression', ...this.codeInterpolationOptions }); | ||
} else { | ||
// Prevent wrong quotation if there is an extra whitespace at the end | ||
const rightTrimmedVal: string = val.trimRight(); | ||
if (isQuoted(rightTrimmedVal)) { | ||
val = makeString(rightTrimmedVal.slice(1, -1), this.quotes); | ||
} else if (val === 'true') { | ||
// The value is exactly true and is not quoted | ||
return; | ||
} else if (token.mustEscape) { | ||
val = format(val, { parser: '__js_expression', ...this.codeInterpolationOptions }); | ||
const lines: string[] = val.split('\n'); | ||
const codeIndentLevel: number = this.wrapAttributes ? this.indentLevel + 1 : this.indentLevel; | ||
if (lines.length > 1) { | ||
val = lines[0] ?? ''; | ||
for (let index: number = 1; index < lines.length; index++) { | ||
val += '\n'; | ||
val += this.indentString.repeat(codeIndentLevel); | ||
val += lines[index]; | ||
const lines: string[] = val.split('\n'); | ||
const codeIndentLevel: number = this.wrapAttributes ? this.indentLevel + 1 : this.indentLevel; | ||
if (lines.length > 1) { | ||
val = lines[0] ?? ''; | ||
for (let index: number = 1; index < lines.length; index++) { | ||
val += '\n'; | ||
val += this.indentString.repeat(codeIndentLevel); | ||
val += lines[index]; | ||
} | ||
} | ||
} else { | ||
// The value is not quoted and may be js-code | ||
val = val.trim(); | ||
val = val.replace(/\s\s+/g, ' '); | ||
if (val[0] === '{' && val[1] === ' ') { | ||
val = `{${val.slice(2, val.length)}`; | ||
} | ||
} | ||
} else { | ||
// The value is not quoted and may be js-code | ||
val = val.trim(); | ||
val = val.replace(/\s\s+/g, ' '); | ||
if (val[0] === '{' && val[1] === ' ') { | ||
val = `{${val.slice(2, val.length)}`; | ||
} | ||
} | ||
@@ -946,0 +950,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
328807
5508
2