Skip to content

Commit

Permalink
chore: 🤖 fix build and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiklor committed Sep 27, 2020
1 parent 62c4d29 commit 23c65a5
Show file tree
Hide file tree
Showing 54 changed files with 194 additions and 143 deletions.
33 changes: 25 additions & 8 deletions common/config/eslint/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"extends": [
"eslint:all",
"plugin:@typescript-eslint/all",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jest/all",
"plugin:node/recommended",
Expand All @@ -32,11 +34,6 @@
"promise",
"standard"
],
"settings": {
"jest": {
"version": 26
}
},
"rules": {
"@typescript-eslint/indent": [
"error",
Expand All @@ -45,6 +42,18 @@
"@typescript-eslint/no-magic-numbers": [
"off"
],
"@typescript-eslint/no-shadow": [
"off"
],
"no-duplicate-imports": [
"off"
],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true
}
],
"@typescript-eslint/no-type-alias": [
"error",
{
Expand Down Expand Up @@ -134,6 +143,10 @@
]
}
],
"@typescript-eslint/quotes": [
"error",
"single"
],
"node/no-unsupported-features/es-syntax": [
"error",
{
Expand Down Expand Up @@ -161,10 +174,14 @@
"*.js"
],
"rules": {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/quotes": "off"
"@typescript-eslint/no-unsafe-assignment": "off"
}
}
]
],
"settings": {
"jest": {
"version": 26
}
}
}
21 changes: 15 additions & 6 deletions src/animations/kittik-animation-basic/src/animation/Animation.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as EASING from '../easing/Easing';
import { AnimationObject } from './AnimationObject';
import { AnimationOptions } from './AnimationOptions';
import { AnimationPropertyOptions } from './AnimationPropertyOptions';
import { EasingOptions } from '../easing/EasingOptions';
import type { AnimationObject } from './AnimationObject';
import type { AnimationOptions } from './AnimationOptions';
import type { AnimationPropertyOptions } from './AnimationPropertyOptions';
import type { EasingOptions } from '../easing/EasingOptions';
import { EventEmitter } from 'events';
import { Shape } from 'kittik-shape-basic';
import type { Shape } from 'kittik-shape-basic';

export { Animationable } from './Animationable';
export { AnimationObject } from './AnimationObject';
Expand Down Expand Up @@ -36,8 +36,8 @@ export declare interface Animation {
}

