question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule no-get-properties not work?

See original GitHub issue

It seems like no-get-properties rule not work. I’ve setup error state on this rule in .eslintrc file, but still linter always pass through without error even though the getProperties function is used incorrectly. I have the same settings with no-get rule, but I’m getting error correctly so I guess must be something wrong with this rule.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bmishcommented, May 3, 2019

@bobisjan the rule is currently limited to “destructuring assignments” that look like the following example because it’s trivial to simply remove the getProperties call from them.

const { abc, def } = this.getProperties('abc', 'def'); // Before
const { abc, def } = this; // After

Other usages would need a slightly more complex replacement to maintain the same behavior:

let data = this.getProperties('bar', 'foo', ...) // Before
let data = { this.bar, this.foo, ... } // After

If there’s interest in catching this more general usage, I would be open to updating the lint rule to do so.

0reactions
bobisjancommented, May 3, 2019

For our case the node.id.type is Identifier, which results to skip linting by this condition https://github.com/ember-cli/eslint-plugin-ember/blob/master/lib/rules/no-get-properties.js#L24

export default Component.extend({
  foo() {
    let data = this.getProperties('bar');
  }
});
Node {
  type: 'Identifier',
  start: 591,
  end: 594,
...
Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Why does GetProperty fail to find it? - Stack Overflow
If I add BindingFlags.Instance to the GetProperties() call, no properties are found, period. This is more consistent, and leads me to believe ...
Read more >
Type.GetProperties Method (System) - Microsoft Learn
A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature. Nested Type, No, No. Property, Not applicable, The common type system ...
Read more >
Type.GetProperties() not working in custom inpesctor
I have the following class: public abstract class Binding : MonoBehaviour { public ViewModel ViewModel; public string...
Read more >
eslint-plugin-ember/no-get.md at master - GitHub
Starting in Ember 3.1, native ES5 getters are available, which eliminates much of the need to use get / getProperties on Ember objects....
Read more >
Type.GetProperties - John Nelson's Blog
To set property values via Reflection, you must use the Type. GetProperty() method, then invoke the PropertyInfo. SetValue() method. The default overload that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found