Skip to content

Commit 3637f00

Browse files
committed
refactor(code): all eslint stylistic rules activated
1 parent 9a80df8 commit 3637f00

File tree

141 files changed

+188
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+188
-170
lines changed

.eslintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
}
6868
],
6969
"extends": [
70+
"plugin:@stylistic/all-extends",
7071
"eslint:all",
7172
"plugin:@typescript-eslint/eslint-recommended",
7273
"plugin:@typescript-eslint/all",
@@ -79,6 +80,21 @@
7980
],
8081
"rules": {
8182
"no-new": "off",
83+
"@stylistic/block-spacing": "off",
84+
"@stylistic/padded-blocks": "off",
85+
"@stylistic/array-element-newline": "off",
86+
"@stylistic/function-call-argument-newline": "off",
87+
"@stylistic/arrow-parens": "off",
88+
"@stylistic/multiline-comment-style": "off",
89+
"@stylistic/object-property-newline": "off",
90+
"@stylistic/function-paren-newline": "off",
91+
"@stylistic/dot-location": "off",
92+
"@stylistic/space-before-function-paren": "off",
93+
"@stylistic/multiline-ternary": "off",
94+
"@stylistic/no-extra-parens": "off",
95+
"@stylistic/lines-around-comment": "off",
96+
"@stylistic/implicit-arrow-linebreak": "off",
97+
"@stylistic/quote-props": "off",
8298
"@typescript-eslint/consistent-type-exports": "off",
8399
"@typescript-eslint/prefer-readonly-parameter-types": "off",
84100
"@typescript-eslint/class-methods-use-this": "off",

src/api/binder/When.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
*/
2323
export type WhenType =
2424
/** The predicate will be executed at the end and will cancel the binding execution if not fulfilled. */
25-
"end" |
25+
"end" |
2626
/** The predicate will be executed at start/then/end without cancelling the binding execution. */
27-
"nonStrict" |
27+
"nonStrict" |
2828
/** The predicate will be executed at start/then/end and will cancel the binding execution if not fulfilled. */
29-
"strict" |
29+
"strict" |
3030
/** The predicate will be executed at start and will cancel the binding execution if not fulfilled. */
31-
"strictStart" |
31+
"strictStart" |
3232
/** The predicate will be executed at start and at each update and will cancel the binding execution if not fulfilled. */
33-
"strictThen" |
33+
"strictThen" |
3434
/** The predicate will be executed at start and at each update without cancelling the binding execution. */
35-
"then";
35+
"then";
3636

3737
/**
3838
* States whether the WhenType concerns the beginning of a binding execution (at start).

src/api/command/Command.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ export interface Command {
7373
*/
7474
export type CmdStatus =
7575
/** When the command has been cancelled. */
76-
"cancelled" |
76+
"cancelled" |
7777
/** When the command is created but not executed yet. */
78-
"created" |
78+
"created" |
7979
/** When the command has been marked as done. */
80-
"done" |
80+
"done" |
8181
/** When the command has been created and executed one time. */
82-
"executed" |
82+
"executed" |
8383
/** The command has been flushed. In this case, the command must not be used anymore. */
84-
"flushed";
84+
"flushed";

src/impl/binder/KeysBinder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class KeysBinder<C extends Command, I extends Interaction<D>, A, D extend
8282
}
8383

8484
return (this.keysOrCodes.length === 0 || this.keysOrCodes.length === currentKeys.length &&
85-
currentKeys.every((key: string) => this.keysOrCodes.includes(key)));
85+
currentKeys.every((key: string) => this.keysOrCodes.includes(key)));
8686
};
8787