export class Animation extends EventEmitter implements AnimationOptions {
public duration = 1000;
public easing: EASING.Easing = 'outQuad';
protected rawDuration = 1000;

public constructor (options?: Partial<AnimationOptions>) {
super();
Expand Down Expand Up @@ -77,6 +77,14 @@ export class Animation extends EventEmitter implements AnimationOptions {
return this.fromObject(JSON.parse(json));
}

public get duration (): number {
return this.rawDuration;
}

public set duration (duration: number) {
this.rawDuration = duration;
}

// We need to have a possibility to override onTick in children
// Moreover, in case overridden method wants to use its `this` we need to have it here
// Even if we do not use `this` in this specific implementation, someone else can
Expand All @@ -89,6 +97,7 @@ export class Animation extends EventEmitter implements AnimationOptions {
// Someone else can override it in children and make use of `this` in his own class
// eslint-disable-next-line class-methods-use-this
public onEasing (easing: EASING.Easing, options: EasingOptions): number {
// eslint-disable-next-line import/namespace
return Math.round(EASING[easing](options.time, options.startValue, options.byValue, options.duration));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationOptions } from './AnimationOptions';
import type { AnimationOptions } from './AnimationOptions';

export interface AnimationObject<T, O extends Partial<AnimationOptions>> {
type: T
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Easing } from '../easing/Easing';
import type { Easing } from '../easing/Easing';

export interface AnimationOptions {
duration: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnimationOptions } from './AnimationOptions';
import { Shape } from 'kittik-shape-basic';
import type { AnimationOptions } from './AnimationOptions';
import type { Shape } from 'kittik-shape-basic';

export interface AnimationPropertyOptions<S extends Shape, P extends keyof S> extends Partial<AnimationOptions> {
shape: S
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Animation } from './Animation';
import { Shape } from 'kittik-shape-basic';
import type { Animation } from './Animation';
import type { Shape } from 'kittik-shape-basic';

export interface Animationable extends Animation {
animate: <T extends Shape>(shape: T) => Promise<T>
Expand Down
2 changes: 1 addition & 1 deletion src/animations/kittik-animation-focus/spec/Focus.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Focus } from '../src/Focus';
import { FocusObject } from '../src/FocusObject';
import type { FocusObject } from '../src/FocusObject';
import { Shape } from 'kittik-shape-basic';

describe('focus animation', () => {
Expand Down
10 changes: 5 additions & 5 deletions src/animations/kittik-animation-focus/src/Focus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Animation, Animationable } from 'kittik-animation-basic';
import { BounceDirection, Direction, FocusOptions, ShakeDirection } from './FocusOptions';
import { FocusObject } from './FocusObject';
import { Shape } from 'kittik-shape-basic';
import { Animation } from 'kittik-animation-basic';
import type { Animationable } from 'kittik-animation-basic';
import type { BounceDirection, Direction, FocusOptions, ShakeDirection } from './FocusOptions';
import type { FocusObject } from './FocusObject';
import type { Shape } from 'kittik-shape-basic';

export { FocusObject } from './FocusObject';
export { FocusOptions, Direction, BounceDirection, ShakeDirection } from './FocusOptions';
Expand All @@ -10,7 +11,6 @@ export class Focus extends Animation implements FocusOptions, Animationable {
public direction: Direction = 'shakeX';
public offset = 5;
public repeat = 1;
private rawDuration = 1000;

public constructor (options?: Partial<FocusOptions>) {
super(options);
Expand Down
4 changes: 2 additions & 2 deletions src/animations/kittik-animation-focus/src/FocusObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationObject } from 'kittik-animation-basic';
import { FocusOptions } from './FocusOptions';
import type { AnimationObject } from 'kittik-animation-basic';
import type { FocusOptions } from './FocusOptions';

export type FocusObject = AnimationObject<'Focus', FocusOptions>;
2 changes: 1 addition & 1 deletion src/animations/kittik-animation-focus/src/FocusOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationOptions } from 'kittik-animation-basic';
import type { AnimationOptions } from 'kittik-animation-basic';

export type BounceDirection = 'bounceUp' | 'bounceRight' | 'bounceDown' | 'bounceLeft';
export type ShakeDirection = 'shakeX' | 'shakeY';
Expand Down
9 changes: 5 additions & 4 deletions src/animations/kittik-animation-print/src/Print.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Animation, Animationable } from 'kittik-animation-basic';
import { PrintObject } from './PrintObject';
import { PrintOptions } from './PrintOptions';
import { Shape } from 'kittik-shape-basic';
import type { Animationable } from 'kittik-animation-basic';
import { Animation } from 'kittik-animation-basic';
import type { PrintObject } from './PrintObject';
import type { PrintOptions } from './PrintOptions';
import type { Shape } from 'kittik-shape-basic';

export { PrintObject } from './PrintObject';
export { PrintOptions } from './PrintOptions';
Expand Down
4 changes: 2 additions & 2 deletions src/animations/kittik-animation-print/src/PrintObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationObject } from 'kittik-animation-basic';
import { PrintOptions } from './PrintOptions';
import type { AnimationObject } from 'kittik-animation-basic';
import type { PrintOptions } from './PrintOptions';

export type PrintObject = AnimationObject<'Print', PrintOptions>;
2 changes: 1 addition & 1 deletion src/animations/kittik-animation-print/src/PrintOptions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { AnimationOptions } from 'kittik-animation-basic';
import type { AnimationOptions } from 'kittik-animation-basic';

export type PrintOptions = AnimationOptions;
3 changes: 2 additions & 1 deletion src/animations/kittik-animation-slide/spec/Slide.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Slide, SlideOptions } from '../src/Slide';
import type { SlideOptions } from '../src/Slide';
import { Slide } from '../src/Slide';
import { Canvas } from 'terminal-canvas';
import { Rectangle } from 'kittik-shape-rectangle';

Expand Down
9 changes: 5 additions & 4 deletions src/animations/kittik-animation-slide/src/Slide.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Animation, Animationable } from 'kittik-animation-basic';
import { Direction, SlideOptions } from './SlideOptions';
import { Shape } from 'kittik-shape-basic';
import { SlideObject } from './SlideObject';
import type { Animationable } from 'kittik-animation-basic';
import { Animation } from 'kittik-animation-basic';
import type { Direction, SlideOptions } from './SlideOptions';
import type { Shape } from 'kittik-shape-basic';
import type { SlideObject } from './SlideObject';

export { SlideObject } from './SlideObject';
export { SlideOptions, Direction } from './SlideOptions';
Expand Down
4 changes: 2 additions & 2 deletions src/animations/kittik-animation-slide/src/SlideObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationObject } from 'kittik-animation-basic';
import { SlideOptions } from './SlideOptions';
import type { AnimationObject } from 'kittik-animation-basic';
import type { SlideOptions } from './SlideOptions';

export type SlideObject = AnimationObject<'Slide', SlideOptions>;
2 changes: 1 addition & 1 deletion src/animations/kittik-animation-slide/src/SlideOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationOptions } from 'kittik-animation-basic';
import type { AnimationOptions } from 'kittik-animation-basic';

