Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
babel-plugin-transform-class-properties
Advanced tools
The babel-plugin-transform-class-properties package is a Babel plugin that allows you to use class properties in your JavaScript code. This plugin transforms class properties to be compatible with older JavaScript environments that do not support this feature natively.
Public Class Fields
This feature allows you to define public class fields directly within the class body. The plugin transforms this syntax to be compatible with older JavaScript environments.
class MyClass {
myField = 'Hello, world!';
}
Static Class Fields
This feature allows you to define static class fields directly within the class body. Static fields are shared among all instances of the class. The plugin ensures this syntax works in environments that do not support it natively.
class MyClass {
static myStaticField = 'Hello, static world!';
}
Instance Property Initialization
This feature allows you to initialize instance properties directly within the class body, making the code more concise and readable. The plugin transforms this syntax to be compatible with older JavaScript environments.
class MyClass {
myField = 'Hello, world!';
constructor() {
console.log(this.myField);
}
}
The babel-plugin-transform-es2015-classes package transforms ES2015 class syntax to ES5. While it does not specifically focus on class properties, it is often used in conjunction with other plugins to achieve similar functionality.
$ npm install babel-plugin-transform-class-properties
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-class-properties"]
}
$ babel --plugins transform-class-properties script.js
require("babel-core").transform("code", {
plugins: ["transform-class-properties"]
});
FAQs
This plugin transforms static class properties as well as properties declared with the property initializer syntax
We found that babel-plugin-transform-class-properties demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.