
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@babel/plugin-syntax-class-properties
Advanced tools
The @babel/plugin-syntax-class-properties npm package allows Babel to parse class properties, enabling developers to use class properties syntax in JavaScript. This plugin is purely syntactical and does not apply any transformations. It is often used in conjunction with transformation plugins to compile class properties to a format compatible with older JavaScript engines.
Class Properties Syntax
Enables the use of static and instance class properties directly within class declarations. This syntax is part of the ECMAScript proposal and allows for clearer and more concise class definitions.
class MyClass {
static myStaticProp = 42;
myInstanceProp = 'hello';
}
This package not only allows Babel to parse class properties but also transforms them so they can run in environments that do not support this feature natively. It is more comprehensive compared to @babel/plugin-syntax-class-properties, which only enables parsing.
While not exclusively focused on class properties, this Babel preset includes capabilities to transform class properties based on the target environment. It is a broader tool that configures Babel plugins and polyfills according to the target browsers or runtime environments.
Allow parsing of class properties.
npm install --save-dev @babel/plugin-syntax-class-properties
.babelrc
(Recommended).babelrc
{
"plugins": ["@babel/plugin-syntax-class-properties"]
}
babel --plugins @babel/plugin-syntax-class-properties script.js
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-syntax-class-properties"]
});
FAQs
Allow parsing of class properties
The npm package @babel/plugin-syntax-class-properties receives a total of 12,651,132 weekly downloads. As such, @babel/plugin-syntax-class-properties popularity was classified as popular.
We found that @babel/plugin-syntax-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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.