export type Direction = 'inUp' | 'inDown' | 'inLeft' | 'inRight' | 'outUp' | 'outDown' | 'outLeft' | 'outRight';

Expand Down
6 changes: 3 additions & 3 deletions src/main/kittik-deck/examples/declaration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Deck } from '..';
import { FigTextOptions } from 'kittik-shape-fig-text';
import { FocusOptions } from 'kittik-animation-focus';
import { SlideOptions } from 'kittik-animation-slide';
import type { FigTextOptions } from 'kittik-shape-fig-text';
import type { FocusOptions } from 'kittik-animation-focus';
import type { SlideOptions } from 'kittik-animation-slide';

const AsciiArtShapeOptions: Partial<FigTextOptions> = {
text: 'ASCII ART',
Expand Down
8 changes: 5 additions & 3 deletions src/main/kittik-deck/spec/Deck.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Deck, DeckDeclaration } from '../src/Deck';
import { Shape, ShapeRenderable } from 'kittik-shape-basic';
import { Animationable } from 'kittik-animation-basic';
import type { DeckDeclaration } from '../src/Deck';
import { Deck } from '../src/Deck';
import type { ShapeRenderable } from 'kittik-shape-basic';
import { Shape } from 'kittik-shape-basic';
import type { Animationable } from 'kittik-animation-basic';
import { Canvas } from 'terminal-canvas';
import { Print } from 'kittik-animation-print';
import { Slide } from 'kittik-slide';
Expand Down
6 changes: 3 additions & 3 deletions src/main/kittik-deck/src/Deck.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Animationable } from 'kittik-animation-basic';
import type { Animationable } from 'kittik-animation-basic';
import { Canvas } from 'terminal-canvas';
import { DeckDeclaration } from './DeckDeclaration';
import type { DeckDeclaration } from './DeckDeclaration';
import { EventEmitter } from 'events';
import { ShapeRenderable } from 'kittik-shape-basic';
import type { ShapeRenderable } from 'kittik-shape-basic';
import { Slide } from 'kittik-slide';
import readline from 'readline';
import tty from 'tty';
Expand Down
9 changes: 5 additions & 4 deletions src/main/kittik-deck/src/DeckBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Slide, SlideBuilder } from 'kittik-slide';
import { Animationable } from 'kittik-animation-basic';
import { Canvas } from 'terminal-canvas';
import type { Slide } from 'kittik-slide';
import { SlideBuilder } from 'kittik-slide';
import type { Animationable } from 'kittik-animation-basic';
import type { Canvas } from 'terminal-canvas';
import { Deck } from './Deck';
import { ShapeRenderable } from 'kittik-shape-basic';
import type { ShapeRenderable } from 'kittik-shape-basic';

export class DeckBuilder<TShape extends string, TAnimation extends string> {
private readonly deck: Deck = new Deck();
Expand Down
2 changes: 1 addition & 1 deletion src/main/kittik-deck/src/DeckDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationDeclaration, ShapeDeclaration, SlideDeclaration } from 'kittik-slide';
import type { AnimationDeclaration, ShapeDeclaration, SlideDeclaration } from 'kittik-slide';

export interface DeckDeclaration {
shapes?: ShapeDeclaration[]
Expand Down
6 changes: 3 additions & 3 deletions src/main/kittik-slide/examples/declaration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AnimationDeclaration } from '../src/animation/AnimationDeclaration';
import type { AnimationDeclaration } from '../src/animation/AnimationDeclaration';
import { Canvas } from 'terminal-canvas';
import { ShapeDeclaration } from '../src/shape/ShapeDeclaration';
import type { ShapeDeclaration } from '../src/shape/ShapeDeclaration';
import { Slide } from '..';
import { SlideOptions } from 'kittik-animation-slide';
import type { SlideOptions } from 'kittik-animation-slide';

const canvas = Canvas
.create()
Expand Down
11 changes: 6 additions & 5 deletions src/main/kittik-slide/spec/Slide.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Text, TextObject } from 'kittik-shape-text';
import { AnimationDeclaration } from '../src/animation/AnimationDeclaration';
import type { TextObject } from 'kittik-shape-text';
import { Text } from 'kittik-shape-text';
import type { AnimationDeclaration } from '../src/animation/AnimationDeclaration';
import { Canvas } from 'terminal-canvas';
import { OrderDeclaration } from '../src/slide/OrderDeclaration';
import type { OrderDeclaration } from '../src/slide/OrderDeclaration';
import { Print } from 'kittik-animation-print';
import { ShapeDeclaration } from '../src/shape/ShapeDeclaration';
import type { ShapeDeclaration } from '../src/shape/ShapeDeclaration';
import { Slide } from '../src/slide/Slide';
import { SlideDeclaration } from '../src/slide/SlideDeclaration';
import type { SlideDeclaration } from '../src/slide/SlideDeclaration';

const SLIDE_DECLARATION: SlideDeclaration = {
name: 'Testing Slide',
Expand Down
5 changes: 3 additions & 2 deletions src/main/kittik-slide/src/animation/AnimationBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ANIMATIONS, AnimationOptions, AnimationType } from './Animations';
import { AnimationObject, Animationable } from 'kittik-animation-basic';
import type { AnimationOptions, AnimationType } from './Animations';
import { ANIMATIONS } from './Animations';
import type { AnimationObject, Animationable } from 'kittik-animation-basic';

export class AnimationBuilder<T extends AnimationType, O extends AnimationOptions<T>> implements AnimationObject<T, O> {
public type: T;
Expand Down
4 changes: 2 additions & 2 deletions src/main/kittik-slide/src/animation/AnimationDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnimationOptions, AnimationType } from './Animations';
import { AnimationObject } from 'kittik-animation-basic';
import type { AnimationOptions, AnimationType } from './Animations';
import type { AnimationObject } from 'kittik-animation-basic';

export interface AnimationDeclaration extends AnimationObject<AnimationType, Partial<AnimationOptions<AnimationType>>> {
name: string
Expand Down
11 changes: 7 additions & 4 deletions src/main/kittik-slide/src/animation/Animations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Focus, FocusObject, FocusOptions } from 'kittik-animation-focus';
import { Print, PrintObject, PrintOptions } from 'kittik-animation-print';
import { Slide, SlideObject, SlideOptions } from 'kittik-animation-slide';
import { Animation } from 'kittik-animation-basic';
import type { FocusObject, FocusOptions } from 'kittik-animation-focus';
import { Focus } from 'kittik-animation-focus';
import type { PrintObject, PrintOptions } from 'kittik-animation-print';
import { Print } from 'kittik-animation-print';
import type { SlideObject, SlideOptions } from 'kittik-animation-slide';
import { Slide } from 'kittik-animation-slide';
import type { Animation } from 'kittik-animation-basic';

export type AnimationType = 'Focus' | 'Print' | 'Slide';
export type AnimationOptions<T extends AnimationType> = TypesMap[T]['options'];
Expand Down
5 changes: 3 additions & 2 deletions src/main/kittik-slide/src/shape/ShapeBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SHAPES, ShapeOptions, ShapeType } from './Shapes';
import { ShapeObject, ShapeRenderable } from 'kittik-shape-basic';
import type { ShapeOptions, ShapeType } from './Shapes';
import { SHAPES } from './Shapes';
import type { ShapeObject, ShapeRenderable } from 'kittik-shape-basic';

export class ShapeBuilder<T extends ShapeType, O extends ShapeOptions<T>> implements ShapeObject<T, O> {
public type: T;
Expand Down
4 changes: 2 additions & 2 deletions src/main/kittik-slide/src/shape/ShapeDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ShapeOptions, ShapeType } from './Shapes';
import { ShapeObject } from 'kittik-shape-basic';
import type { ShapeOptions, ShapeType } from './Shapes';
import type { ShapeObject } from 'kittik-shape-basic';

export interface ShapeDeclaration extends ShapeObject<ShapeType, Partial<ShapeOptions<ShapeType>>> {
name: string
Expand Down
17 changes: 11 additions & 6 deletions src/main/kittik-slide/src/shape/Shapes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Code, CodeObject, CodeOptions } from 'kittik-shape-code';
import { FigText, FigTextObject, FigTextOptions } from 'kittik-shape-fig-text';
import { Image, ImageObject, ImageOptions } from 'kittik-shape-image';
import { Rectangle, RectangleObject, RectangleOptions } from 'kittik-shape-rectangle';
import { Text, TextObject, TextOptions } from 'kittik-shape-text';
import { Shape } from 'kittik-shape-basic';
import { Code } from 'kittik-shape-code';
import { FigText } from 'kittik-shape-fig-text';
import { Image } from 'kittik-shape-image';
import { Rectangle } from 'kittik-shape-rectangle';
import { Text } from 'kittik-shape-text';
import type { CodeObject, CodeOptions } from 'kittik-shape-code';
import type { FigTextObject, FigTextOptions } from 'kittik-shape-fig-text';
import type { ImageObject, ImageOptions } from 'kittik-shape-image';
import type { RectangleObject, RectangleOptions } from 'kittik-shape-rectangle';
import type { Shape } from 'kittik-shape-basic';
import type { TextObject, TextOptions } from 'kittik-shape-text';

export type ShapeType = 'Code' | 'FigText' | 'Image' | 'Rectangle' | 'Text';
export type ShapeOptions<T extends ShapeType> = TypesMap[T]['options'];
Expand Down
Loading

0 comments on commit 23c65a5

Please sign in to comment.