@prettier/plugin-pug
Advanced tools
Comparing version 1.9.0 to 1.10.0
# Next | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.9.0...master) | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.10.0...master) | ||
# 1.10.0 | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.9.0...1.10.0) | ||
- Implement `pugEmptyAttributes` and `pugEmptyAttributesForceQuotes` option ([#128]) | ||
- Improve warning message ([#143], [c0319bf]) | ||
[#128]: https://github.com/prettier/plugin-pug/issues/128 | ||
[#143]: https://github.com/prettier/plugin-pug/issues/143 | ||
[c0319bf]: https://github.com/prettier/plugin-pug/commit/c0319bf5220ac2aa5ecbc82a473552f76c07009d | ||
# 1.9.0 | ||
@@ -6,0 +17,0 @@ |
@@ -29,2 +29,4 @@ "use strict"; | ||
pugWrapAttributesPattern: options.pugWrapAttributesPattern, | ||
pugEmptyAttributes: options.pugEmptyAttributes, | ||
pugEmptyAttributesForceQuotes: options.pugEmptyAttributesForceQuotes, | ||
pugSingleFileComponentIndentation: options.pugSingleFileComponentIndentation && options.embeddedInHtml | ||
@@ -34,2 +36,2 @@ }; | ||
exports.convergeOptions = convergeOptions; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVyZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9jb252ZXJnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFTQSxTQUFnQixlQUFlLENBQUMsT0FBeUM7O0lBQ3hFLE9BQU87UUFDTixVQUFVLEVBQUUsT0FBTyxDQUFDLFVBQVU7UUFDOUIsYUFBYSxFQUFFLE9BQU8sQ0FBQyxhQUFhLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxVQUFVO1FBQ3hGLFdBQV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0RyxDQUFDO0FBQ0gsQ0FBQztBQTVCRCwwQ0E0QkMifQ== |
@@ -9,2 +9,3 @@ "use strict"; | ||
const common_1 = require("./common"); | ||
const empty_attributes_1 = require("./empty-attributes"); | ||
const pug_single_file_component_indentation_1 = require("./pug-single-file-component-indentation"); | ||
@@ -32,4 +33,6 @@ const wrap_attributes_1 = require("./wrap-attributes"); | ||
pugWrapAttributesPattern: wrap_attributes_1.WRAP_ATTRIBUTES_PATTERN, | ||
pugEmptyAttributes: empty_attributes_1.PUG_EMPTY_ATTRIBUTES_OPTION, | ||
pugEmptyAttributesForceQuotes: empty_attributes_1.PUG_EMPTY_ATTRIBUTES_FORCE_QUOTES_OPTION, | ||
pugSingleFileComponentIndentation: pug_single_file_component_indentation_1.PUG_SINGLE_FILE_COMPONENT_INDENTATION | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwrREFBdUg7QUFDdkgsMkRBSzZCO0FBQzdCLHlFQUlvQztBQUNwQyx1RUFJbUM7QUFDbkMscUNBU2tCO0FBQ2xCLG1HQUFnRztBQUNoRyx1REFBdUY7QUFLMUUsUUFBQSxZQUFZLEdBQVcsS0FBSyxDQUFDO0FBdUM3QixRQUFBLE9BQU8sR0FBbUI7SUFDdEMsYUFBYSxFQUFFLCtCQUFzQjtJQUNyQyxjQUFjLEVBQUUsZ0NBQXVCO0lBQ3ZDLFdBQVcsRUFBRSw2QkFBb0I7SUFDakMsVUFBVSxFQUFFLDRCQUFtQjtJQUMvQixpQkFBaUIsRUFBRSxtQ0FBMEI7SUFDN0MsY0FBYyxFQUFFLGdDQUF1QjtJQUN2QyxPQUFPLEVBQUUsd0JBQWU7SUFDeEIsa0JBQWtCLEVBQUUsZ0R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UFBRSxvREFBOEI7SUFDckQsc0JBQXNCLEVBQUUsMERBQStCO0lBQ3ZELHlCQUF5QixFQUFFLDhEQUFtQztJQUM5RCxxQkFBcUIsRUFBRSx3REFBOEI7SUFDckQsd0JBQXdCLEVBQUUsNERBQWtDO0lBQzVELGlCQUFpQixFQUFFLDhDQUEwQjtJQUM3QywwQkFBMEIsRUFBRSx3REFBb0M7SUFDaEUsb0JBQW9CLEVBQUUsa0RBQThCO0lBQ3BELDBCQUEwQixFQUFFLDJDQUF5QjtJQUNyRCx3QkFBd0IsRUFBRSx5Q0FBdUI7SUFDakQsa0JBQWtCLEVBQUUsOENBQTJCO0lBQy9DLDZCQUE2QixFQUFFLDJEQUF3QztJQUN2RSxpQ0FBaUMsRUFBRSw2RUFBcUM7Q0FDeEUsQ0FBQyJ9 |
{ | ||
"name": "@prettier/plugin-pug", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "Prettier Pug Plugin", | ||
@@ -39,12 +39,12 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "~26.0.14", | ||
"@types/node": "~14.11.10", | ||
"@types/jest": "~26.0.15", | ||
"@types/node": "~14.14.2", | ||
"@types/prettier": "~2.1.5", | ||
"@typescript-eslint/eslint-plugin": "~4.4.1", | ||
"@typescript-eslint/parser": "~4.4.1", | ||
"@typescript-eslint/eslint-plugin": "~4.5.0", | ||
"@typescript-eslint/parser": "~4.5.0", | ||
"benchmark": "~2.1.4", | ||
"eslint": "~7.11.0", | ||
"eslint-config-prettier": "~6.13.0", | ||
"eslint-config-prettier": "~6.14.0", | ||
"eslint-plugin-prettier": "~3.1.4", | ||
"jest": "~26.5.3", | ||
"jest": "~26.6.1", | ||
"jest-junit": "~12.0.0", | ||
@@ -51,0 +51,0 @@ "prettier": "2.1.2", |
@@ -245,2 +245,17 @@ <p align="center"> | ||
- `pugEmptyAttributes` | ||
Change behavior of boolean attributes. | ||
Choices: | ||
- `'as-is'` _default_ -> Nothing is changed. | ||
Example: `foo(a, b="", c)` | ||
- `'none'` -> Every attribute with empty quotes will have them removed. | ||
Example: `foo(a, b, c)` | ||
- `'all'` -> Every boolean attribute will be expressed with empty quotes. | ||
Example: `foo(a="", b="", c="")` | ||
- `pugEmptyAttributesForceQuotes` | ||
Define a list of patterns for attributes that will be forced to have empty quotes even with "none" selected. | ||
## Some workarounds | ||
@@ -247,0 +262,0 @@ |
@@ -34,4 +34,6 @@ import { ParserOptions } from 'prettier'; | ||
pugWrapAttributesPattern: options.pugWrapAttributesPattern, | ||
pugEmptyAttributes: options.pugEmptyAttributes, | ||
pugEmptyAttributesForceQuotes: options.pugEmptyAttributesForceQuotes, | ||
pugSingleFileComponentIndentation: options.pugSingleFileComponentIndentation && options.embeddedInHtml | ||
}; | ||
} |
@@ -29,2 +29,8 @@ import { ParserOptions, SupportOptions } from 'prettier'; | ||
} from './common'; | ||
import { | ||
PugEmptyAttributes, | ||
PugEmptyAttributesForceQuotes, | ||
PUG_EMPTY_ATTRIBUTES_FORCE_QUOTES_OPTION, | ||
PUG_EMPTY_ATTRIBUTES_OPTION | ||
} from './empty-attributes'; | ||
import { PUG_SINGLE_FILE_COMPONENT_INDENTATION } from './pug-single-file-component-indentation'; | ||
@@ -72,2 +78,5 @@ import { WRAP_ATTRIBUTES_PATTERN, WRAP_ATTRIBUTES_THRESHOLD } from './wrap-attributes'; | ||
pugEmptyAttributes: PugEmptyAttributes; | ||
pugEmptyAttributesForceQuotes: PugEmptyAttributesForceQuotes; | ||
pugSingleFileComponentIndentation: boolean; | ||
@@ -95,3 +104,5 @@ } | ||
pugWrapAttributesPattern: WRAP_ATTRIBUTES_PATTERN, | ||
pugEmptyAttributes: PUG_EMPTY_ATTRIBUTES_OPTION, | ||
pugEmptyAttributesForceQuotes: PUG_EMPTY_ATTRIBUTES_FORCE_QUOTES_OPTION, | ||
pugSingleFileComponentIndentation: PUG_SINGLE_FILE_COMPONENT_INDENTATION | ||
}; |
@@ -58,2 +58,4 @@ import { format, RequiredOptions } from 'prettier'; | ||
import { ArrowParens } from './options/common'; | ||
import { PugEmptyAttributes, PugEmptyAttributesForceQuotes } from './options/empty-attributes'; | ||
import { formatEmptyAttribute } from './options/empty-attributes/utils'; | ||
import { isAngularAction, isAngularBinding, isAngularDirective, isAngularInterpolation } from './utils/angular'; | ||
@@ -98,2 +100,4 @@ import { | ||
readonly pugWrapAttributesPattern: string; | ||
readonly pugEmptyAttributes: PugEmptyAttributes; | ||
readonly pugEmptyAttributesForceQuotes: PugEmptyAttributesForceQuotes; | ||
readonly pugSingleFileComponentIndentation: boolean; | ||
@@ -350,8 +354,14 @@ } | ||
'[PugPrinter:formatText]: Bindings should not contain assignments:', | ||
code.trim() | ||
`code: \`${code.trim()}\`` | ||
); | ||
} else if (error.includes("Unexpected token '('")) { | ||
logger.warn( | ||
"[PugPrinter:formatText]: Found unexpected token '('. If you are using Vue, you can ignore this message." | ||
"[PugPrinter:formatText]: Found unexpected token '('. If you are using Vue, you can ignore this message.", | ||
`code: \`${code.trim()}\`` | ||
); | ||
} else if (error.includes('Missing expected )')) { | ||
logger.warn( | ||
'[PugPrinter:formatText]: Missing expected ). If you are using Vue, you can ignore this message.', | ||
`code: \`${code.trim()}\`` | ||
); | ||
} else { | ||
@@ -569,2 +579,4 @@ logger.warn('[PugPrinter:formatText]: ', error); | ||
private attribute(token: AttributeToken): void { | ||
formatEmptyAttribute(token, this.options.pugEmptyAttributes, this.options.pugEmptyAttributesForceQuotes); | ||
if (typeof token.val === 'string') { | ||
@@ -571,0 +583,0 @@ if (isQuoted(token.val)) { |
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
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
262756
44
4399
343