Skip to content
New issue

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

Add autofixer to block-indentation rule #2281

Conversation

VincentMolinie
Copy link
Contributor

No description provided.

@bmish bmish changed the title feat(block-indentation): add autofix to the block-indentation rule Add autofixer to block-indentation rule Dec 16, 2021
@bmish
Copy link
Member

bmish commented Dec 16, 2021

Hope to see this and #2271 land!

@VincentMolinie VincentMolinie force-pushed the feat/block-identation/add-autofix branch from 6fd7354 to b1ecfff Compare December 17, 2021 08:50
@VincentMolinie
Copy link
Contributor Author

Hope to see this and #2271 land!

Yeah this one seems good I think. attribute-indetation needs some reqorks as I'm actually fixing block-identation inside it 😅

@VincentMolinie
Copy link
Contributor Author

tests pass @bmish 🙌

@bmish
Copy link
Member

bmish commented Dec 17, 2021

Looks like you need to run yarn update:readme.

Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good, thanks for working on it. I think we need a bit more high-level commenting to help people follow what's going on since the logic is a bit complex.

@@ -21,7 +21,7 @@

<div>
<p>{{t "greeting"}}</p>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the purpose. It says Bad example but It's actually a good one 😅

Template(node) {
if (this.mode === 'fix') {
if (
node.body[0] &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better way to write this is: node.body.length > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I said thé indentation of block start IS validated only for thé first node while It should validated all. This code disappear if WE want to really fix this issue

lib/rules/block-indentation.js Outdated Show resolved Hide resolved
lib/rules/block-indentation.js Show resolved Hide resolved
Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good, thanks for working on it. I think we need a bit more high-level commenting, maybe some clearer naming to help people follow what's going on since the logic is a bit complex.

@VincentMolinie
Copy link
Contributor Author

There is an issue on thé Indent. I did a fix at first but rollbacked It cause I didn't know if I should do It in this PR.
This code IS considered valid :

<div>
</div>
  <span>
  </span>

The fix of thé rule and thé autofix are quitté easy, let me know if you want It in this PR

lib/rules/block-indentation.js Outdated Show resolved Hide resolved
test/unit/rules/block-indentation-test.js Outdated Show resolved Hide resolved
@bmish
Copy link
Member

bmish commented Dec 22, 2021

There is an issue on thé Indent. I did a fix at first but rollbacked It cause I didn't know if I should do It in this PR. This code IS considered valid :

<div>
</div>
  <span>
  </span>

The fix of thé rule and thé autofix are quitté easy, let me know if you want It in this PR

@VincentMolinie it should be fine for us to fix the bug as a follow-up PR. Thanks for working on this!

@VincentMolinie
Copy link
Contributor Author

There is an issue on thé Indent. I did a fix at first but rollbacked It cause I didn't know if I should do It in this PR. This code IS considered valid :

<div>
</div>
  <span>
  </span>

The fix of thé rule and thé autofix are quitté easy, let me know if you want It in this PR

@VincentMolinie it should be fine for us to fix the bug as a follow-up PR. Thanks for working on this!

Okey so you want me to rollback: 0e20e0c ?

@bmish
Copy link
Member

bmish commented Dec 24, 2021

@VincentMolinie would it be easy for you to extract that bug fix to a follow-up PR? If so, let's do that quickly. If too inconvenient, we can keep them together.

@VincentMolinie VincentMolinie force-pushed the feat/block-identation/add-autofix branch from 07244d3 to 179bc67 Compare January 3, 2022 09:18
@VincentMolinie
Copy link
Contributor Author

Done ✅ @bmish

@bmish
Copy link
Member

bmish commented Jan 3, 2022

@VincentMolinie thanks, did you see the above comment about the bug extraction? Just wondering what you think.

@VincentMolinie
Copy link
Contributor Author

VincentMolinie commented Jan 4, 2022

Yes I removed the commit 😉 and I will create a PR once this one is merged ^^

Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@bmish bmish merged commit b39d9d1 into ember-template-lint:master Jan 4, 2022
@bmish
Copy link
Member

bmish commented Jan 4, 2022

@VincentMolinie excellent, can you create that other PR now?

@VincentMolinie
Copy link
Contributor Author

It's right here: #2318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants