Skip to content

Fix linting error (#775) #777

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

Merged
merged 8 commits into from
Nov 4, 2021

Conversation

rajakvk
Copy link
Contributor

@rajakvk rajakvk commented Oct 15, 2021

Closes item-1 at #775

@@ -26,19 +25,19 @@ export default class ApiIndexFilter extends Component {

filterItems(itemType) {
let items =
this.get(`model.${itemType}`) === undefined
this.model[`${itemType}`] === undefined
Copy link
Contributor

@jenweber jenweber Oct 21, 2021

Choose a reason for hiding this comment

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

I think we can simplify this now:

Suggested change
this.model[`${itemType}`] === undefined
this.model[itemType] === undefined

I think maybe the linter is complaining about formatting here too. Maybe this should be on the same line as let items = now that it is shorter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

@jenweber jenweber left a comment

Choose a reason for hiding this comment

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

Hi! I think this is almost ready to go. See my comments about what to fix to make the linter happy.

Copy link
Contributor Author

@rajakvk rajakvk left a comment

Choose a reason for hiding this comment

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

Updated code as per @jenweber comments.

Copy link
Contributor

@locks locks left a comment

Choose a reason for hiding this comment

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

Ember Data relationships need to be accessed using get because models are proxy objects.

Comment on lines 92 to 93
let currentScope = this.model.file;
let parentClassScope = this.model.parentClass.file;
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests are failing because model is an Ember Data model and file seems to be a relationship? Since Ember Data models are proxy objects, you still need to use get to get relationship values:

Suggested change
let currentScope = this.model.file;
let parentClassScope = this.model.parentClass.file;
let currentScope = this.model.file;
let parentClassScope = this.model.get('parentClass').file;

@rajakvk rajakvk force-pushed the rk-775-fix-linting-error-2 branch from 6ba5d2f to f67b5e0 Compare October 28, 2021 18:51
Copy link
Contributor

@locks locks left a comment

Choose a reason for hiding this comment

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

Woohoo! Thanks for your effort 😁

@locks locks force-pushed the rk-775-fix-linting-error-2 branch from c682222 to 885f302 Compare November 4, 2021 22:18
@locks locks merged commit e3c69d6 into ember-learn:master Nov 4, 2021
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