For consistency, always use the shorter object literal notation {}.
Non-Compliant Code Examples
varfoo=newObject()newObject();consta=newObject()
Compliant Code Examples
// Scoped re declare not supported
varmyObject={};varmyObject=newCustomObject();varfoo=newfoo.Object()// var Object = function Object() {};
// new Object();
varx=something?MyClass:Object;vary=newx();// class Object {
// constructor(){
// }
// }
// new Object();
// import { Object } from './'
// new Object();
constinit=(canvas,context,t)=>drawDoughnutChart(canvas,t('Chats'),context,labels.map((l)=>t(l)),Object.values(initialData),);
Seamless integrations. Try Datadog Code Analysis
Datadog Code Analysis
Try this rule and analyze your code with Datadog Code Analysis
How to use this rule
1
2
rulesets:- javascript-code-style # Rules to enforce JavaScript code style.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Analysis scans to your CI pipelines