Skip to content

Commit

Permalink
Core: fix/ignore eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanblinov2k17 committed Oct 4, 2024
1 parent 4c3da97 commit dd3cf72
Show file tree
Hide file tree
Showing 33 changed files with 296 additions and 266 deletions.
12 changes: 7 additions & 5 deletions packages/devextreme/js/__internal/core/m_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Action {
const excludeValidators = this._excludeValidators;
const { executors } = Action;

for (const name in executors) {
Object.keys(executors).forEach((name) => {
if (!excludeValidators[name]) {
const executor = executors[name];
executor.validate?.(e);
Expand All @@ -71,7 +71,7 @@ class Action {
return false;
}
}
}
});

return true;
}
Expand All @@ -80,15 +80,16 @@ class Action {
let result;
const { executors } = Action;

for (const name in executors) {
Object.keys(executors).some((name) => {
const executor = executors[name];
executor.execute?.(e);

if (e.handled) {
result = e.result;
break;
return true;
}
}
return false;
});

return result;
}
Expand All @@ -103,6 +104,7 @@ class Action {

static unregisterExecutor(...args) {
each(args, function () {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete Action.executors[this];
});
}
Expand Down
16 changes: 9 additions & 7 deletions packages/devextreme/js/__internal/core/m_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ const wrapOverridden = function (baseProto, methodName, method) {
};

const clonePrototype = function (obj) {
const func = function () { };
func.prototype = obj.prototype;
return new func();
const Func = function () { };
Func.prototype = obj.prototype;
return new Func();
};

const redefine = function (members) {
const that = this;
let overridden;
let memberName;
let member;

if (!members) {
return that;
}

for (memberName in members) {
Object.keys(members).forEach((memberName) => {
member = members[memberName];
overridden = typeof that.prototype[memberName] === 'function' && typeof member === 'function';
that.prototype[memberName] = overridden ? wrapOverridden(that.parent.prototype, memberName, member) : member;
}
that.prototype[memberName] = overridden
? wrapOverridden(that.parent.prototype, memberName, member)
: member;
});

return that;
};
Expand Down Expand Up @@ -63,6 +64,7 @@ const include = function () {
classObj._includedPostCtors.push(argument.postCtor);
}

// eslint-disable-next-line no-restricted-syntax
for (name in argument) {
if (name === 'ctor' || name === 'postCtor' || name === 'default') {
continue;
Expand Down
21 changes: 11 additions & 10 deletions packages/devextreme/js/__internal/core/m_component_registrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import errors from '@js/core/errors';
import $ from '@js/core/renderer';
import { name as publicComponentName } from '@js/core/utils/public_component';

const registerComponent = function (name, namespace, componentClass) {
if (!componentClass) {
componentClass = namespace;
const registerComponent = function (name, namespace, ComponentClass) {
if (!ComponentClass) {
ComponentClass = namespace;
} else {
namespace[name] = componentClass;
namespace[name] = ComponentClass;
}

publicComponentName(componentClass, name);
callbacks.fire(name, componentClass);
publicComponentName(ComponentClass, name);
callbacks.fire(name, ComponentClass);
};

const registerRendererComponent = function (name, componentClass) {
const registerRendererComponent = function (name, ComponentClass) {
$.fn[name] = function (options) {
const isMemberInvoke = typeof options === 'string';
let result;
Expand All @@ -24,7 +24,7 @@ const registerRendererComponent = function (name, componentClass) {
const memberArgs = [].slice.call(arguments).slice(1);

this.each(function () {
const instance = componentClass.getInstance(this);
const instance = ComponentClass.getInstance(this);

if (!instance) {
throw errors.Error('E0009', name);
Expand All @@ -39,11 +39,12 @@ const registerRendererComponent = function (name, componentClass) {
});
} else {
this.each(function () {
const instance = componentClass.getInstance(this);
const instance = ComponentClass.getInstance(this);
if (instance) {
instance.option(options);
} else {
new componentClass(this, options);
// eslint-disable-next-line no-new
new ComponentClass(this, options);
}
});

Expand Down
3 changes: 1 addition & 2 deletions packages/devextreme/js/__internal/core/m_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ const config = {
const normalizeToJSONString = (optionsString) => optionsString
.replace(/'/g, '"') // replace all ' to "
.replace(/,\s*([\]}])/g, '$1') // remove trailing commas
.replace(/([{,])\s*([^":\s]+)\s*:/g, '$1"$2":') // add quotes for unquoted keys
;
.replace(/([{,])\s*([^":\s]+)\s*:/g, '$1"$2":'); // add quotes for unquoted keys

const deprecatedFields = ['decimalSeparator', 'thousandsSeparator'];

Expand Down
1 change: 1 addition & 0 deletions packages/devextreme/js/__internal/core/m_devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const UA_PARSERS = {
const isPhone = /mobile/i.test(userAgent);
const matches = userAgent.match(/android (\d+)\.?(\d+)?\.?(\d+)?/i);
const version = matches ? [parseInt(matches[1], 10), parseInt(matches[2] || 0, 10), parseInt(matches[3] || 0, 10)] : [];
// eslint-disable-next-line @typescript-eslint/naming-convention
const worseThan4_4 = version.length > 1 && (version[0] < 4 || version[0] === 4 && version[1] < 4);
const grade = worseThan4_4 ? 'B' : 'A';

Expand Down
1 change: 1 addition & 0 deletions packages/devextreme/js/__internal/core/m_element_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ setDataStrategy({
} else {
const elementData = dataMap.get(element);
if (elementData) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete elementData[key];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import domAdapter from '@js/core/dom_adapter';
import { cleanDataRecursive } from '@js/core/element_data';
import injector from '@js/core/utils/dependency_injector';
import { render } from 'inferno';
// eslint-disable-next-line import/no-extraneous-dependencies
import { createElement } from 'inferno-create-element';

const remove = (element) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PostponedOperations {
}

callPostponedOperations() {
for (const key in this._postponedOperations) {
Object.keys(this._postponedOperations).forEach((key) => {
const operation = this._postponedOperations[key];

if (isDefined(operation)) {
Expand All @@ -32,7 +32,7 @@ export class PostponedOperations {
operation.fn().done(operation.completePromise.resolve);
}
}
}
});
this._postponedOperations = {};
}
}
Loading

0 comments on commit dd3cf72

Please sign in to comment.