Ember.js V5 - Cp Volatile

This automation removes all calls to volatile() and ensures that native getters are directly used.

Ember.js
jscodeshift
Estimated time saving
5 minutes/occurrence
Change mode
Autonomous
Applicability criteria

Ember.js version higher or equal to 3.9.

Made by
Rajasegar Chandran
Rajasegar Chandran

Usage →

Codemod CLI:

intalling vs code extension tooltip icon
codemod ember/5/cp-volatile
copy CLI command icon

Codemod VS Code extension:

intalling vs code extension tooltip icon
vs code logo
Run in VS Code

Use/edit codemod in Codemod Studio:

intuita logo without text
Open in Codemod Studio

Description

This codemod removes all calls to volatile() and ensures that native getters are directly used.

Example

Before:

const Person = EmberObject.extend({
	fullName: computed(function () {
		return `${this.firstName} ${this.lastName}`;
	}).volatile(),
});

After:

const Person = EmberObject.extend({
	get fullName() {
		return `${this.firstName} ${this.lastName}`;
	},
});