We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Discourse, we have a handful of property decorators like this:
// decorator-position ❌ class Blah { @tracked somePropertyName = this.some.long.property.which.extend.beyond.printWidth; }
Prettier breaks this onto two lines, and keeps the @tracked somePropertyName 'inline', which is great. We'd like to keep this formatting.
@tracked somePropertyName
Unfortunately the decorator-position eslint rule fails. It wants to move the decorator onto a line by itself, leaving us with this:
decorator-position
// decorator-position ✅ class Blah { @tracked somePropertyName = this.some.long.property.which.extend.beyond.printWidth; }
A similar problem can be demonstrated with ternary expressions:
// decorator-position ❌ class Blah { @tracked somePropertyName = this.someBoolean ? "resultIfTrue" : "thisIsTheValueIfFalse"; }
// decorator-position ✅ class Blah { @tracked somePropertyName = this.someBoolean ? "resultIfTrue" : "thisIsTheValueIfFalse"; }
Interestingly, multi-line function invocations seem to be accepted by the rule:
// decorator-position ✅ class Blah { @tracked somePropertyName = this.someFunction( "argumentValueOne", "argumentValueTwo" ); }
Would it be possible to have the decorator-position rule accept the two ❌ cases described above?
The text was updated successfully, but these errors were encountered:
Yeah, i think it's doable! Thanks for the code snippets!
Also, can you provide your prettier settings? Thanks!
Sorry, something went wrong.
Prettier config is here - we use the default lineWidth of 80.
lineWidth
Our eslint config has decorator-position configured with a matching lineWidth of 80
No branches or pull requests
In Discourse, we have a handful of property decorators like this:
Prettier breaks this onto two lines, and keeps the
@tracked somePropertyName
'inline', which is great. We'd like to keep this formatting.Unfortunately the
decorator-position
eslint rule fails. It wants to move the decorator onto a line by itself, leaving us with this:A similar problem can be demonstrated with ternary expressions:
Interestingly, multi-line function invocations seem to be accepted by the rule:
Would it be possible to have the
decorator-position
rule accept the two ❌ cases described above?The text was updated successfully, but these errors were encountered: