fixed eslint issue of loadtransform Notebook and EntityProperty etc files

This commit is contained in:
sunilyadav840 2021-10-06 17:17:14 +05:30
parent f7fa3f7c09
commit 4b0cf93a10
7 changed files with 61 additions and 66 deletions

View File

@ -58,23 +58,15 @@ src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
src/Explorer/Menus/ContextMenu.ts
src/Explorer/MostRecentActivity/MostRecentActivity.ts
src/Explorer/Notebook/NotebookClientV2.ts
src/Explorer/Notebook/NotebookComponent/NotebookContentProvider.ts
src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
src/Explorer/Notebook/NotebookComponent/actions.ts
src/Explorer/Notebook/NotebookComponent/epics.test.ts
src/Explorer/Notebook/NotebookComponent/epics.ts
src/Explorer/Notebook/NotebookComponent/loadTransform.ts
src/Explorer/Notebook/NotebookComponent/reducers.ts
src/Explorer/Notebook/NotebookComponent/store.ts
src/Explorer/Notebook/NotebookComponent/types.ts
src/Explorer/Notebook/NotebookContainerClient.ts
src/Explorer/Notebook/NotebookContentClient.ts
src/Explorer/Notebook/NotebookContentItem.ts
src/Explorer/Notebook/NotebookUtil.ts
src/Explorer/OpenActionsStubs.ts
src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts
src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts
src/Explorer/Panes/Tables/Validators/EntityPropertyValueValidator.ts
src/Explorer/SplashScreen/SplashScreen.test.ts
src/Explorer/Tables/DataTable/CacheBase.ts
src/Explorer/Tables/DataTable/DataTableBindingManager.ts

View File

@ -1,4 +1,4 @@
export const editor = {
create: () => {},
setTheme: () => {}
create: () => { },
setTheme: () => { }
};

View File

