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 new rule no-get-with-default #594

Merged
merged 12 commits into from
Nov 19, 2019
Merged

Add new rule no-get-with-default #594

merged 12 commits into from
Nov 19, 2019

Conversation

steventsao
Copy link
Contributor

@steventsao steventsao commented Nov 15, 2019

This is enabled in the octane config.

lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
docs/rules/no-get-with-default.md Show resolved Hide resolved
docs/rules/no-get-with-default.md Outdated Show resolved Hide resolved
docs/rules/no-get-with-default.md Outdated Show resolved Hide resolved
docs/rules/no-get-with-default.md Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
tests/lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
tests/lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
@bmish bmish changed the title Add no-get-with-default rule Add new rule no-get-with-default Nov 18, 2019
- Add test cases
- Remove autofixable
- Include nullish-coalescing operator in rule doc
- Include object-method syntax in error message
- Remove schema
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.

Good progress!

You should also consider adding an autofixer for this rule as a follow-up (separate PR since it might be tricky). It would replace this.getWithDefault('property', 'default-value') with (this.get('property') === undefined ? 'default-value' : this.get('property')).

docs/rules/no-get-with-default.md Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
docs/rules/no-get-with-default.md Show resolved Hide resolved
tests/lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
tests/lib/rules/no-get-with-default.js Show resolved Hide resolved
@steventsao
Copy link
Contributor Author

You should also consider adding an autofixer for this rule as a follow-up (separate PR since it might be tricky). It would replace this.getWithDefault('property', 'default-value') with (this.get('property') === undefined ? 'default-value' : this.get('property')).

Yeah that's a good idea. I'll do that =)

lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
lib/rules/no-get-with-default.js Outdated Show resolved Hide resolved
@bmish
Copy link
Member

bmish commented Nov 19, 2019

Remember to run yarn update!

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.

Nice work!

@bmish bmish merged commit 1c18fd9 into ember-cli:master Nov 19, 2019
@steventsao
Copy link
Contributor Author

@bmish When is the next release? Just wondering so I can give an update to my team.

@bmish
Copy link
Member

bmish commented Nov 19, 2019

I'll release this in a few minutes.

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.

3 participants