@prettier/plugin-pug
Advanced tools
Comparing version 1.7.0-sorting-feature.1 to 1.7.0
# Next | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.6.1...master) | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.7.0...master) | ||
# 1.7.0 | ||
[diff](https://github.com/prettier/plugin-pug/compare/1.6.1...1.7.0) | ||
- Support sorting of attributes with `pugSortAttributesBeginning` and `pugSortAttributesEnd` ([#22]) | ||
[Example](https://github.com/prettier/plugin-pug/issues/22#issuecomment-699509995) | ||
_This feature was planned since `1.2.0`, but it was always a bit unstable and opinionated._ | ||
_If there are any bugs, please report them._ | ||
- Pass more prettier code-interpolation options ([#117]) | ||
- Allow "none" as an option for attributeSeparator ([#102]) | ||
- Improve warning message ([03777f5]) | ||
[#22]: https://github.com/prettier/plugin-pug/issues/22 | ||
[#117]: https://github.com/prettier/plugin-pug/pull/117 | ||
[#102]: https://github.com/prettier/plugin-pug/issues/102 | ||
[03777f5]: https://github.com/prettier/plugin-pug/commit/03777f5a120f00ff93444f70dd26c8bb396f6f33 | ||
# 1.6.1 | ||
@@ -9,3 +26,3 @@ | ||
- Fix wrapped attribute multiline code indentation | ||
- Fix wrapped attribute multiline code indentation ([5a6082c]) | ||
@@ -12,0 +29,0 @@ [5a6082c]: https://github.com/prettier/plugin-pug/commit/5a6082ca126c292673779bc02817390b526b9a97 |
@@ -19,2 +19,6 @@ "use strict"; | ||
description: 'Only add commas between attributes where required. Example: `button(type="submit", (click)="play()" disabled)`' | ||
}, | ||
{ | ||
value: 'none', | ||
description: 'Never add commas between attributes. Example: `button(type="submit" @click="play()" :style="style" disabled)`' | ||
} | ||
@@ -39,2 +43,6 @@ ] | ||
description: 'Only add commas between attributes where required. Example: `button(type="submit", (click)="play()" disabled)`' | ||
}, | ||
{ | ||
value: 'none', | ||
description: 'Never add commas between attributes. Example: `button(type="submit" @click="play()" :style="style" disabled)`' | ||
} | ||
@@ -46,9 +54,9 @@ ] | ||
case 'always': | ||
return true; | ||
case 'as-needed': | ||
return false; | ||
case 'none': | ||
return attributeSeparator; | ||
} | ||
throw new Error(`Invalid option for pug attributeSeparator. Found '${attributeSeparator}'. Possible options: 'always' or 'as-needed'`); | ||
throw new Error(`Invalid option for pug attributeSeparator. Found '${attributeSeparator}'. Possible options: 'always', 'as-needed' or 'none'`); | ||
} | ||
exports.resolveAttributeSeparatorOption = resolveAttributeSeparatorOption; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0cmlidXRlLXNlcGFyYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vcHRpb25zL2F0dHJpYnV0ZS1zZXBhcmF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsd0JBQWlDO0FBRXBCLFFBQUEsMEJBQTBCLEdBQUc7SUFDekMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUsZUFBWTtJQUN0QixJQUFJLEVBQUUsUUFBUTtJQUNkLE9BQU8sRUFBRSxRQUFRO0lBQ2pCLFdBQVcsRUFBRSx5REFBeUQ7SUFDdEUsT0FBTyxFQUFFO1FBQ1I7WUFDQyxLQUFLLEVBQUUsUUFBUTtZQUNmLFdBQVcsRUFDVixzR0FBc0c7U0FDdkc7UUFDRDtZQUNDLEtBQUssRUFBRSxXQUFXO1lBQ2xCLFdBQVcsRUFDVixnSEFBZ0g7U0FDakg7S0FDRDtDQUNELENBQUM7QUFFVyxRQUFBLDhCQUE4QixHQUFHO0lBQzdDLEdBQUcsa0NBQTBCO0lBQzdCLEtBQUssRUFBRSxPQUFPO0lBQ2QsT0FBTyxFQUFFLElBQUk7SUFDYixPQUFPLEVBQUU7UUFDUjtZQUNDLEtBQUssRUFBRSxJQUFJO1lBQ1gsV0FBVyxFQUFFLGlDQUFpQztTQUM5QztRQUNEO1lBQ0MsS0FBSyxFQUFFLFFBQVE7WUFDZixXQUFXLEVBQ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NEO0NBQ0QsQ0FBQztBQUVXLFFBQUEsOEJBQThCLEdBQUc7SUFDN0MsR0FBRyxrQ0FBMEI7SUFDN0IsS0FBSyxFQUFFLE9BQU87SUFDZCxPQUFPLEVBQUUsSUFBSTtJQUNiLE9BQU8sRUFBRTtRQUNSO1lBQ0MsS0FBSyxFQUFFLElBQUk7WUFDWCxXQUFXLEVBQUUsaUNBQWlDO1NBQzlDO1FBQ0Q7WUFDQyxLQUFLLEVBQUUsUUFBUTtZQUNmLFdBQVcsRUFDVixzR0FBc0c7U0FDdkc7UUFDRDtZQUNDLEtBQUssRUFBRSxXQUFXO1lBQ2xCLFdBQVcsRUFDVixnSEFBZ0g7U0FDakg7UUFDRDtZQUNDLEtBQUssRUFBRSxNQUFNO1lBQ2IsV0FBVyxFQUNWLCtHQUErRztTQUNoSDtLQUNEO0NBQ0QsQ0FBQztBQUlGLFNBQWdCLCtCQUErQixDQUFDLGtCQUFzQztJQUNyRixRQUFRLGtCQUFrQixFQUFFO1FBQzNCLEtBQUssUUFBUSxDQUFDO1FBQ2QsS0FBSyxXQUFXLENBQUM7UUFDakIsS0FBSyxNQUFNO1lBQ1YsT0FBTyxrQkFBa0IsQ0FBQztLQUMzQjtJQUNELE1BQU0sSUFBSSxLQUFLLENBQ2QscURBQXFELGtCQUFrQixzREFBc0QsQ0FDN0gsQ0FBQztBQUNILENBQUM7QUFWRCwwRUFVQyJ9 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PUG_SEMI_OPTION = exports.PUG_BRACKET_SPACING_OPTION = exports.PUG_USE_TABS_OPTION = exports.PUG_TAB_WIDTH_OPTION = exports.PUG_SINGLE_QUOTE_OPTION = exports.PUG_PRINT_WIDTH_OPTION = void 0; | ||
exports.PUG_ARROW_PARENS_OPTION = exports.PUG_SEMI_OPTION = exports.PUG_BRACKET_SPACING_OPTION = exports.PUG_USE_TABS_OPTION = exports.PUG_TAB_WIDTH_OPTION = exports.PUG_SINGLE_QUOTE_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RDtZQUNDLEtBQUssRUFBRSxJQUFJO1lBQ1gsV0FBVyxFQUFFLGdDQUFnQztTQUM3QztRQUNEO1lBRUMsS0FBSyxFQUFFLE1BQU07WUFDYixXQUFXLEVBQUUsZ0NBQWdDO1NBQzdDO1FBQ0Q7WUFDQyxLQUFLLEVBQUUsS0FBSztZQUNaLFdBQVcsRUFBRSx1Q0FBdUM7U0FDcEQ7S0FDRDtDQUNELENBQUM7QUFFVyxRQUFBLGVBQWUsR0FBRztJQUM5QixLQUFLLEVBQUUsT0FBTztJQUNkLFFBQVEsRUFBRSxlQUFZO0lBQ3RCLElBQUksRUFBRSxRQUFRO0lBQ2QsT0FBTyxFQUFFLElBQUk7SUFDYixPQUFPLEVBQUU7UUFDUjtZQUNDLEtBQUssRUFBRSxJQUFJO1lBQ1gsV0FBVyxFQUFFLDZCQUE2QjtTQUMxQztRQUNEO1lBQ0MsS0FBSyxFQUFFLElBQUk7WUFDWCxXQUFXLEVBQUUsbUJBQW1CO1NBQ2hDO1FBQ0Q7WUFFQyxLQUFLLEVBQUUsTUFBTTtZQUNiLFdBQVcsRUFBRSxtQkFBbUI7U0FDaEM7UUFDRDtZQUNDLEtBQUssRUFBRSxLQUFLO1lBQ1osV0FBVyxFQUFFLGdGQUFnRjtTQUM3RjtLQUNEO0NBQ0QsQ0FBQyJ9 | ||
exports.PUG_ARROW_PARENS_OPTION = { | ||
since: '1.7.0', | ||
category: _1.CATEGORY_PUG, | ||
type: 'choice', | ||
default: null, | ||
description: 'Include parentheses around a sole arrow function parameter.', | ||
choices: [ | ||
{ | ||
value: null, | ||
description: 'Use `arrowParens` value.' | ||
}, | ||
{ | ||
value: 'always', | ||
description: 'Always add parens. Example: `(x) => x`' | ||
}, | ||
{ | ||
value: 'avoid', | ||
description: 'Omit parens when possible. Example: `x => x`' | ||
} | ||
] | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9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g, _h; | ||
return { | ||
@@ -18,7 +18,9 @@ printWidth: options.printWidth, | ||
pugBracketSpacing: (_c = options.pugBracketSpacing) !== null && _c !== void 0 ? _c : options.bracketSpacing, | ||
arrowParens: options.arrowParens, | ||
pugArrowParens: (_d = options.pugArrowParens) !== null && _d !== void 0 ? _d : options.arrowParens, | ||
semi: options.semi, | ||
pugSemi: (_d = options.pugSemi) !== null && _d !== void 0 ? _d : options.semi, | ||
attributeSeparator: (_e = options.pugAttributeSeparator) !== null && _e !== void 0 ? _e : options.attributeSeparator, | ||
closingBracketPosition: (_f = options.pugClosingBracketPosition) !== null && _f !== void 0 ? _f : options.closingBracketPosition, | ||
commentPreserveSpaces: (_g = options.pugCommentPreserveSpaces) !== null && _g !== void 0 ? _g : options.commentPreserveSpaces, | ||
pugSemi: (_e = options.pugSemi) !== null && _e !== void 0 ? _e : options.semi, | ||
attributeSeparator: (_f = options.pugAttributeSeparator) !== null && _f !== void 0 ? _f : options.attributeSeparator, | ||
closingBracketPosition: (_g = options.pugClosingBracketPosition) !== null && _g !== void 0 ? _g : options.closingBracketPosition, | ||
commentPreserveSpaces: (_h = options.pugCommentPreserveSpaces) !== null && _h !== void 0 ? _h : options.commentPreserveSpaces, | ||
pugSortAttributesBeginning: options.pugSortAttributesBeginning, | ||
@@ -29,2 +31,2 @@ pugSortAttributesEnd: options.pugSortAttributesEnd | ||
exports.convergeOptions = convergeOptions; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVyZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9jb252ZXJnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxTQUFnQixlQUFlLENBQUMsT0FBeUM7O0lBQ3hFLE9BQU87UUFDTixVQUFVLEVBQUUsT0FBTyxDQUFDLFVBQVU7UUFDOUIsYUFBYSxFQUFFLE9BQU8sQ0FB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PLENBQUMsV0FBVztRQUNoQyxjQUFjLFFBQUUsT0FBTyxDQUFDLGNBQWMsbUNBQUksT0FBTyxDQUFDLFdBQVc7UUFDN0QsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO1FBQ2xCLE9BQU8sUUFBRSxPQUFPLENBQUMsT0FBTyxtQ0FBSSxPQUFPLENBQUMsSUFBSTtRQUN4QyxrQkFBa0IsUUFBRSxPQUFPLENBQUMscUJBQXFCLG1DQUFJLE9BQU8sQ0FBQyxrQkFBa0I7UUFDL0Usc0JBQXNCLFFBQUUsT0FBTyxDQUFDLHlCQUF5QixtQ0FBSSxPQUFPLENBQUMsc0JBQXNCO1FBQzNGLHFCQUFxQixRQUFFLE9BQU8sQ0FBQyx3QkFBd0IsbUNBQUksT0FBTyxDQUFDLHFCQUFxQjtRQUN4RiwwQkFBMEIsRUFBRSxPQUFPLENBQUMsMEJBQTBCO1FBQzlELG9CQUFvQixFQUFFLE9BQU8sQ0FBQyxvQkFBb0I7S0FDbEQsQ0FBQztBQUNILENBQUM7QUF0QkQsMENBc0JDIn0= |
@@ -16,2 +16,3 @@ "use strict"; | ||
pugBracketSpacing: common_1.PUG_BRACKET_SPACING_OPTION, | ||
pugArrowParens: common_1.PUG_ARROW_PARENS_OPTION, | ||
pugSemi: common_1.PUG_SEMI_OPTION, | ||
@@ -27,2 +28,2 @@ attributeSeparator: attribute_separator_1.ATTRIBUTE_SEPARATOR_OPTION, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwrREFBdUg7QUFDdkgsMkRBQTJHO0FBQzNHLHlFQUlvQztBQUNwQyx1RUFJbUM7QUFDbkMscUNBT2tCO0FBRUwsUUFBQSxZQUFZLEdBQV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U8sRUFBRSx3QkFBZTtJQUN4QixrQkFBa0IsRUFBRSxnREFBMEI7SUFDOUMscUJBQXFCLEVBQUUsb0RBQThCO0lBQ3JELHNCQUFzQixFQUFFLDBEQUErQjtJQUN2RCx5QkFBeUIsRUFBRSw4REFBbUM7SUFDOUQscUJBQXFCLEVBQUUsd0RBQThCO0lBQ3JELHdCQUF3QixFQUFFLDREQUFrQztJQUM1RCwwQkFBMEIsRUFBRSx3REFBb0M7SUFDaEUsb0JBQW9CLEVBQUUsa0RBQThCO0NBQ3BELENBQUMifQ== |
{ | ||
"name": "@prettier/plugin-pug", | ||
"version": "1.7.0-sorting-feature.1", | ||
"version": "1.7.0", | ||
"description": "Prettier Pug Plugin", | ||
@@ -42,6 +42,6 @@ "main": "dist/index.js", | ||
"@types/prettier": "~2.1.1", | ||
"@typescript-eslint/eslint-plugin": "~4.2.0", | ||
"@typescript-eslint/parser": "~4.2.0", | ||
"@typescript-eslint/eslint-plugin": "~4.3.0", | ||
"@typescript-eslint/parser": "~4.3.0", | ||
"benchmark": "~2.1.4", | ||
"eslint": "~7.9.0", | ||
"eslint": "~7.10.0", | ||
"eslint-config-prettier": "~6.12.0", | ||
@@ -52,3 +52,3 @@ "eslint-plugin-prettier": "~3.1.4", | ||
"prettier": "2.1.2", | ||
"ts-jest": "~26.4.0", | ||
"ts-jest": "~26.4.1", | ||
"typescript": "~4.0.3" | ||
@@ -55,0 +55,0 @@ }, |
@@ -157,2 +157,5 @@ <p align="center"> | ||
Example: `button(type="submit", (click)="play()" disabled)` | ||
- `'none'` -> Never add commas between attributes. | ||
Example: `button(type="submit" @click="play()" :style="style" disabled)` | ||
Please note that while this option will process Angular syntax (e.g. `(click)="play()"`), the resulting pug file will throw a syntax error when parsed: `Syntax Error: Assigning to rvalue` | ||
@@ -201,2 +204,8 @@ - `closingBracketPosition` | ||
- `pugSortAttributesBeginning` (and `pugSortAttributesEnd`) | ||
Sort attributes by regex patterns to the beginning or the end. | ||
[Example](https://github.com/prettier/plugin-pug/issues/22#issuecomment-699509995) | ||
_This feature was planned since `1.2.0`, but it was always a bit unstable and opinionated._ | ||
_If there are any bugs, please report them._ | ||
The definitions for these options can be found in [src/options/index.ts](https://github.com/prettier/plugin-pug/blob/master/src/options/index.ts) | ||
@@ -240,2 +249,7 @@ | ||
[Issue 114](https://github.com/prettier/plugin-pug/issues/114) | ||
If you have tags at the top/root that are indented, they will lose indentation due to a technical limitation of pug. | ||
Please check these before committing after running this plugin for the first time and fix them manually. | ||
## Integration with editors | ||
@@ -242,0 +256,0 @@ |
@@ -19,2 +19,7 @@ import { CATEGORY_PUG } from '.'; | ||
'Only add commas between attributes where required. Example: `button(type="submit", (click)="play()" disabled)`' | ||
}, | ||
{ | ||
value: 'none', | ||
description: | ||
'Never add commas between attributes. Example: `button(type="submit" @click="play()" :style="style" disabled)`' | ||
} | ||
@@ -42,2 +47,7 @@ ] | ||
'Only add commas between attributes where required. Example: `button(type="submit", (click)="play()" disabled)`' | ||
}, | ||
{ | ||
value: 'none', | ||
description: | ||
'Never add commas between attributes. Example: `button(type="submit" @click="play()" :style="style" disabled)`' | ||
} | ||
@@ -47,14 +57,14 @@ ] | ||
export type AttributeSeparator = 'always' | 'as-needed'; | ||
export type AttributeSeparator = 'always' | 'as-needed' | 'none'; | ||
export function resolveAttributeSeparatorOption(attributeSeparator: AttributeSeparator): boolean { | ||
export function resolveAttributeSeparatorOption(attributeSeparator: AttributeSeparator): AttributeSeparator { | ||
switch (attributeSeparator) { | ||
case 'always': | ||
return true; | ||
case 'as-needed': | ||
return false; | ||
case 'none': | ||
return attributeSeparator; | ||
} | ||
throw new Error( | ||
`Invalid option for pug attributeSeparator. Found '${attributeSeparator}'. Possible options: 'always' or 'as-needed'` | ||
`Invalid option for pug attributeSeparator. Found '${attributeSeparator}'. Possible options: 'always', 'as-needed' or 'none'` | ||
); | ||
} |
@@ -124,1 +124,25 @@ import { CATEGORY_PUG } from '.'; | ||
}; | ||
export const PUG_ARROW_PARENS_OPTION = { | ||
since: '1.7.0', | ||
category: CATEGORY_PUG, | ||
type: 'choice', | ||
default: null, | ||
description: 'Include parentheses around a sole arrow function parameter.', | ||
choices: [ | ||
{ | ||
value: null, | ||
description: 'Use `arrowParens` value.' | ||
}, | ||
{ | ||
value: 'always', | ||
description: 'Always add parens. Example: `(x) => x`' | ||
}, | ||
{ | ||
value: 'avoid', | ||
description: 'Omit parens when possible. Example: `x => x`' | ||
} | ||
] | ||
}; | ||
export type ArrowParens = 'avoid' | 'always'; |
@@ -17,2 +17,4 @@ import { ParserOptions } from 'prettier'; | ||
pugBracketSpacing: options.pugBracketSpacing ?? options.bracketSpacing, | ||
arrowParens: options.arrowParens, | ||
pugArrowParens: options.pugArrowParens ?? options.arrowParens, | ||
semi: options.semi, | ||
@@ -19,0 +21,0 @@ pugSemi: options.pugSemi ?? options.semi, |
@@ -15,2 +15,4 @@ import { ParserOptions } from 'prettier'; | ||
import { | ||
ArrowParens, | ||
PUG_ARROW_PARENS_OPTION, | ||
PUG_BRACKET_SPACING_OPTION, | ||
@@ -27,3 +29,8 @@ PUG_PRINT_WIDTH_OPTION, | ||
export interface PugParserOptions | ||
extends Pick<ParserOptions, 'printWidth' | 'singleQuote' | 'tabWidth' | 'useTabs' | 'bracketSpacing' | 'semi'> { | ||
/* eslint-disable @typescript-eslint/indent */ | ||
extends Pick< | ||
ParserOptions, | ||
'printWidth' | 'singleQuote' | 'tabWidth' | 'useTabs' | 'bracketSpacing' | 'arrowParens' | 'semi' | ||
> { | ||
/* eslint-enable @typescript-eslint/indent */ | ||
pugPrintWidth: number; | ||
@@ -34,2 +41,3 @@ pugSingleQuote: boolean | null; | ||
pugBracketSpacing: boolean | null; | ||
pugArrowParens: ArrowParens | null; | ||
pugSemi: boolean | null; | ||
@@ -56,2 +64,3 @@ | ||
pugBracketSpacing: PUG_BRACKET_SPACING_OPTION, | ||
pugArrowParens: PUG_ARROW_PARENS_OPTION, | ||
pugSemi: PUG_SEMI_OPTION, | ||
@@ -58,0 +67,0 @@ attributeSeparator: ATTRIBUTE_SEPARATOR_OPTION, |
@@ -56,2 +56,3 @@ import { format, RequiredOptions } from 'prettier'; | ||
import { CommentPreserveSpaces, formatCommentPreserveSpaces } from './options/comment-preserve-spaces'; | ||
import { ArrowParens } from './options/common'; | ||
import { isAngularAction, isAngularBinding, isAngularDirective, isAngularInterpolation } from './utils/angular'; | ||
@@ -84,2 +85,4 @@ import { | ||
readonly pugBracketSpacing: boolean; | ||
readonly arrowParens: ArrowParens; | ||
readonly pugArrowParens: ArrowParens; | ||
readonly semi: boolean; | ||
@@ -111,4 +114,10 @@ readonly pugSemi: boolean; | ||
private readonly alwaysUseAttributeSeparator: boolean; | ||
private readonly neverUseAttributeSeparator: boolean; | ||
private readonly closingBracketRemainsAtNewLine: boolean; | ||
private readonly codeInterpolationOptions: Pick<RequiredOptions, 'singleQuote' | 'printWidth' | 'endOfLine'>; | ||
/* eslint-disable @typescript-eslint/indent */ | ||
private readonly codeInterpolationOptions: Pick< | ||
RequiredOptions, | ||
'singleQuote' | 'bracketSpacing' | 'arrowParens' | 'printWidth' | 'endOfLine' | ||
>; | ||
/* eslint-enable @typescript-eslint/indent */ | ||
@@ -128,3 +137,5 @@ private possibleIdPosition: number = 0; | ||
this.otherQuotes = this.options.pugSingleQuote ? '"' : "'"; | ||
this.alwaysUseAttributeSeparator = resolveAttributeSeparatorOption(options.attributeSeparator); | ||
const attributeSeparator = resolveAttributeSeparatorOption(options.attributeSeparator); | ||
this.alwaysUseAttributeSeparator = attributeSeparator === 'always'; | ||
this.neverUseAttributeSeparator = attributeSeparator === 'none'; | ||
this.closingBracketRemainsAtNewLine = resolveClosingBracketPositionOption(options.closingBracketPosition); | ||
@@ -134,2 +145,4 @@ const codeSingleQuote = !options.pugSingleQuote; | ||
singleQuote: codeSingleQuote, | ||
bracketSpacing: options.pugBracketSpacing ?? options.bracketSpacing, | ||
arrowParens: options.pugArrowParens ?? options.arrowParens, | ||
printWidth: 9000, | ||
@@ -565,3 +578,6 @@ endOfLine: 'lf' | ||
if (this.previousToken?.type === 'attribute' && (!this.previousAttributeRemapped || hasNormalPreviousToken)) { | ||
if (this.alwaysUseAttributeSeparator || /^(\(|\[|:).*/.test(token.name)) { | ||
if ( | ||
!this.neverUseAttributeSeparator && | ||
(this.alwaysUseAttributeSeparator || /^(\(|\[|:).*/.test(token.name)) | ||
) { | ||
this.result += ','; | ||
@@ -568,0 +584,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
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
226702
3883
1
292