@ -1,7 +1,7 @@
// This replicates transform loading from:
// https://github.com/nteract/nteract/blob/master/applications/jupyter-extension/nteract_on_jupyter/app/contents/notebook.tsx
export default (props: { addTransform: (component: any) => void }) => {
export default (props: { addTransform: (component: unknown) => void }): void => {
import(/* webpackChunkName: "plotly" */ "@nteract/transform-plotly").then((module) => {
props.addTransform(module.default);
props.addTransform(module.PlotlyNullTransform);

View File

@ -14,6 +14,7 @@ import { NotebookUtil } from "./NotebookUtil";
import { useNotebook } from "./useNotebook";
export class NotebookContainerClient {
// eslint-disable-next-line @typescript-eslint/no-empty-function
private clearReconnectionAttemptMessage? = () => {};
private isResettingWorkspace: boolean;

View File

@ -1,7 +1,7 @@
/* Constants */
var MaximumNameLength = 255;
var noHelp = "";
var detailedHelp = "Enter a name up to 255 characters in size. Most valid C# identifiers are allowed."; // localize
const MaximumNameLength = 255;
const noHelp = "";
const detailedHelp = "Enter a name up to 255 characters in size. Most valid C# identifiers are allowed."; // localize
export interface IValidationResult {
isInvalid: boolean;
@ -9,13 +9,13 @@ export interface IValidationResult {
}
export function validate(name: string): IValidationResult {
var help: string = noHelp;
let help: string = noHelp;
// Note: Disabling encoding check to err the side of lax validation.
// A valid property name should also be XML-serializable.
// Hence, only allowing names that don't require special encoding for network transmission.
// var encoded: string = tryEncode(name);
// var success: boolean = (name === encoded);
var success: boolean = true;
let success = true;
if (success) {
success = name.length <= MaximumNameLength;
@ -208,7 +208,7 @@ function IsValidLanguageIndependentIdentifier(value: string): boolean {
return IsValidTypeNameOrIdentifier(value, /* isTypeName */ false);
}
var UnicodeCategory = {
const UnicodeCategory = {
// Uppercase Letter
Lu: /[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԱ-ՖႠ-ჅḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ---ℝℤΩℨK--ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱯⱲⱵⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋA-]|\ud801[\udc00-\udc27]|\ud835[\udc00-\udc19\udc34-\udc4d\udc68-\udc81\udc9c\udc9e-\udc9f\udca2\udca5-\udca6\udca9-\udcac\udcae-\udcb5\udcd0-\udce9\udd04-\udd05\udd07-\udd0a\udd0d-\udd14\udd16-\udd1c\udd38-\udd39\udd3b-\udd3e\udd40-\udd44\udd46\udd4a-\udd50\udd6c-\udd85\udda0-\uddb9\uddd4-\udded\ude08-\ude21\ude3c-\ude55\ude70-\ude89\udea8-\udec0\udee2-\udefa\udf1c-\udf34\udf56-\udf6e\udf90-\udfa8\udfca]/,
// Lowercase Letter
@ -222,6 +222,7 @@ var UnicodeCategory = {
// Non Spacing Mark
Mn: /[\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0901-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0954\u0962-\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b62-\u0b63\u0b82\u0bc0\u0bcd\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0cbc\u0cbf\u0cc6\u0ccc-\u0ccd\u0ce2-\u0ce3\u0d41-\u0d44\u0d4d\u0d62-\u0d63\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1c2c-\u1c33\u1c36-\u1c37\u1dc0-\u1de6\u1dfe-\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2de0-\u2dff\u302a-\u302f\u3099-\u309a\ua66f\ua67c-\ua67d\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua926-\ua92d\ua947-\ua951\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\ufb1e\ufe00-\ufe0f\ufe20-\ufe26]|\ud800\uddfd|\ud802[\ude01-\ude03\ude05-\ude06\ude0c-\ude0f\ude38-\ude3a\ude3f]|\ud834[\udd67-\udd69\udd7b-\udd82\udd85-\udd8b\uddaa-\uddad\ude42-\ude44]|\udb40[\udd00-\uddef]/,
// Spacing Combining Mark
// eslint-disable-next-line no-misleading-character-class
Mc: /[\u0903\u093e-\u0940\u0949-\u094c\u0982-\u0983\u09be-\u09c0\u09c7-\u09c8\u09cb-\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb-\u0acc\u0b02-\u0b03\u0b3e\u0b40\u0b47-\u0b48\u0b4b-\u0b4c\u0b57\u0bbe-\u0bbf\u0bc1-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82-\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7-\u0cc8\u0cca-\u0ccb\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82-\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2-\u0df3\u0f3e-\u0f3f\u0f7f\u102b-\u102c\u1031\u1038\u103b-\u103c\u1056-\u1057\u1062-\u1064\u1067-\u106d\u1083-\u1084\u1087-\u108c\u108f\u17b6\u17be-\u17c5\u17c7-\u17c8\u1923-\u1926\u1929-\u192b\u1930-\u1931\u1933-\u1938\u19b0-\u19c0\u19c8-\u19c9\u1a19-\u1a1b\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43-\u1b44\u1b82\u1ba1\u1ba6-\u1ba7\u1baa\u1c24-\u1c2b\u1c34-\u1c35\ua823-\ua824\ua827\ua880-\ua881\ua8b4-\ua8c3\ua952-\ua953\uaa2f-\uaa30\uaa33-\uaa34\uaa4d]|\ud834[\udd65-\udd66\udd6d-\udd72]/,
// Connector Punctuation
Pc: /[_‿-⁀⁔︳-︴﹍-_]/,
@ -230,15 +231,15 @@ var UnicodeCategory = {
};
function IsValidTypeNameOrIdentifier(value: string, isTypeName: boolean): boolean {
var nextMustBeStartChar: boolean = true;
let nextMustBeStartChar = true;
if (!value.length) {
return false;
}
// each char must be Lu, Ll, Lt, Lm, Lo, Nd, Mn, Mc, Pc
for (var i = 0; i < value.length; i++) {
var ch: string = value[i];
for (let i = 0; i < value.length; i++) {
const ch: string = value[i];
if (
UnicodeCategory.Lu.test(ch) ||
@ -265,8 +266,8 @@ function IsValidTypeNameOrIdentifier(value: string, isTypeName: boolean): boolea
if (!isTypeName) {
return false;
} else {
var ref: { nextMustBeStartChar: boolean } = { nextMustBeStartChar: nextMustBeStartChar };
var isSpecialTypeChar = IsSpecialTypeChar(ch, ref);
const ref: { nextMustBeStartChar: boolean } = { nextMustBeStartChar: nextMustBeStartChar };
const isSpecialTypeChar = IsSpecialTypeChar(ch, ref);
nextMustBeStartChar = ref.nextMustBeStartChar;

View File

@ -1,23 +1,24 @@
export var Int32 = {
export const Int32 = {
Min: -2147483648,
Max: 2147483647,
};
export var Int64 = {
export const Int64 = {
Min: -9223372036854775808,
Max: 9223372036854775807,
};
var yearMonthDay = "\\d{4}[- ][01]\\d[- ][0-3]\\d";
var timeOfDay = "T[0-2]\\d:[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?";
var timeZone = "Z|[+-][0-2]\\d:[0-5]\\d";
const yearMonthDay = "\\d{4}[- ][01]\\d[- ][0-3]\\d";
const timeOfDay = "T[0-2]\\d:[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?";
const timeZone = "Z|[+-][0-2]\\d:[0-5]\\d";
export var ValidationRegExp = {
export const ValidationRegExp = {
Guid: /^[{(]?[0-9A-F]{8}[-]?([0-9A-F]{4}[-]?){3}[0-9A-F]{12}[)}]?$/i,
Float: /^[+-]?\d+(\.\d+)?(e[+-]?\d+)?$/i,
// OData seems to require an "L" suffix for Int64 values, yet Azure Storage errors out with it. See http://www.odata.org/documentation/odata-version-2-0/overview/
Integer: /^[+-]?\d+$/i, // Used for both Int32 and Int64 values
Boolean: /^"?(true|false)"?$/i,
DateTime: new RegExp(`^${yearMonthDay}${timeOfDay}${timeZone}$`),
// eslint-disable-next-line no-control-regex
PrimaryKey: /^[^/\\#?\u0000-\u001F\u007F-\u009F]*$/,
};

View File

@ -1,5 +1,6 @@
import * as Utilities from "../../../Tables/Utilities";
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as StorageExplorerConstants from "../../../Tables/Constants";
import * as Utilities from "../../../Tables/Utilities";
import * as EntityPropertyValidationCommon from "./EntityPropertyValidationCommon";
interface IValidationResult {
@ -9,21 +10,21 @@ interface IValidationResult {
interface IValueValidator {
validate: (value: string) => IValidationResult;
parseValue: (value: string) => any;
parseValue: (value: string) => unknown;
}
/* Constants */
var noHelp: string = "";
var MaximumStringLength = 64 * 1024; // 64 KB
var MaximumRequiredStringLength = 1 * 1024; // 1 KB
const noHelp = "";
const MaximumStringLength = 64 * 1024; // 64 KB
const MaximumRequiredStringLength = 1 * 1024; // 1 KB
class ValueValidator implements IValueValidator {
public validate(value: string): IValidationResult {
public validate(_value: string): IValidationResult {
// throw new Errors.NotImplementedFunctionError("ValueValidator.validate");
return null;
return undefined;
}
public parseValue(value: string): any {
public parseValue(value: string): unknown {
return value; // default pass-thru implementation
}
}
@ -33,7 +34,7 @@ class KeyValidator implements ValueValidator {
public validate(value: string): IValidationResult {
if (
value == null ||
value === undefined ||
value.trim().length === 0 ||
EntityPropertyValidationCommon.ValidationRegExp.PrimaryKey.test(value)
) {
@ -52,8 +53,8 @@ class BooleanValueValidator extends ValueValidator {
private detailedHelp = "Enter true or false."; // localize
public validate(value: string): IValidationResult {
var success: boolean = false;
var help: string = noHelp;
let success = false;
let help: string = noHelp;
if (value) {
success = EntityPropertyValidationCommon.ValidationRegExp.Boolean.test(value);
@ -76,12 +77,12 @@ class DateTimeValueValidator extends ValueValidator {
private detailedHelp = "Enter a date and time."; // localize
public validate(value: string): IValidationResult {
var success: boolean = false;
var help: string = noHelp;
let success = false;
let help: string = noHelp;
if (value) {
// Try to parse the value to see if it is a valid date string
var parsed: number = Date.parse(value);
const parsed: number = Date.parse(value);
success = !isNaN(parsed);
}
@ -94,8 +95,8 @@ class DateTimeValueValidator extends ValueValidator {
}
public parseValue(value: string): Date {
var millisecondTime = Date.parse(value);
var parsed: Date = new Date(millisecondTime);
const millisecondTime = Date.parse(value);
const parsed: Date = new Date(millisecondTime);
return parsed;
}
@ -105,8 +106,8 @@ class DoubleValueValidator extends ValueValidator {
private detailedHelp = "Enter a 64-bit floating point value."; // localize
public validate(value: string): IValidationResult {
var success: boolean = false;
var help: string = noHelp;
let success = false;
let help: string = noHelp;
if (value) {
success = EntityPropertyValidationCommon.ValidationRegExp.Float.test(value);
@ -128,8 +129,8 @@ class GuidValueValidator extends ValueValidator {
private detailedHelp = "Enter a 16-byte (128-bit) GUID value."; // localize
public validate(value: string): IValidationResult {
var success: boolean = false;
var help: string = noHelp;
let success = false;
let help: string = noHelp;
if (value) {
success = EntityPropertyValidationCommon.ValidationRegExp.Guid.test(value);
@ -149,20 +150,20 @@ class IntegerValueValidator extends ValueValidator {
private isInt64: boolean;
constructor(isInt64: boolean = true) {
constructor(isInt64 = true) {
super();
this.isInt64 = isInt64;
}
public validate(value: string): IValidationResult {
var success: boolean = false;
var help: string = noHelp;
let success = false;
let help: string = noHelp;
if (value) {
success = EntityPropertyValidationCommon.ValidationRegExp.Integer.test(value) && Utilities.isSafeInteger(value);
if (success) {
var intValue = parseInt(value, 10);
const intValue = parseInt(value, 10);
success = !isNaN(intValue);
if (success && !this.isInt64) {
@ -199,14 +200,14 @@ class StringValidator extends ValueValidator {
}
public validate(value: string): IValidationResult {
var help: string = this.isRequired ? this.isRequiredHelp : this.detailedHelp;
if (value === null) {
let help: string = this.isRequired ? this.isRequiredHelp : this.detailedHelp;
if (value === undefined) {
return { isInvalid: false, help: help };
}
// Ensure we validate the string projection of value.
value = String(value);
var success = true;
let success = true;
if (success) {
success = value.length <= (this.isRequired ? MaximumRequiredStringLength : MaximumStringLength);
@ -235,12 +236,12 @@ class NotSupportedValidator extends ValueValidator {
public validate(ignoredValue: string): IValidationResult {
//throw new Errors.NotSupportedError(this.getMessage());
return null;
return undefined;
}
public parseValue(ignoredValue: string): any {
public parseValue(ignoredValue: string): undefined {
//throw new Errors.NotSupportedError(this.getMessage());
return null;
return undefined;
}
private getMessage(): string {
@ -250,7 +251,7 @@ class NotSupportedValidator extends ValueValidator {
class PropertyValidatorFactory {
public getValidator(type: string, isRequired: boolean) {
var validator: IValueValidator = null;
let validator: IValueValidator;
// TODO classify rest of Cassandra types/create validators for them
switch (type) {
@ -273,7 +274,6 @@ class PropertyValidatorFactory {
break;
case StorageExplorerConstants.TableType.Int32:
case StorageExplorerConstants.CassandraType.Int:
// TODO create separate validators for smallint and tinyint
case StorageExplorerConstants.CassandraType.Smallint:
case StorageExplorerConstants.CassandraType.Tinyint:
validator = new IntegerValueValidator(/* isInt64 */ false);
@ -317,19 +317,19 @@ export default class EntityPropertyValueValidator {
}
public validate(value: string, type: string): IValidationResult {
var validator: IValueValidator = this.getValidator(type);
const validator: IValueValidator = this.getValidator(type);
return validator ? validator.validate(value) : null; // Should not happen.
return validator ? validator.validate(value) : undefined; // Should not happen.
}
public parseValue(value: string, type: string): any {
var validator: IValueValidator = this.getValidator(type);
public parseValue(value: string, type: string): unknown {
const validator: IValueValidator = this.getValidator(type);
return validator ? validator.parseValue(value) : null; // Should not happen.
return validator ? validator.parseValue(value) : undefined; // Should not happen.
}
private getValidator(type: string): IValueValidator {
var validator: IValueValidator = this.validators[type];
let validator: IValueValidator = this.validators[type];
if (!validator) {
validator = this.validatorFactory.getValidator(type, this.isRequired);