Skip to content

Commit

Permalink
Merge pull request #621 from Exelord/fix/ignore-this-expressions
Browse files Browse the repository at this point in the history
Fix false positive with `ignoreNonThisExpressions` option in `use-ember-get-and-set` rule
  • Loading branch information
bmish authored Dec 6, 2019
2 parents b3d07e1 + ed6301a commit 4c6aedd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/rules/use-ember-get-and-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,17 @@ module.exports = {
) {
return;
}

// Skip calls made on this
if (options.ignoreThisExpressions && isThisExpression(callee.object)) {
return;
}
// Only lint calls made on this
if (options.ignoreNonThisExpressions && isThisExpression(callee.object)) {
report(node);
return;
} else if (options.ignoreNonThisExpressions) {

// Skip calls made on non this expression
if (options.ignoreNonThisExpressions && !isThisExpression(callee.object)) {
return;
}

// Skip calls made on Ember methods
if (isIdentifier(callee.object) && callee.object.name === emberImportAliasName) {
return;
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/use-ember-get-and-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ eslintTester.run('use-ember-get-and-set', rule, {
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
options: [{ ignoreNonThisExpressions: true }],
},
{
code: 'this.test("ok")',
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
options: [{ ignoreNonThisExpressions: true }],
},

// ignoreThisExpressions
{
Expand Down

0 comments on commit 4c6aedd

Please sign in to comment.