Closed publicJorn closed 1 year ago
I'd need your node version and prettier version to debug this 👍
Can you check whether you get the same error with this repository: https://github.com/NiklasPor/organize-attributes-test With this dependencies it should work with a not outdated version of node
I have the same issue
@splincode would you mind giving me:
*.html
config
module.exports = {
$schema: 'https://json.schemastore.org/prettierrc',
htmlWhitespaceSensitivity: 'ignore',
printWidth: 120,
tabWidth: 4,
proseWrap: 'always',
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'all',
endOfLine: 'lf',
bracketSpacing: false,
singleAttributePerLine: true,
arrowParens: 'avoid',
plugins: [
// https://github.com/prettier/prettier-vscode/issues/2259#issuecomment-952950119
require.resolve('prettier-plugin-organize-attributes'),
require.resolve('@prettier/plugin-xml'),
],
attributeGroups: [
// prettier-plugin-organize-attribute
'$ANGULAR_STRUCTURAL_DIRECTIVE',
'$ANGULAR_ELEMENT_REF',
'$ID',
'$DEFAULT',
'$CLASS',
'$ANGULAR_ANIMATION',
'$ANGULAR_ANIMATION_INPUT',
'$ANGULAR_INPUT',
'$ANGULAR_TWO_WAY_BINDING',
'$ANGULAR_OUTPUT',
],
overrides: [
{
files: ['*.json', '.prettierrc', '.stylelintrc'],
options: {parser: 'json'},
},
{
files: ['*.less'],
options: {parser: 'less'},
},
{
files: ['*.scss'],
options: {parser: 'scss'},
},
{
files: ['*.component.html', '*.template.html'],
options: {parser: 'angular'},
},
{
files: ['*.xml'],
options: {parser: 'xml'},
},
{
files: ['*.yml', '*.yaml'],
options: {parser: 'yaml', tabWidth: 2},
},
{
files: ['*.md'],
options: {parser: 'markdown', tabWidth: 2},
},
{
files: ['*.js', '*.ts'],
options: {printWidth: 90, parser: 'typescript'},
},
{
files: ['*.html'],
options: {printWidth: 120, parser: 'angular'},
},
{
files: ['*.svg'],
options: {printWidth: 200, parser: 'svg'},
},
],
};
The newest major version of this plugin only support prettier V3. Please try it with an older major version
Oh, thank you
Thanks for your quick reply @NiklasPor! I was on the road for a few days.
It seems for me it was the same issue. Already had a prettier@2 installed. Cheers!
It is in the package.json ofcourse. Don't know if it's possible, but maybe a better error is possible? Don't know if you want to go there...
This plugin looks interesting. But I can't get it to use in it's basic form however. Am I doing something wrong?
I'm using VSCode and I've setup prettier to format on save. With the below configuration I'm getting error:
.prettierrc
Even when I do provide
attributeGroups
as documented I get this error. Eg:It looks like it breaks on https://github.com/NiklasPor/prettier-plugin-organize-attributes/blob/50a0c4f8809c34b351a400011b7734701285b5e9/src/index.ts#L67C33-L67C33