Skip to content

Commit

Permalink
Merge pull request #865 from bmish/refactor-rename-ember-extend-object
Browse files Browse the repository at this point in the history
Rename util function to `isExtendObject`
  • Loading branch information
bmish authored Jun 22, 2020
2 parents 52e0989 + c35c84a commit 73016a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/rules/avoid-leaking-state-in-ember-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = {

return {
CallExpression(node) {
if (!(ember.isEmberObject(node) || ember.isReopenObject(node))) {
if (!(ember.isExtendObject(node) || ember.isReopenObject(node))) {
return;
}

Expand Down
11 changes: 5 additions & 6 deletions lib/utils/ember.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ module.exports = {
unwrapBraceExpressions,
hasDuplicateDependentKeys,

isEmberObject,

isExtendObject,
isReopenObject,
isReopenClassObject,

Expand All @@ -78,7 +77,7 @@ const CORE_MODULE_IMPORT_PATHS = {
};

function isClassicEmberCoreModule(node, module, filePath) {
const isExtended = isEmberObject(node);
const isExtended = isExtendObject(node);
let isModuleByPath;

if (filePath) {
Expand Down Expand Up @@ -143,7 +142,7 @@ function isModule(node, element, module) {
}

function isDSModel(node, filePath) {
const isExtended = isEmberObject(node);
const isExtended = isExtendObject(node);
let isModuleByPath = false;

if (filePath && isExtended) {
Expand Down Expand Up @@ -182,7 +181,7 @@ function isMirageConfig(fileName) {
return fileName.endsWith(path.join('mirage', 'config.js'));
}

function isEmberObject(node) {
function isExtendObject(node) {
return (
node.callee.property &&
(node.callee.property.name === 'extend' || node.callee.property.value === 'extend')
Expand Down Expand Up @@ -535,7 +534,7 @@ function unwrapBraceExpressions(dependentKeys) {

function isEmberObjectImplementingUnknownProperty(node) {
if (types.isCallExpression(node)) {
if (!isEmberObject(node) && !isReopenObject(node)) {
if (!isExtendObject(node) && !isReopenObject(node)) {
return false;
}
// Classic class.
Expand Down

0 comments on commit 73016a9

Please sign in to comment.