Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reinforce linter #1320

Merged
merged 9 commits into from
Dec 19, 2023
24 changes: 1 addition & 23 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@
"key-spacing": "off",
"linebreak-style": "off",
"max-classes-per-file": "off",
"max-len": [
"off",
120
],
"new-parens": "off",
"no-confusing-arrow": "off",
"no-case-declarations": "warn",
Expand All @@ -105,16 +101,13 @@
"no-restricted-properties": "off",
"no-restricted-syntax": "off",
"no-return-assign": "off",
"no-trailing-spaces": "off",
"no-undef": "off",
"no-undef-init": "off",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "off",
"no-unreachable": "off",
"no-unsafe-optional-chaining": "off",
"no-unused-vars": "off",
"no-useless-rename": "off",
"no-useless-return": "off",
"no-useless-escape": "warn",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
Expand All @@ -128,13 +121,9 @@
"prefer-template": "off",
"prefer-destructuring": "off",
"radix": "off",
"space-in-parens": "off",
"spaced-comment": "off",
"semi-spacing": "off",
"simple-import-sort/exports": "off",
"space-unary-ops": "off",
// eslint-plugin-unused-imports rules
"unused-imports/no-unused-imports": "off",
"unused-imports/no-unused-vars": [
"off",
{
Expand All @@ -149,14 +138,8 @@
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/comma-spacing": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/keyword-spacing": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/quotes": [
"off",
"single"
],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off",
Expand All @@ -165,12 +148,7 @@
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/object-curly-spacing": "off",
"@typescript-eslint/semi": "off",
"@typescript-eslint/space-before-blocks": "off",
"@typescript-eslint/space-infix-ops": "off"
"@typescript-eslint/no-use-before-define": "off"
},
"parserOptions": {
"project": "./tsconfig.eslint.json"
Expand Down
6 changes: 3 additions & 3 deletions apps/dateAdapter/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Learn more in https://angular.io/guide/browser-support
*/

/***************************************************************************************************
/** *************************************************************************************************
* BROWSER POLYFILLS
*/

Expand Down Expand Up @@ -42,11 +42,11 @@
*
*/

/***************************************************************************************************
/** *************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.

/***************************************************************************************************
/** *************************************************************************************************
* APPLICATION IMPORTS
*/
1 change: 0 additions & 1 deletion apps/dsp-app/src/app/main/action/hint/hint.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class HintComponent implements OnInit {
<code class="">Example: <i>"Lorem ipsum"</i> will find texts with exact content <i>Lorem ipsum</i></code>
</li>
</ul>`;
break;
default:
return `There's no hint implemented for the topic <strong>${topic}<strong>.`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export abstract class BaseValueDirective implements OnInit, OnDestroy {
*/
abstract customValidators: ValidatorFn[];

protected constructor(protected _fb?: FormBuilder) {}
constructor(protected _fb?: FormBuilder) {}

ngOnInit() {
// initialize form control elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,12 @@ export class DataModelsComponent extends ProjectBase implements OnInit {
this._router.navigate([route, encodeURIComponent(listName)], {
relativeTo: this._route.parent,
});
return;
} else if (route === 'docs') {
// route to the external docs
window.open(
'https://docs.dasch.swiss/latest/DSP-APP/user-guide/project/#data-model',
'_blank'
);
return;
} else {
// default routing
this._router.navigate([route], { relativeTo: this._route.parent });
Expand Down
8 changes: 4 additions & 4 deletions apps/dsp-app/src/app/project/ontology/ontology.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ export class OntologyComponent
this.initProjectOntologies(project);
});

//TODO temporary solution to replace eventemitter with subject because emitter loses subscriber after child component
//subscription responsible for emitting event is triggered
// TODO temporary solution to replace eventemitter with subject because emitter loses subscriber after child component
// subscription responsible for emitting event is triggered
this.updatePropertyAssignment$
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(() => {
Expand Down Expand Up @@ -282,7 +282,7 @@ export class OntologyComponent

// set the page title
this.setTitle();
//this.initOntologiesList();
// this.initOntologiesList();

this.ontologyForm = this._fb.group({
ontology: new UntypedFormControl({
Expand Down Expand Up @@ -443,7 +443,7 @@ export class OntologyComponent
const ontology = this._store.selectSnapshot(
OntologiesSelectors.currentOntology
);
//TODO reload or just update lastModificationDate in the state?
// TODO reload or just update lastModificationDate in the state?
this._store.dispatch(
new LoadOntologyAction(ontology.id, this.projectUuid, true)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,6 @@ export class PropertyFormComponent implements OnInit, OnDestroy {
if (!this.resClassIri && !!this.propertyInfo.propDef) {
// in properties context and with an existing property
this.editMode = 'editProperty';
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
property: DefaultClass,
currentOntologyPropertiesToDisplay: PropToDisplay[]
) {
//TODO temporary solution to replace eventemitter with subject because emitter loses subscriber after following subscription is triggered
// TODO temporary solution to replace eventemitter with subject because emitter loses subscriber after following subscription is triggered
this.updatePropertyAssignment
.pipe(take(1))
.subscribe(() => this.updatePropertyAssignment$.next());
Expand All @@ -386,8 +386,8 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
.pipe(ofActionSuccessful(RemovePropertyAction))
.pipe(take(1))
.subscribe(res => {
//TODO should be the same as ontology lastModificationDate ? if yes remove commented line, otherwise add additional lastModificationDate property to the state
//this.lastModificationDate = res.lastModificationDate;
// TODO should be the same as ontology lastModificationDate ? if yes remove commented line, otherwise add additional lastModificationDate property to the state
// this.lastModificationDate = res.lastModificationDate;
this.updatePropertyAssignment.emit(this.ontology.id);
});
}
Expand All @@ -396,7 +396,7 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
* assignProperty: Open the dialogue in order to add an existing property to a class or to create a new
* property and add it to the class
* @param propertyAssignment information about the link of a property to a class
**/
* */
assignProperty(
propertyAssignment: PropertyAssignment,
currentOntologyPropertiesToDisplay: PropToDisplay[]
Expand Down Expand Up @@ -451,7 +451,7 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
* changeCardinalities: Open the dialogue in order to change the currentCardinality of an existing property and
* class combination
* @param cardRequest information about the property, its type and its new cardinalities to be set
**/
* */
changeCardinalities(
cardRequest: {
prop: PropToDisplay;
Expand Down Expand Up @@ -486,7 +486,7 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
/**
* openEditDialog: Open the dialogue in order assign a property or change cardinalities
* @param dialogConfig the MatDialogConfig
**/
* */
openEditDialog(dialogConfig: MatDialogConfig) {
const dialogRef = this._dialog.open(DialogComponent, dialogConfig);

Expand All @@ -507,7 +507,7 @@ export class ResourceClassInfoComponent implements OnInit, OnDestroy {
) {
// set sort order for child component
moveItemInArray(
currentOntologyPropertiesToDisplay, //TODO items should be updated in state if LoadProjectOntologiesAction is not executed after this
currentOntologyPropertiesToDisplay, // TODO items should be updated in state if LoadProjectOntologiesAction is not executed after this
event.previousIndex,
event.currentIndex
);
Expand Down
4 changes: 2 additions & 2 deletions apps/dsp-app/src/app/project/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ProjectBase implements OnInit, OnDestroy {
destroyed: Subject<void> = new Subject<void>();

projectUuid: string;
project: ReadProject; //TODO use project$ instead
project: ReadProject; // TODO use project$ instead

// permissions of logged-in user
get isAdmin$(): Observable<boolean> {
Expand Down Expand Up @@ -96,7 +96,7 @@ export class ProjectBase implements OnInit, OnDestroy {
}

ngOnDestroy(): void {
//this._store.dispatch([new ClearCurrentProjectAction(), new ClearProjectOntologiesAction(this.projectUuid)]);
// this._store.dispatch([new ClearCurrentProjectAction(), new ClearProjectOntologiesAction(this.projectUuid)]);
this.destroyed.next();
this.destroyed.complete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class ProjectsListComponent implements OnInit, OnDestroy {
deactivateProject(id: string) {
this._projectApiService.delete(id).pipe(
tap(() => {
this.refreshParent.emit(); //TODO Soft or Hard refresh ?
this.refreshParent.emit(); // TODO Soft or Hard refresh ?
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class TextValueHtmlLinkDirective {
this.internalLinkClicked.emit(targetElement.href);
// prevent the default action for internal links
event.preventDefault();
return;
} else {
// left mouse clicks on external links
// open in a new tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ export class AvTimelineComponent implements OnChanges {

if (this.timelineDimension?.width !== newDimension.width) {
return newDimension;
} else {
return;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,17 @@ export class StillImageComponent
}

ngOnChanges(changes: SimpleChanges) {
if (changes['images'] && changes['images'].isFirstChange()) {
if (changes.images && changes.images.isFirstChange()) {
this._setupViewer();
this.loadImages();
}
// only if the image changed
if (
changes['images'] &&
changes['images'].previousValue &&
changes['images'].currentValue &&
changes['images'].currentValue[0].fileValue.fileUrl !==
changes['images'].previousValue[0].fileValue.fileUrl
changes.images &&
changes.images.previousValue &&
changes.images.currentValue &&
changes.images.currentValue[0].fileValue.fileUrl !==
changes.images.previousValue[0].fileValue.fileUrl
) {
this.loadImages();
}
Expand All @@ -219,7 +219,7 @@ export class StillImageComponent
if (this.activateRegion !== undefined) {
this._highlightRegion(this.activateRegion);
}
if (changes['activateRegion']) {
if (changes.activateRegion) {
this._unhighlightAllRegions();
}
}
Expand Down Expand Up @@ -255,8 +255,8 @@ export class StillImageComponent
this.images[0].fileValue.filename
)
.subscribe(
res => {
this.originalFilename = res['originalFilename'];
(res: { originalFilename: string }) => {
this.originalFilename = res.originalFilename;
this._openImages();
this._unhighlightAllRegions();
},
Expand Down Expand Up @@ -493,8 +493,8 @@ export class StillImageComponent
this.images[0].fileValue.fileUrl,
this.images[0].fileValue.filename
)
.subscribe(res => {
this.originalFilename = res['originalFilename'];
.subscribe((res: { originalFilename: string }) => {
this.originalFilename = res.originalFilename;
});
},
(error: ApiResponseError) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/dsp-app/src/app/workspace/resource/resource.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ export class ResourceComponent implements OnChanges, OnDestroy {
private _cdr: ChangeDetectorRef
) {
this._route.params.subscribe(params => {
this.projectCode = params['project'];
this.resourceUuid = params['resource'];
this.valueUuid = params['value'];
this.projectCode = params.project;
this.resourceUuid = params.resource;
this.valueUuid = params.value;
if (this.projectCode && this.resourceUuid) {
this.resourceIri = this._resourceService.getResourceIri(
this.projectCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export class TextValueAsHtmlComponent
htmlFromKnora: string;
comment: string;

constructor() {
super();
}

ngOnInit() {
this.htmlFromKnora = this.getInitValue();
this.comment = this.getInitComment();
Expand Down
10 changes: 5 additions & 5 deletions apps/dsp-app/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* Learn more in https://angular.io/guide/browser-support
*/

/***************************************************************************************************
/** *************************************************************************************************
* BROWSER POLYFILLS
*/

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
/** IE9, IE10 and IE11 requires all of the following polyfills. * */
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
Expand All @@ -38,7 +38,7 @@
* If the application will be indexed by Google Search, the following is required.
* Googlebot uses a renderer based on Chrome 41.
* https://developers.google.com/search/docs/guides/rendering
**/
* */
// import 'core-js/es6/array';

/** IE10 and IE11 requires the following for the Reflect API. */
Expand All @@ -59,12 +59,12 @@
*/
// (window as any).__Zone_enable_cross_context_check = true;

/***************************************************************************************************
/** *************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // included with Angular CLI.

/***************************************************************************************************
/** *************************************************************************************************
* APPLICATION IMPORTS
*/
(window as any).global = window;
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,4 @@
/**
* Represents an error that occurred when using `JDNConvertibleCalendarModule`.
*/
export class JDNConvertibleCalendarError extends Error {
/**
*
* @param message description of the error.
*/
constructor(message: string) {
super(message);
}
}
export class JDNConvertibleCalendarError extends Error {}