Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Jul 19, 2023
1 parent 5b062a4 commit 255e78a
Show file tree
Hide file tree
Showing 32 changed files with 143 additions and 103 deletions.
36 changes: 36 additions & 0 deletions .changeset/tall-ducks-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'@finos/legend-application-pure-ide-deployment': patch
'@finos/legend-application-studio-deployment': patch
'@finos/legend-extension-store-service-store': patch
'@finos/legend-application-query-deployment': patch
'@finos/legend-application-studio-bootstrap': patch
'@finos/legend-application-query-bootstrap': patch
'@finos/legend-extension-store-relational': patch
'@finos/legend-server-showcase-deployment': patch
'@finos/legend-extension-dsl-persistence': patch
'@finos/legend-extension-store-flat-data': patch
'@finos/legend-extension-dsl-data-space': patch
'@finos/legend-extension-tracer-zipkin': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-mastery': patch
'@finos/legend-extension-dsl-service': patch
'@finos/legend-application-pure-ide': patch
'@finos/legend-extension-assortment': patch
'@finos/legend-application-studio': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-application-query': patch
'@finos/legend-server-showcase': patch
'@finos/legend-query-builder': patch
'@finos/legend-server-depot': patch
'@finos/legend-application': patch
'@finos/legend-server-sdlc': patch
'@finos/legend-dev-utils': patch
'@finos/stylelint-config-legend-studio': patch
'@finos/legend-storage': patch
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-shared': patch
'@finos/babel-preset-legend-studio': patch
'@finos/legend-graph': patch
'@finos/legend-lego': patch
'@finos/legend-art': patch
---
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ const TYPESCRIPT_RULES = {
ERROR,
{ fixMixedExportsWithInlineTypeSpecifier: true },
],
'@typescript-eslint/prefer-nullish-coalescing': ERROR,
'@typescript-eslint/prefer-nullish-coalescing': [
ERROR,
{
ignoreConditionalTests: true,
ignoreTernaryTests: true,
ignoreMixedLogicalExpressions: true,
},
],
'@typescript-eslint/prefer-optional-chain': ERROR,
'@typescript-eslint/no-unnecessary-condition': ERROR,
'@typescript-eslint/no-unnecessary-type-assertion': ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,12 @@ const CloneQueryServiceSetupContent = observer(() => {
querySetupState.setCurrentProjectVersions([]);
try {
fetchSelectedProjectVersionsStatus.inProgress();
const v = (await flowResult(
depotServerClient.getVersions(
guaranteeNonNullable(option?.value.groupId),
guaranteeNonNullable(option?.value.artifactId),
true,
),
)) as string[];
querySetupState.setCurrentProjectVersions(v);
const versions = await depotServerClient.getVersions(
guaranteeNonNullable(option?.value.groupId),
guaranteeNonNullable(option?.value.artifactId),
true,
);
querySetupState.setCurrentProjectVersions(versions);
} catch (error) {
assertErrorThrown(error);
applicationStore.notificationService.notifyError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,12 @@ const CreateMappingQuerySetupContent = observer(() => {
setupStore.setCurrentProjectVersions([]);
try {
fetchSelectedProjectVersionsStatus.inProgress();
const v = (await flowResult(
depotServerClient.getVersions(
guaranteeNonNullable(option?.value.groupId),
guaranteeNonNullable(option?.value.artifactId),
true,
),
)) as string[];
setupStore.setCurrentProjectVersions(v);
const versions = await depotServerClient.getVersions(
guaranteeNonNullable(option?.value.groupId),
guaranteeNonNullable(option?.value.artifactId),
true,
);
setupStore.setCurrentProjectVersions(versions);
} catch (error) {
assertErrorThrown(error);
applicationStore.notificationService.notifyError(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const ExternalFormatGeneratioConfigEditor = observer(
debouncedRegenerate()?.catch(applicationStore.alertUnhandledError);
};

const getConfigValue = (name: string): unknown | undefined =>
const getConfigValue = (name: string): unknown =>
xtState.xtGenerationState.configSpecification.configurationProperties.find(
(e) => e.name === name,
)?.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ const GenerationStringPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: PlainObject) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
// If there is no default value the string will be 'null'. We will treat it as an empty string
Expand Down Expand Up @@ -354,7 +354,7 @@ const GenerationIntegerPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: PlainObject) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
const defaultValue = JSON.parse(property.defaultValue) as
Expand Down Expand Up @@ -390,7 +390,7 @@ const GenerationBooleanPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: PlainObject) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
const defaultValue = JSON.parse(property.defaultValue) as
Expand All @@ -417,7 +417,7 @@ const GenerationEnumPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: PlainObject) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
const getEnumLabel = (_enum: string): string =>
Expand Down Expand Up @@ -464,7 +464,7 @@ const GenerationArrayPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: object) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
let defaultValue: string[] = [];
Expand Down Expand Up @@ -654,7 +654,7 @@ const GenerationMapPropertyEditor = observer(
property: GenerationProperty;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: object) => void;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
}) => {
const { property, getConfigValue, isReadOnly, update } = props;
// Right now, always assume this is a map between STRING and STRING (might need to support STRING - INTEGER and STRING - BOOLEAN)
Expand Down Expand Up @@ -884,7 +884,7 @@ const GenerationMapPropertyEditor = observer(
export const GenerationPropertyEditor = observer(
(props: {
property: GenerationProperty;
getConfigValue: (name: string) => unknown | undefined;
getConfigValue: (name: string) => unknown;
isReadOnly: boolean;
update: (property: GenerationProperty, newValue: object) => void;
}) => {
Expand Down Expand Up @@ -1039,7 +1039,7 @@ export const FileGenerationConfigurationEditor = observer(
[handleDrop],
);

const getConfigValue = (name: string): unknown | undefined =>
const getConfigValue = (name: string): unknown =>
getNullableFileGenerationConfig(fileGeneration, name)?.value;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SchemaSetModelGenerationEditor = observer(
const resetProperties = (): void => {
modelGenerationState.setConfigurationProperty([]);
};
const getConfigValue = (name: string): unknown | undefined =>
const getConfigValue = (name: string): unknown =>
modelGenerationState.getConfigValue(name);
const targetBindingPathValidationMessage =
Boolean(modelGenerationState.targetBinding) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const InstanceSetImplementationSourceExplorer = observer(
const [
sourceElementForSourceSelectorModal,
setSourceElementForSourceSelectorModal,
] = useState<MappingElementSource | undefined | null>();
] = useState<MappingElementSource>();
const CHANGING_SOURCE_ON_EMBEDDED =
'Changing source on mapping with embedded children will delete all its children';
const showSourceSelectorModal = (): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export interface MappingElementSourceSelectOption {
value: unknown;
}

export const getSourceElementLabel = (
srcElement: unknown | undefined,
): string => {
export const getSourceElementLabel = (srcElement: unknown): string => {
let sourceLabel = '(none)';
if (srcElement instanceof Class) {
sourceLabel = srcElement.name;
Expand All @@ -90,7 +88,7 @@ export const getSourceElementLabel = (

// TODO: add more visual cue to the type of source (class vs. flat-data vs. db)
export const buildMappingElementSourceOption = (
source: MappingElementSource | undefined,
source: MappingElementSource,
): MappingElementSourceSelectOption | null => {
if (source instanceof Class) {
return buildElementOption(source) as MappingElementSourceSelectOption;
Expand Down Expand Up @@ -120,7 +118,7 @@ export const InstanceSetImplementationSourceSelectorModal = observer(
* Pass in `null` when we want to open the modal using the existing source.
* Pass any other to open the source modal using that value as the initial state of the modal.
*/
sourceElementToSelect: MappingElementSource | null;
sourceElementToSelect: MappingElementSource;
closeModal: () => void;
}) => {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,11 @@ export const ProjectConfigurationEditor = observer(() => {
const dependencyToAdd = new ProjectDependency(
projectToAdd.coordinates,
);
const versions = (await flowResult(
editorStore.depotServerClient.getVersions(
projectToAdd.groupId,
projectToAdd.artifactId,
true,
),
)) as string[];
const versions = await editorStore.depotServerClient.getVersions(
projectToAdd.groupId,
projectToAdd.artifactId,
true,
);
configState.versions.set(dependencyToAdd.projectId, versions);
dependencyToAdd.setVersionId(versions[0] ?? '');
currentProjectConfiguration.addProjectDependency(dependencyToAdd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,17 +785,15 @@ const ProjectVersionDependencyEditor = observer(
if (val) {
try {
fetchSelectedProjectVersionsStatus.inProgress();
const v = (await flowResult(
editorStore.depotServerClient.getVersions(
guaranteeNonNullable(projectDependency.groupId),
guaranteeNonNullable(projectDependency.artifactId),
true,
),
)) as string[];
configState.versions.set(val.value.coordinates, v);
if (v.length) {
const _versions = await editorStore.depotServerClient.getVersions(
guaranteeNonNullable(projectDependency.groupId),
guaranteeNonNullable(projectDependency.artifactId),
true,
);
configState.versions.set(val.value.coordinates, _versions);
if (_versions.length) {
projectDependency.setVersionId(
guaranteeNonNullable(v[v.length - 1]),
guaranteeNonNullable(_versions[_versions.length - 1]),
);
flowResult(dependencyEditorState.fetchDependencyReport()).catch(
applicationStore.alertUnhandledError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
TEST_DATA__dependencyMainGraphEntities2,
TEST_DATA__projectsData,
} from './TEST_DATA__ProjectDependencyManager.js';
import { flowResult } from 'mobx';

const testDependingOnDifferentProjectVersions = [
{
Expand Down Expand Up @@ -443,9 +444,11 @@ test(
getClassProperty(firm, 'mainPerson');
getClassProperty(person, 'mainFirm');
// load association 1/2
await editorStore.graphState.loadEntityChangesToGraph(
[],
TEST_DATA__dependencyMainGraphEntities2 as Entity[],
await flowResult(
editorStore.graphState.loadEntityChangesToGraph(
[],
TEST_DATA__dependencyMainGraphEntities2 as Entity[],
),
);
expect(firm.propertiesFromAssociations.length).toBe(2);
expect(person.propertiesFromAssociations.length).toBe(2);
Expand All @@ -466,7 +469,7 @@ test(
getClassProperty(firm, 'mainPerson2');
getClassProperty(person, 'mainFirm2');
// clear current graph
await editorStore.graphState.loadEntityChangesToGraph([], []);
await flowResult(editorStore.graphState.loadEntityChangesToGraph([], []));
expect(editorStore.graphManagerState.graph.allOwnElements.length).toBe(0);
expect(firm.propertiesFromAssociations.length).toBe(0);
expect(person.propertiesFromAssociations.length).toBe(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class SchemaSetModelGenerationState {
this.targetBinding = val;
}

getConfigValue(name: string): unknown | undefined {
getConfigValue(name: string): unknown {
return this.getConfig(name)?.value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ export class DEPRECATED__MappingTestState extends MappingEditorTabState {
}

setInputDataStateBasedOnSource(
source: MappingElementSource | undefined,
source: MappingElementSource,
populateWithMockData: boolean,
): void {
if (source === undefined || source instanceof Class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const getMappingElementLabel = (
export const getMappingElementSource = (
mappingElement: MappingElement,
plugins: LegendStudioApplicationPlugin[],
): MappingElementSource | undefined => {
): MappingElementSource => {
if (mappingElement instanceof INTERNAL__UnknownSetImplementation) {
return undefined;
} else if (mappingElement instanceof OperationSetImplementation) {
Expand Down Expand Up @@ -941,7 +941,7 @@ export class MappingEditorState extends ElementEditorState {

*changeClassMappingSourceDriver(
setImplementation: InstanceSetImplementation,
newSource: MappingElementSource | undefined,
newSource: MappingElementSource,
): GeneratorFn<void> {
const currentSource = getMappingElementSource(
setImplementation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export class MappingExecutionState extends MappingEditorTabState {
}

setInputDataStateBasedOnSource(
source: unknown | undefined,
source: unknown,
populateWithMockData: boolean,
): void {
if (source instanceof Class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export const getTestableResultFromAssertionStatus = (
export const getTestableResultFromTestResults = (
testResults: (TestResult | undefined)[] | undefined,
): TESTABLE_RESULT => {
if (testResults === undefined || !testResults.length) {
if (!testResults?.length) {
return TESTABLE_RESULT.DID_NOT_RUN;
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type SetImplementationMappingElementLabelInfoBuilder = (

export type MappingElementSourceExtractor = (
mappingElement: MappingElement,
) => MappingElementSource | undefined;
) => MappingElementSource;

export type MappingElementStateCreator = (
mappingElement: MappingElement | undefined,
Expand Down Expand Up @@ -106,7 +106,7 @@ export type NewConnectionSnippetSuggestion = PureGrammarTextSuggestion;
*/
export type InstanceSetImplementationSourceUpdater = (
setImplementation: InstanceSetImplementation,
newSource: unknown | undefined,
newSource: unknown,
) => boolean;

export type MappingSourceTypeInfoGetter = (
Expand Down
2 changes: 2 additions & 0 deletions packages/legend-application/src/stores/terminal/XTerm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
IllegalStateError,
isMatchingKeyCombination,
LogEvent,
noop,
prettyCONSTName,
uniqBy,
} from '@finos/legend-shared';
Expand Down Expand Up @@ -338,6 +339,7 @@ export class XTerm extends Terminal {
command,
text,
)
.catch(noop())
.finally(() => {
this.isRunningCommand = false;
if (!this.isFlushed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export enum PERSISTENCE_HASH_STRUCTURE {

// auditing v2
AUDITING_DATE_TIME = 'AUDITING_DATE_TIME',
NO_AUDITING_V2 = 'NO_AUDITING',
NO_AUDITING_V2 = 'NO_AUDITING_V2',

// trigger
MANUAL_TRIGGER = 'MANUAL_TRIGGER',
Expand Down
Loading

0 comments on commit 255e78a

Please sign in to comment.