Skip to content

Commit

Permalink
eslint: Add whitespace rule for switch-case
Browse files Browse the repository at this point in the history
  • Loading branch information
harshadgavali committed Aug 15, 2021
1 parent d5110f8 commit c219199
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"rules": {
"indent": [
"error",
"tab"
"tab",
{
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
Expand Down Expand Up @@ -101,7 +104,7 @@
"no-unused-expressions": "off",
"no-mixed-spaces-and-tabs": "off",
"comma-dangle": "off",
"lines-between-class-members":"off"
"lines-between-class-members": "off"
}
},
{
Expand Down
28 changes: 14 additions & 14 deletions extension/src/swipeTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,20 @@ export const TouchpadSwipeGesture = GObject.registerClass({
const distance = vertical ? this.TOUCHPAD_BASE_HEIGHT : this.TOUCHPAD_BASE_WIDTH;

switch (gesturePhase) {
case Clutter.TouchpadGesturePhase.BEGIN:
case Clutter.TouchpadGesturePhase.UPDATE:
if (this._followNaturalScroll)
delta = -delta;

this.emit('update', time, delta, distance);
break;

case Clutter.TouchpadGesturePhase.END:
case Clutter.TouchpadGesturePhase.CANCEL:
this.emit('end', time, distance);
this._state = TouchpadState.NONE;
this._toggledDirection = false;
break;
case Clutter.TouchpadGesturePhase.BEGIN:
case Clutter.TouchpadGesturePhase.UPDATE:
if (this._followNaturalScroll)
delta = -delta;

this.emit('update', time, delta, distance);
break;

case Clutter.TouchpadGesturePhase.END:
case Clutter.TouchpadGesturePhase.CANCEL:
this.emit('end', time, distance);
this._state = TouchpadState.NONE;
this._toggledDirection = false;
break;
}

return this._state === TouchpadState.HANDLING
Expand Down
12 changes: 6 additions & 6 deletions extension/src/utils/dbus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ export function subscribe(callback: (actor: never | undefined, event: CustomEven
type: () => Clutter.EventType.TOUCHPAD_SWIPE,
get_gesture_phase: () => {
switch (sphase) {
case 'Begin':
return Clutter.TouchpadGesturePhase.BEGIN;
case 'Update':
return Clutter.TouchpadGesturePhase.UPDATE;
default:
return Clutter.TouchpadGesturePhase.END;
case 'Begin':
return Clutter.TouchpadGesturePhase.BEGIN;
case 'Update':
return Clutter.TouchpadGesturePhase.UPDATE;
default:
return Clutter.TouchpadGesturePhase.END;
}
},
get_touchpad_gesture_finger_count: () => fingers,
Expand Down
16 changes: 8 additions & 8 deletions scripts/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ const transformExports: ts.TransformerFactory<ts.SourceFile> = context => {
const variables: string[] = [];
const visitor = (node: ts.Node): ts.Node => {
switch (node.kind) {
case ts.SyntaxKind.ClassDeclaration:
return transformClass(node as ts.ClassDeclaration, variables);
case ts.SyntaxKind.FunctionDeclaration:
return tranformFunction(node as ts.FunctionDeclaration, variables);
case ts.SyntaxKind.VariableStatement:
return tranformVariable(node as ts.VariableStatement, variables);
default:
return node;
case ts.SyntaxKind.ClassDeclaration:
return transformClass(node as ts.ClassDeclaration, variables);
case ts.SyntaxKind.FunctionDeclaration:
return tranformFunction(node as ts.FunctionDeclaration, variables);
case ts.SyntaxKind.VariableStatement:
return tranformVariable(node as ts.VariableStatement, variables);
default:
return node;
}
};
const modifiedSourceFile = ts.visitEachChild(sourceFile, visitor, context);
Expand Down

0 comments on commit c219199

Please sign in to comment.