Skip to content

Add no-computed-without-dependent-keys rule#346

Open
gmurphey wants to merge 1 commit intoember-cli:masterfrom
gmurphey:no-computed-without-dependent-keys
Open

Add no-computed-without-dependent-keys rule#346
gmurphey wants to merge 1 commit intoember-cli:masterfrom
gmurphey:no-computed-without-dependent-keys

Conversation

@gmurphey
Copy link
Copy Markdown
Contributor

Todo:

  • Add documentation

const ember = require('../utils/ember');

//------------------------------------------------------------------------------
// General rule - Don't introduce side-effects in computed properties
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the comment banner will need to be updated or removed

message: 'A computed property needs dependent keys'
}]
},
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you add tests for a few of the common computed property macros?

@gmurphey
Copy link
Copy Markdown
Contributor Author

Also realized we'll need to ignore volatile computeds for this rule.

@gmurphey gmurphey force-pushed the no-computed-without-dependent-keys branch from 4823a98 to 99ae07b Compare December 3, 2018 16:28
@Turbo87 Turbo87 changed the title Adding no-computed-without-dependent-keys rule Add no-computed-without-dependent-keys rule Jan 10, 2019
@rwjblue
Copy link
Copy Markdown
Member

rwjblue commented Jun 26, 2019

I'd love to land this.

@gmurphey - Have any cycles to address the feedback and rebase?

@rwjblue
Copy link
Copy Markdown
Member

rwjblue commented Jun 26, 2019

Thoughts on using require-computed-dependent-keys instead of no-computed-without-dependent-keys? I don't feel strongly either way, just wondering what folks thought...

Copy link
Copy Markdown
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Also need to add an invalid test for:

        export default Ember.Component({
          foo: computed({
            get() {
              return this.get('bar') * 2;
            }
          })
        });

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