Open tshemsedinov opened 2 years ago
Hi , I can try to solve this problem, I have collected all the places where you need to use .?
, but maybe I missed something
https://github.com/metarhia/metacalc - didn't find anything that can be fixed
https://github.com/metarhia/metautil - didn't find anything that can be fixed
https://github.com/metarhia/metasql/blob/master/lib/database.js#L257-L259
if (entity && entity.kind === 'registry') { return this.register(table, fields, params, data); }
change to
if (entity?.kind === 'registry') { return this.register(table, fields, params, data); }
https://github.com/metarhia/metasql/blob/master/lib/pg.js#L178-L180
if (def.length && def.length.max) { pgType = '${pgType}(${def.length.max})'; }
change to
if (def.length?.max) { pgType = '${pgType}(${def.length.max})'; }
https://github.com/metarhia/metaschema/blob/master/lib/prototypes/collections.js#L49-L51
isInstance(value) { return value && value.constructor && value.constructor.name === 'Map'; },
change to
isInstance(value) { return value?.constructor?.name === 'Map'; },
https://github.com/metarhia/metaschema/blob/master/lib/prototypes/collections.js#L93-L95
isInstance(value) { return value && value.constructor && value.constructor.name === 'Set'; },
change to
isInstance(value) { return value?.constructor?.name === 'Set'; },
https://github.com/metarhia/metaschema/blob/master/lib/metadata.js#L41-L43
static isInstance(err) { return err && err.errors && Array.isArray(err.errors); },
change to
static isInstance(err) { return err?.errors && Array.isArray(err.errors); }
https://github.com/metarhia/metaschema/blob/master/lib/util.js#L42-L43
const isInstanceOf = (obj, constrName) => obj && obj.constructor && obj.constructor.name === constrName;
change to
const isInstanceOf = (obj, constrName) => obj?.constructor?.name === constrName;
https://github.com/metarhia/metaconfiguration - didn't find anything that can be fixed
https://github.com/metarhia/metadomain - didn't find anything that can be fixed
https://github.com/metarhia/metalog - didn't find anything that can be fixed
https://github.com/metarhia/concolor - didn't find anything that can be fixed
https://github.com/metarhia/noroutine - didn't find anything that can be fixed
https://github.com/metarhia/lowscript - didn't find anything that can be fixed
https://github.com/metarhia/metawatch - didn't find anything that can be fixed
const name = options && options.filename ? options.filename : path.basename(filePath, '.js');
change to
const name = options?.filename ? options.filename : path.basename(filePath, '.js');
If I missed something, I will be glad if I am corrected
All places needs refactoring @shatanov !
added changes in their directories
We are going to use optional chaining operator
?.
. Here is a list of repositories to be reviewed:Please don't create pull requests immediately. First step: review all codebase and collect links to the certain places and post all links to this issue. Second step: we will discuss all those cases and assign you to make PRs.
Example: https://github.com/metarhia/metaschema/blob/3de9bea21c35b48e538436f08b683b7e18e72398/lib/util.js#L42-L43
change to