chore: lint

This commit is contained in:
cha0s 2023-11-26 12:32:27 -06:00
parent 749e42743e
commit ddc1b55a79
15 changed files with 26 additions and 24 deletions

View File

@ -8,12 +8,12 @@ export default ([h, s, v]) => {
const q = v * (1 - f * s); const q = v * (1 - f * s);
const t = v * (1 - (1 - f) * s); const t = v * (1 - (1 - f) * s);
switch (i % 6) { switch (i % 6) {
default: [r, g, b] = [v, t, p]; break;
case 1: [r, g, b] = [q, v, p]; break; case 1: [r, g, b] = [q, v, p]; break;
case 2: [r, g, b] = [p, v, t]; break; case 2: [r, g, b] = [p, v, t]; break;
case 3: [r, g, b] = [p, q, v]; break; case 3: [r, g, b] = [p, q, v]; break;
case 4: [r, g, b] = [t, p, v]; break; case 4: [r, g, b] = [t, p, v]; break;
case 5: [r, g, b] = [v, p, q]; break; case 5: [r, g, b] = [v, p, q]; break;
default: [r, g, b] = [v, t, p]; break;
} }
return [ return [
Math.round(r * 255), Math.round(r * 255),

View File

@ -1,8 +1,7 @@
import {Trait} from '@avocado/traits'; import {Trait} from '@avocado/traits';
import {compose} from '@flecks/core'; import {compose} from '@flecks/core';
const decorate = compose( const decorate = compose();
);
export default () => class Perishable extends decorate(Trait) { export default () => class Perishable extends decorate(Trait) {

View File

@ -2,8 +2,7 @@ import {Vector} from '@avocado/math';
import {Trait} from '@avocado/traits'; import {Trait} from '@avocado/traits';
import {compose} from '@flecks/core'; import {compose} from '@flecks/core';
const decorate = compose( const decorate = compose();
);
export default () => class Positioned extends decorate(Trait) { export default () => class Positioned extends decorate(Trait) {

View File

@ -46,10 +46,12 @@ it('can add traits asynchronously', async () => {
const DELAY = 30; const DELAY = 30;
class AsyncTrait extends Trait { class AsyncTrait extends Trait {
static async extendJson(json) { static async load(...args) {
const extended = await super.extendJson(json); const loaded = await super.load(...args);
await new Promise((resolve) => setTimeout(resolve, DELAY)); await new Promise((resolve) => {
return extended; setTimeout(resolve, DELAY);
});
return loaded;
} }
} }

View File

@ -32,12 +32,12 @@ export default class Color {
const q = v * (1 - f * s); const q = v * (1 - f * s);
const t = v * (1 - (1 - f) * s); const t = v * (1 - (1 - f) * s);
switch (i % 6) { switch (i % 6) {
default: [r, g, b] = [v, t, p]; break;
case 1: [r, g, b] = [q, v, p]; break; case 1: [r, g, b] = [q, v, p]; break;
case 2: [r, g, b] = [p, v, t]; break; case 2: [r, g, b] = [p, v, t]; break;
case 3: [r, g, b] = [p, q, v]; break; case 3: [r, g, b] = [p, q, v]; break;
case 4: [r, g, b] = [t, p, v]; break; case 4: [r, g, b] = [t, p, v]; break;
case 5: [r, g, b] = [v, p, q]; break; case 5: [r, g, b] = [v, p, q]; break;
default: [r, g, b] = [v, t, p]; break;
} }
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
} }

View File

@ -1,3 +1,5 @@
/* eslint-disable default-case-last */
import { import {
angleFromRad, angleFromRad,
SQRT_2_2, SQRT_2_2,

View File

@ -1 +1,3 @@
export {default} from './proton'; import Proton from './proton';
export default Proton;

View File

@ -9,9 +9,9 @@ export default function shapeFromJSON(json) {
return new CircleShape(json); return new CircleShape(json);
case 'list': case 'list':
return new ShapeList(json); return new ShapeList(json);
default:
return new PolygonShape(json);
case 'rectangle': case 'rectangle':
return new RectangleShape(json); return new RectangleShape(json);
default:
return new PolygonShape(json);
} }
} }

View File

@ -21,10 +21,10 @@ export default class ShapeList extends Shape {
return new CircleShape(shape); return new CircleShape(shape);
case 'list': case 'list':
return new ShapeList(shape); return new ShapeList(shape);
default:
return new PolygonShape(shape);
case 'rectangle': case 'rectangle':
return new RectangleShape(shape); return new RectangleShape(shape);
default:
return new PolygonShape(shape);
} }
})); }));
const oldShapes = this.children; const oldShapes = this.children;

View File

@ -2,8 +2,7 @@ import {Range, Vector} from '@avocado/math';
import {Trait} from '@avocado/traits'; import {Trait} from '@avocado/traits';
import {compose} from '@flecks/core'; import {compose} from '@flecks/core';
const decorate = compose( const decorate = compose();
);
export default (flecks) => class Emitted extends decorate(Trait) { export default (flecks) => class Emitted extends decorate(Trait) {

View File

@ -7,8 +7,7 @@ import K from 'kefir';
import Proton from '../proton'; import Proton from '../proton';
const decorate = compose( const decorate = compose();
);
export default (flecks) => class Emitter extends decorate(Trait) { export default (flecks) => class Emitter extends decorate(Trait) {

View File

@ -4,8 +4,7 @@ import {compose} from '@flecks/core';
import shapeFromJSON from '../shape/from-json'; import shapeFromJSON from '../shape/from-json';
import ShapeView from '../shape/view'; import ShapeView from '../shape/view';
const decorate = compose( const decorate = compose();
);
export default () => class Shaped extends decorate(Trait) { export default () => class Shaped extends decorate(Trait) {

View File

@ -31,7 +31,7 @@ export default () => {
group, group,
) )
); );
patch.onChange = (path, key = 'value', group) => (event, value) => { patch.onChange = (path, key = 'value', group = undefined) => (event, value) => {
patch( patch(
{ {
path, path,

View File

@ -49,7 +49,8 @@ const decorate = compose(
export default class ModulatedProperty extends decorate(Class) { export default class ModulatedProperty extends decorate(Class) {
constructor( constructor(
object, key, object,
key,
{ {
factor = 1, factor = 1,
frequency, frequency,

View File

@ -27,7 +27,6 @@ export default () => class Animation extends decorate(JsonResource) {
clampDirection(direction) { clampDirection(direction) {
switch (this.directionCount) { switch (this.directionCount) {
default: return 0;
case 4: { case 4: {
const directionMap = { const directionMap = {
0: 0, 0: 0,
@ -42,6 +41,7 @@ export default () => class Animation extends decorate(JsonResource) {
return directionMap[Math.min(7, Math.max(0, direction))]; return directionMap[Math.min(7, Math.max(0, direction))];
} }
case 8: return Math.min(7, Math.max(0, direction)); case 8: return Math.min(7, Math.max(0, direction));
default: return 0;
} }
} }