8888
this.whenFnArray.push({

src/impl/checker/CheckerImpl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ export class CheckerImpl implements Checker {
9696
binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>,
9797
predicate: (b: Binding<Command, Interaction<object>, unknown>) => boolean, msg: string): void {
9898
if (severity !== "ignore" && !binding.isWhenDefined() &&
99-
binds
100-
.filter(currBinding => currBinding.linterRules.get(ruleName) !== "ignore" && !currBinding.isWhenDefined())
101-
.some(currBinding => predicate(currBinding) &&
102-
this.isWidgetSetsIntersecting(binding.interaction.registeredNodes, currBinding.interaction.registeredNodes))
99+
binds
100+
.filter(currBinding => currBinding.linterRules.get(ruleName) !== "ignore" && !currBinding.isWhenDefined())
101+
.some(currBinding => predicate(currBinding) &&
102+
this.isWidgetSetsIntersecting(binding.interaction.registeredNodes, currBinding.interaction.registeredNodes))
103103
) {
104104
this.printLinterMsg(severity, msg);
105105
}

src/impl/command/library/TransferArrayItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class TransferArrayItem<T> extends UndoableCommand {
7171

7272
public override canExecute(): boolean {
7373
return (this._srcIndex >= 0 && this._srcIndex < this._srcArray.length) &&
74-
(this._tgtIndex >= 0 && this._tgtIndex <= this._tgtArray.length);
74+
(this._tgtIndex >= 0 && this._tgtIndex <= this._tgtArray.length);
7575
}
7676

7777
public override getUndoName(): string {

src/impl/fsm/Events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function isHyperLink(target: EventTarget): target is HTMLAnchorElement {
106106
*/
107107
export function isTextInput(target: EventTarget): target is HTMLInputElement | HTMLTextAreaElement {
108108
return (target instanceof HTMLInputElement && target.getAttribute("type") === "text") ||
109-
target instanceof HTMLTextAreaElement;
109+
target instanceof HTMLTextAreaElement;
110110
}
111111

112112
/**

src/impl/fsm/FSMImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class FSMImpl implements FSM {
127127

128128
// Recycling events
129129
if (processed && isKeyDownEvent(event) && !(this._currentState instanceof InitState) &&
130-
!this.eventsToProcess.some(evt => isKeyDownEvent(evt) && evt.code === event.code)) {
130+
!this.eventsToProcess.some(evt => isKeyDownEvent(evt) && evt.code === event.code)) {
131131
this.addRemaningEventsToProcess(event);
132132
}
133133

src/impl/interaction/library/KeyDown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class KeyDownFSM extends FSMImpl {
3939

4040
new KeyTransition(this.initState, this.addTerminalState("pressed"), "keydown", action,
4141
(evt: KeyboardEvent): boolean => (key === undefined || key === evt.code) &&
42-
(this.modifiersAccepted || (!evt.altKey && !evt.ctrlKey && !evt.shiftKey && !evt.metaKey)));
42+
(this.modifiersAccepted || (!evt.altKey && !evt.ctrlKey && !evt.shiftKey && !evt.metaKey)));
4343
}
4444
}
4545

src/impl/interaction/library/Pans.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function hPan(logger: Logger, cancellable: boolean,
3131
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
3232
.firstAndThen(data => data.isHorizontal(pxTolerance))
3333
.end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&
34-
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
34+
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
3535
.name(hPan.name)
3636
.build();
3737
}
@@ -51,7 +51,7 @@ export function vPan(logger: Logger, cancellable: boolean,
5151
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
5252
.firstAndThen(data => data.isVertical(pxTolerance))
5353
.end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&
54-
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
54+
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
5555
.name(vPan.name)
5656
.build();
5757
}
@@ -71,7 +71,7 @@ export function leftPan(logger: Logger, cancellable: boolean,
7171
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
7272
.firstAndThen(data => data.isLeft(pxTolerance))
7373
.end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&
74-
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
74+
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
7575
.name(leftPan.name)
7676
.build();
7777
}
@@ -91,7 +91,7 @@ export function rightPan(logger: Logger, cancellable: boolean,
9191
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
9292
.firstAndThen(data => data.isRight(pxTolerance))
9393
.end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&
94-
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
94+
(minVelocity === undefined || data.velocity("horiz") >= minVelocity))
9595
.name(rightPan.name)
9696
.build();
9797
}
@@ -111,7 +111,7 @@ export function topPan(logger: Logger, cancellable: boolean,
111111
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
112112
.firstAndThen(data => data.isTop(pxTolerance))
113113
.end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&
114-
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
114+
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
115115
.name(topPan.name)
116116
.build();
117117
}
@@ -131,7 +131,7 @@ export function bottomPan(logger: Logger, cancellable: boolean,
131131
return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))
132132
.firstAndThen(data => data.isBottom(pxTolerance))
133133
.end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&
134-
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
134+
(minVelocity === undefined || data.velocity("vert") >= minVelocity))
135135
.name(bottomPan.name)
136136
.build();
137137
}

0 commit comments

Comments
 (0)