Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
declare module 'regl' {
|
2018-01-22 20:35:00 +03:00
|
|
|
interface InitializationOptions {
|
|
|
|
/** A reference to a WebGL rendering context. (Default created from canvas) */
|
|
|
|
gl?: WebGLRenderingContext
|
|
|
|
/** A reference to an HTML canvas element. (Default created and appending to container) */
|
|
|
|
canvas?: HTMLCanvasElement | string
|
|
|
|
/** A container element which regl inserts a canvas into. (Default document.body) */
|
|
|
|
container?: HTMLElement | string
|
|
|
|
/** The context creation attributes passed to the WebGL context constructor. See below for defaults. */
|
|
|
|
attributes?: {
|
|
|
|
/** Boolean that indicates if the canvas contains an alpha buffer. */
|
|
|
|
alpha?: boolean
|
|
|
|
/** Boolean that indicates that the drawing buffer has a depth buffer of at least 16 bits. */
|
|
|
|
depth?: boolean
|
|
|
|
/** Boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits. */
|
|
|
|
stencil?: boolean
|
|
|
|
/** Boolean that indicates whether or not to perform anti-aliasing. */
|
|
|
|
antialias?: boolean
|
|
|
|
/** Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha. */
|
|
|
|
premultipliedAlpha?: boolean
|
|
|
|
/** If the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. */
|
|
|
|
preserveDrawingBuffer?: boolean
|
|
|
|
/** Boolean that indicates if a context will be created if the system performance is low. */
|
|
|
|
failIfMajorPerformanceCavet?: boolean
|
|
|
|
}
|
|
|
|
/** A multiplier which is used to scale the canvas size relative to the container. (Default window.devicePixelRatio) */
|
|
|
|
pixelRatio?: number
|
|
|
|
/** A list of extensions that must be supported by WebGL context. Default [] */
|
|
|
|
extensions?: string[] | string
|
|
|
|
/** A list of extensions which are loaded opportunistically. Default [] */
|
|
|
|
optionalExtensions?: string[] | string
|
|
|
|
/** If set, turns on profiling for all commands by default. (Default false) */
|
|
|
|
profile?: boolean
|
|
|
|
/**
|
|
|
|
* An optional callback which accepts a pair of arguments, (err, regl) that
|
|
|
|
* is called after the application loads. If not specified, context creation
|
|
|
|
* errors throw.
|
|
|
|
*/
|
|
|
|
onDone?: (err: Error, regl: regl.Instance) => void
|
|
|
|
}
|
|
|
|
function regl(options: InitializationOptions): regl.Instance
|
|
|
|
|
|
|
|
/** Create fullscreen canvas */
|
|
|
|
function regl(): regl.Instance
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Build from an existing canvas */
|
|
|
|
function regl(canvas: HTMLCanvasElement): regl.Instance
|
2018-01-09 09:02:20 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Build from an existing div container */
|
|
|
|
function regl(container: HTMLElement): regl.Instance
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Build from an existing WebGL context */
|
|
|
|
function regl(gl: WebGLRenderingContext): regl.Instance
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
namespace regl {
|
|
|
|
export type vec2 = [number, number]
|
|
|
|
export type vec3 = [number, number, number]
|
|
|
|
export type vec4 = [number, number, number, number]
|
|
|
|
export type mat3 = [number, number, number, number, number, number, number, number, number]
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
export type mat4 = [
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number,
|
|
|
|
number
|
|
|
|
]
|
2018-01-22 20:35:00 +03:00
|
|
|
type GlslPrimitive = number | vec2 | vec3 | vec4 | mat3 | mat4
|
|
|
|
|
2018-01-23 21:59:31 +03:00
|
|
|
interface Tick {
|
|
|
|
cancel(): void
|
|
|
|
}
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
interface Instance {
|
|
|
|
<P>(params: CommandOptions<P>): Command<P>
|
|
|
|
|
|
|
|
clear(args: {
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
color?: [number, number, number, number]
|
|
|
|
depth?: number
|
|
|
|
stencil?: number
|
2018-01-22 20:35:00 +03:00
|
|
|
}): void
|
2017-12-26 23:06:03 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
// TODO(jlfwong): read()
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
buffer(args: BufferArgs): Buffer
|
2018-01-24 10:48:13 +03:00
|
|
|
texture(width: number, height: number): Texture
|
2018-01-22 20:35:00 +03:00
|
|
|
texture(args: TextureArgs): Texture
|
|
|
|
framebuffer(args: FramebufferOptions): Framebuffer
|
|
|
|
renderbuffer(args: RenderBufferOptions): RenderBuffer
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
limits: {
|
|
|
|
colorBits: [number, number, number, number]
|
|
|
|
depthBits: number
|
|
|
|
stencilBits: number
|
|
|
|
subpixelBits: number
|
|
|
|
extensions: string[]
|
|
|
|
maxAnistropic: number
|
|
|
|
maxDrawbuffers: number
|
|
|
|
maxColorAttachments: number
|
|
|
|
pointSizeDims: number
|
|
|
|
lineWidthDims: number
|
|
|
|
maxViewportDims: number
|
|
|
|
maxCombinedTextureUnits: number
|
|
|
|
maxCubeMapSize: number
|
|
|
|
maxTextureUnits: number
|
|
|
|
maxTextureSize: number
|
|
|
|
maxAttributes: number
|
|
|
|
maxVertexUniforms: number
|
|
|
|
maxVertexTextureUnits: number
|
|
|
|
maxFragmentUniforms: number
|
|
|
|
glsl: string
|
|
|
|
renderer: string
|
|
|
|
vendor: string
|
|
|
|
version: string
|
|
|
|
}
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
stats: {
|
|
|
|
bufferCount: number
|
|
|
|
elementsCount: number
|
|
|
|
framebufferCount: number
|
|
|
|
shaderCount: number
|
|
|
|
textureCount: number
|
|
|
|
cubeCount: number
|
|
|
|
renderbufferCount: number
|
|
|
|
getTotalTextureSize(): number
|
|
|
|
getTotalBufferSize(): number
|
|
|
|
getTotalRenderbufferSize(): number
|
|
|
|
getMaxUniformsCount(): number
|
|
|
|
maxTextureUnits(): number
|
|
|
|
}
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
destroy(): void
|
2018-01-23 21:59:31 +03:00
|
|
|
|
2018-01-25 22:50:40 +03:00
|
|
|
frame(callback: (context: Context) => void): Tick
|
2017-12-26 23:06:03 +03:00
|
|
|
}
|
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type TypedArray =
|
|
|
|
| Int8Array
|
|
|
|
| Uint8Array
|
|
|
|
| Uint8ClampedArray
|
|
|
|
| Int16Array
|
|
|
|
| Uint16Array
|
|
|
|
| Int32Array
|
|
|
|
| Uint32Array
|
|
|
|
| Float32Array
|
|
|
|
| Float64Array
|
|
|
|
|
|
|
|
type DrawMode =
|
|
|
|
| 'points'
|
|
|
|
| 'lines'
|
|
|
|
| 'line strip'
|
|
|
|
| 'line loop'
|
|
|
|
| 'triangles'
|
|
|
|
| 'triangle strip'
|
|
|
|
| 'triangle fan'
|
2018-01-22 20:35:00 +03:00
|
|
|
|
|
|
|
interface Context {
|
|
|
|
tick: number
|
|
|
|
time: number
|
|
|
|
viewportWidth: number
|
|
|
|
viewportHeight: number
|
|
|
|
framebufferWidth: number
|
|
|
|
framebufferHeight: number
|
|
|
|
drawingBufferWidth: number
|
|
|
|
drawingBufferHeight: number
|
|
|
|
pixelRatio: number
|
|
|
|
[key: string]: any
|
2017-12-26 23:06:03 +03:00
|
|
|
}
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
interface BufferOptions {
|
|
|
|
data?: TypedArray | GlslPrimitive[]
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** If data is null or not present reserves space for the buffer */
|
|
|
|
length?: number
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Sets array buffer usage hint */
|
|
|
|
usage?: 'static' | 'dynamic' | 'stream'
|
|
|
|
}
|
|
|
|
type BufferArgs = number | number[] | vec2[] | vec3[] | mat3[] | TypedArray | BufferOptions
|
|
|
|
interface Buffer {
|
|
|
|
(args: BufferArgs): void
|
|
|
|
stats: {
|
|
|
|
size: number
|
|
|
|
}
|
|
|
|
destroy(): void
|
|
|
|
}
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
interface ElementsOptions {
|
|
|
|
data?: TypedArray
|
|
|
|
usage?: 'static' | 'dynamic' | 'stream'
|
|
|
|
length?: number
|
|
|
|
primitive?: GlslPrimitive
|
|
|
|
count?: number
|
|
|
|
}
|
|
|
|
type ElementsArgs = vec3[] | ElementsOptions
|
|
|
|
interface Elements {
|
|
|
|
(args: ElementsArgs): void
|
|
|
|
destroy(): void
|
|
|
|
}
|
2017-11-23 06:19:10 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
type MagFilter = 'nearest' | 'linear'
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type MinFilter =
|
|
|
|
| 'nearest'
|
|
|
|
| 'linear'
|
|
|
|
| 'mipmap'
|
|
|
|
| 'linear mipmap linear'
|
|
|
|
| 'nearest mipmap linear'
|
|
|
|
| 'nearest mipmap nearest'
|
2018-01-22 20:35:00 +03:00
|
|
|
type WrapMode = 'repeat' | 'clamp' | 'mirror'
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type TextureFormat =
|
|
|
|
| 'alpha'
|
|
|
|
| 'luminance'
|
|
|
|
| 'luminance alpha'
|
|
|
|
| 'rgb'
|
|
|
|
| 'rgba'
|
|
|
|
| 'rgba4'
|
|
|
|
| 'rgb5 a1'
|
|
|
|
| 'rgb565'
|
|
|
|
| 'srgb'
|
|
|
|
| 'srgba'
|
|
|
|
| 'depth'
|
|
|
|
| 'depth stencil'
|
|
|
|
| 'rgb s3tc dxt1'
|
|
|
|
| 'rgb s3tc dxt5'
|
|
|
|
| 'rgb atc'
|
|
|
|
| 'rgba atc explicit alpha'
|
|
|
|
| 'rgba atc interpolated alpha'
|
|
|
|
| 'rgb pvrtc 4bppv1'
|
|
|
|
| 'rgb pvrtc 2bppv1'
|
|
|
|
| 'rgba pvrtc 4bppv1'
|
|
|
|
| 'rgba pvrtc 2bppv1'
|
|
|
|
| 'rgb etc1'
|
2018-01-22 20:35:00 +03:00
|
|
|
type TextureType = 'uint8' | 'uint16' | 'float' | 'float32' | 'half float' | 'float16'
|
|
|
|
type ColorSpace = 'none' | 'browser'
|
|
|
|
type MipmapHint = "don't care" | 'dont care' | 'nice' | 'fast'
|
2017-12-14 11:30:25 +03:00
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type TextureData =
|
|
|
|
| number[]
|
|
|
|
| number[][]
|
|
|
|
| TypedArray
|
|
|
|
| HTMLImageElement
|
|
|
|
| HTMLVideoElement
|
|
|
|
| HTMLCanvasElement
|
|
|
|
| CanvasRenderingContext2D
|
2018-01-22 20:35:00 +03:00
|
|
|
interface TextureOptions {
|
|
|
|
width?: number
|
|
|
|
height?: number
|
|
|
|
shape?: [number, number] | [number, number, number]
|
|
|
|
radius?: number
|
2017-12-14 11:30:25 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Sets magnification filter */
|
|
|
|
mag?: MagFilter
|
|
|
|
/** Sets minification filter */
|
|
|
|
min?: MinFilter
|
|
|
|
/** Sets wrap mode on S axis */
|
|
|
|
wrapS?: WrapMode
|
|
|
|
/** Sets wrap mode on T axis */
|
|
|
|
wrapT?: WrapMode
|
|
|
|
/** Sets number of anisotropic samples, requires EXT_texture_filter_anisotropic */
|
|
|
|
aniso?: number
|
|
|
|
format?: TextureFormat
|
|
|
|
type?: TextureType
|
|
|
|
mipmap?: MipmapHint | boolean
|
|
|
|
/** Flips textures vertically when uploading */
|
|
|
|
flipY?: boolean
|
|
|
|
/** Sets unpack alignment per pixel */
|
|
|
|
alignment?: number
|
|
|
|
/** Premultiply alpha when unpacking */
|
|
|
|
premultiplyAlpha?: boolean
|
|
|
|
colorSpace?: ColorSpace
|
|
|
|
|
|
|
|
copy?: boolean
|
|
|
|
|
2018-01-24 10:48:13 +03:00
|
|
|
data?: TextureData
|
2018-01-22 20:35:00 +03:00
|
|
|
}
|
|
|
|
type TextureArgs = TextureData | TextureOptions
|
|
|
|
interface Texture {
|
2018-01-24 10:48:13 +03:00
|
|
|
width: number
|
|
|
|
height: number
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
(args: TextureArgs): void
|
2018-01-29 22:53:39 +03:00
|
|
|
resize(width: number, height: number): void
|
2018-01-22 20:35:00 +03:00
|
|
|
destroy(): void
|
|
|
|
stats: {
|
|
|
|
size: number
|
|
|
|
}
|
2017-12-14 11:30:25 +03:00
|
|
|
}
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
// TODO(jlfwong): Cube maps
|
|
|
|
// TODO(jlfwong): Cubic frame buffers
|
2018-01-09 09:02:20 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
interface RenderBufferOptions {
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
format?:
|
|
|
|
| 'rgba4'
|
|
|
|
| 'rgb565'
|
|
|
|
| 'rgb5 a1'
|
|
|
|
| 'depth'
|
|
|
|
| 'stencil'
|
|
|
|
| 'depth stencil'
|
|
|
|
| 'srgba'
|
|
|
|
| 'rgba16f'
|
|
|
|
| 'rgb16f'
|
|
|
|
| 'rgba32f'
|
2018-01-22 20:35:00 +03:00
|
|
|
width?: number
|
|
|
|
height?: number
|
|
|
|
shape?: [number, number]
|
|
|
|
radius?: number
|
|
|
|
}
|
|
|
|
interface RenderBuffer {
|
|
|
|
(options: RenderBufferOptions): void
|
|
|
|
resize(width: number, height: number): void
|
|
|
|
destroy(): void
|
|
|
|
stats: {
|
|
|
|
size: number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface FramebufferOptions {
|
|
|
|
width?: number
|
|
|
|
height?: number
|
|
|
|
shape?: [number, number]
|
|
|
|
color?: RenderBuffer[] | Texture[]
|
|
|
|
depth?: boolean | RenderBuffer | Texture
|
|
|
|
stencil?: boolean | RenderBuffer | Texture
|
|
|
|
depthStencil?: boolean | RenderBuffer | Texture
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
colorFormat?:
|
|
|
|
| 'rgba'
|
|
|
|
| 'rgba4'
|
|
|
|
| 'rgb565'
|
|
|
|
| 'rgb5 a1'
|
|
|
|
| 'rgb16f'
|
|
|
|
| 'rgba16f'
|
|
|
|
| 'rgba32f'
|
|
|
|
| 'srgba'
|
2018-01-22 20:35:00 +03:00
|
|
|
colorType?: 'uint8' | 'half float' | 'float'
|
|
|
|
}
|
|
|
|
interface Framebuffer {
|
2018-01-29 22:53:39 +03:00
|
|
|
width: number
|
|
|
|
height: number
|
|
|
|
color?: RenderBuffer[]
|
|
|
|
depth?: RenderBuffer
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
(options: FramebufferOptions): void
|
2018-01-30 13:07:05 +03:00
|
|
|
use(cb: (context: Context) => void): void
|
2018-01-22 20:35:00 +03:00
|
|
|
resize(width: number, height: number): void
|
|
|
|
destroy(): void
|
|
|
|
}
|
|
|
|
|
|
|
|
type Uniform = number | vec2 | vec3 | mat3 | Texture
|
|
|
|
|
|
|
|
interface AttributeOptions {
|
|
|
|
buffer?: Buffer | BufferArgs
|
|
|
|
offset?: number
|
|
|
|
stride?: number
|
|
|
|
normalized?: boolean
|
|
|
|
size?: number
|
|
|
|
divisor?: number
|
|
|
|
}
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type Attribute =
|
|
|
|
| AttributeOptions
|
|
|
|
| Buffer
|
|
|
|
| BufferArgs
|
|
|
|
| { constant: number | vec2 | vec3 | vec4 | mat3 | mat4 }
|
2018-01-22 20:35:00 +03:00
|
|
|
|
|
|
|
interface Computed<P, T> {
|
|
|
|
(context: Context, props: P, batchId: number): T
|
|
|
|
}
|
|
|
|
type MaybeComputed<P, T> = Computed<P, T> | T
|
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type DepthFunction =
|
|
|
|
| 'never'
|
|
|
|
| 'always'
|
|
|
|
| '<'
|
|
|
|
| 'less'
|
|
|
|
| '<='
|
|
|
|
| 'lequal'
|
|
|
|
| '>'
|
|
|
|
| 'greater'
|
|
|
|
| '>='
|
|
|
|
| 'gequal'
|
|
|
|
| '='
|
|
|
|
| 'equal'
|
|
|
|
| '!='
|
|
|
|
| 'notequal'
|
|
|
|
type BlendFunction =
|
|
|
|
| 0
|
|
|
|
| 'zero'
|
|
|
|
| 1
|
|
|
|
| 'one'
|
|
|
|
| 'src color'
|
|
|
|
| 'one minus src color'
|
|
|
|
| 'src alpha'
|
|
|
|
| 'one minus src alpha'
|
|
|
|
| 'dst color'
|
|
|
|
| 'one minus dst color'
|
|
|
|
| 'dst alpha'
|
|
|
|
| 'one minus dst alpha'
|
|
|
|
| 'constant color'
|
|
|
|
| 'one minus constant color'
|
|
|
|
| 'one minus constant alpha'
|
|
|
|
| 'src alpha saturate'
|
2018-01-22 20:35:00 +03:00
|
|
|
type BlendEquation = 'add' | 'subtract' | 'reverse subtract' | 'min' | 'max'
|
|
|
|
type StencilFunction = DepthFunction
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
type StencilOp =
|
|
|
|
| 'zero'
|
|
|
|
| 'keep'
|
|
|
|
| 'replace'
|
|
|
|
| 'invert'
|
|
|
|
| 'increment'
|
|
|
|
| 'decrement'
|
|
|
|
| 'increment wrap'
|
|
|
|
| 'decrement wrap'
|
2018-01-22 20:35:00 +03:00
|
|
|
interface CommandOptions<P> {
|
|
|
|
/** Source code of vertex shader */
|
|
|
|
vert?: string
|
|
|
|
|
|
|
|
/** Source code of fragment shader */
|
|
|
|
frag?: string
|
|
|
|
|
2018-01-23 22:36:39 +03:00
|
|
|
context?: { [contextName: string]: MaybeComputed<P, any> }
|
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
uniforms?: { [uniformName: string]: MaybeComputed<P, Uniform> }
|
|
|
|
|
2018-01-22 22:22:24 +03:00
|
|
|
attributes?: { [attributeName: string]: MaybeComputed<P, Attribute> }
|
2018-01-22 20:35:00 +03:00
|
|
|
|
|
|
|
primitive?: DrawMode
|
|
|
|
|
|
|
|
/** Number of vertices to draw */
|
|
|
|
count?: MaybeComputed<P, number>
|
|
|
|
|
|
|
|
/** Offset of primitives to draw */
|
|
|
|
offset?: MaybeComputed<P, number>
|
|
|
|
|
|
|
|
/** Number of instances to render */
|
|
|
|
instances?: MaybeComputed<P, number>
|
|
|
|
|
|
|
|
/** Element array buffer */
|
|
|
|
elements?: MaybeComputed<P, Elements | ElementsArgs>
|
|
|
|
|
|
|
|
framebuffer?: MaybeComputed<P, Framebuffer>
|
|
|
|
|
|
|
|
profile?: MaybeComputed<P, boolean>
|
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
depth?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
mask?: boolean
|
|
|
|
func?: DepthFunction
|
|
|
|
range?: [number, number]
|
|
|
|
}
|
|
|
|
>
|
|
|
|
|
|
|
|
blend?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
func?:
|
|
|
|
| {
|
|
|
|
src: BlendFunction
|
|
|
|
dst: BlendFunction
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
srcRGB: BlendFunction
|
|
|
|
srcAlpha: BlendFunction
|
|
|
|
dstRGB: BlendFunction
|
|
|
|
dstAlpha: BlendFunction
|
|
|
|
}
|
|
|
|
equation?:
|
|
|
|
| BlendEquation
|
|
|
|
| {
|
|
|
|
rgb: BlendEquation
|
|
|
|
alpha: BlendEquation
|
|
|
|
}
|
|
|
|
color?: vec4
|
|
|
|
}
|
|
|
|
>
|
|
|
|
|
|
|
|
stencil?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
mask?: number
|
|
|
|
func?: StencilFunction
|
|
|
|
opFront?: { fail: StencilOp; zfail: StencilOp; pass: StencilOp }
|
|
|
|
opBack?: { fail: StencilOp; zfail: StencilOp; pass: StencilOp }
|
2018-01-22 20:35:00 +03:00
|
|
|
}
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
>
|
|
|
|
|
|
|
|
polygonOffset?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
offset?: {
|
|
|
|
factor: number
|
|
|
|
units: number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
>
|
2018-01-22 20:35:00 +03:00
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
cull?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
face?: 'front' | 'back'
|
|
|
|
}
|
|
|
|
>
|
2018-01-22 20:35:00 +03:00
|
|
|
|
|
|
|
frontFace?: MaybeComputed<P, 'cw' | 'ccw'>
|
|
|
|
|
|
|
|
dither?: MaybeComputed<P, boolean>
|
|
|
|
|
|
|
|
lineWidth?: MaybeComputed<P, number>
|
|
|
|
|
|
|
|
colorMask?: MaybeComputed<P, [boolean, boolean, boolean, boolean]>
|
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
sample?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
alpha?: boolean
|
|
|
|
coverage?: {
|
|
|
|
value: number
|
|
|
|
invert: boolean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
>
|
|
|
|
|
|
|
|
scissor?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
|
|
|
enable?: boolean
|
|
|
|
box?: {
|
|
|
|
x: number
|
|
|
|
y: number
|
|
|
|
width: number
|
|
|
|
height: number
|
|
|
|
}
|
2018-01-22 20:35:00 +03:00
|
|
|
}
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
>
|
2018-01-22 20:35:00 +03:00
|
|
|
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
viewport?: MaybeComputed<
|
|
|
|
P,
|
|
|
|
{
|
2018-01-22 20:35:00 +03:00
|
|
|
x: number
|
|
|
|
y: number
|
|
|
|
width: number
|
|
|
|
height: number
|
|
|
|
}
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
>
|
2018-01-22 20:35:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function prop<P>(name: keyof P): (context: Context, props: P, batchId: number) => P[keyof P]
|
Set up Prettier and run it on the whole codebase
* Install prettier, set up the config file, and run it on all ts and tsx files.
* Install eslint and configure it with just eslint-plugin-prettier to check to
make sure that prettier has been run.
* Add a basic .travis.yml that runs eslint.
There are other style things that might be nice to enforce with ESLint/TSLint,
like using const, import order, etc, but this commit just focuses on prettier,
which gets most of the way there.
One annoying issue for now is that typescript-eslint-parser gives a big warning
message since they haven't updated to officially support TypeScript 2.8 yet. We
aren't even using any ESLint rules that need the parser, but if we don't include
it, ESLint will crash. TS2.8 support is hopefully coming really soon, though:
https://github.com/eslint/typescript-eslint-parser/pull/454
As for the prettier config specifically, see https://prettier.io/docs/en/options.html
for the available options.
Config settings that seem non-controversial:
Semicolons: You don't use semicolons. (I prefer semicolons, but either way is fine.)
Quote style: Looks like you consistently use single quotes outside JSX and double
quotes in JSX, which is the `singleQuote: true` option.
Config settings worth discussion:
Line width: You don't have a specific max. I put 100 since I think it's a good number
for people (like both of us, probably) who find 80 a bit cramped. (At Benchling we use
110.) Prettier has a big red warning box recommending 80, but I still prefer 100ish.
Bracket spacing: This is `{foo}` vs `{ foo }` for imports, exports, object literals,
and destructuring. Looks like you're inconsistent but lean toward spaces. I personally
really dislike bracket spacing (it feels inconsistent with arrays and function calls),
but I'm certainly fine with it and Prettier has it enabled by default, so I kept it
enabled.
Trailing comma style: Options are "no trailing commas", "trailing commas for
everything exception function calls and parameter lists", and "trailing commas
everywhere". TypeScript can handle trailing commas everywhere, so there isn't a
concern with tooling. You're inconsistent, and it looks like you tend to not have
trailing commas, but I think it's probably best to just have them everywhere, so I
enabled them.
JSX Brackets: You're inconsistent about this, I think. I'd prefer to just keep the
default and wrap the `>` to the next line.
Arrow function parens: I only found two cases of arrow functions with one param
(both `c => c.frame === frame`), and both omitted the parens, so I kept the
default of omitting parens. This makes it mildly more annoying to add a typescript
type or additional param, which is a possible reason for always requiring parens.
Everything else is non-configurable, although it's possible some places would be
better with a `// prettier-ignore` comment (but I usually try to avoid those).
2018-04-14 18:17:59 +03:00
|
|
|
function context<P>(
|
|
|
|
name: keyof Context,
|
|
|
|
): (context: Context, props: P, batchId: number) => Context[keyof Context]
|
2018-01-22 20:35:00 +03:00
|
|
|
|
|
|
|
interface Command<P> {
|
|
|
|
/** One shot rendering */
|
|
|
|
(): void
|
|
|
|
(p: P): void
|
|
|
|
|
|
|
|
/** Render a batch */
|
|
|
|
(ps: P[]): void
|
2018-01-09 09:02:20 +03:00
|
|
|
|
2018-01-22 20:35:00 +03:00
|
|
|
/** Scoped commands */
|
|
|
|
(cb: (context: Context) => void): void
|
|
|
|
(p: P, cb: (context: Context) => void): void
|
2018-01-25 19:56:14 +03:00
|
|
|
|
|
|
|
stats: {
|
|
|
|
gpuTime: number
|
|
|
|
cpuTime: number
|
2018-01-29 22:53:39 +03:00
|
|
|
hitCount: number
|
2018-01-25 19:56:14 +03:00
|
|
|
}
|
2017-12-14 11:30:25 +03:00
|
|
|
}
|
2017-11-23 06:19:10 +03:00
|
|
|
}
|
|
|
|
|
2018-04-05 10:15:42 +03:00
|
|
|
export default regl
|
2017-11-23 06:19:10 +03:00
|
|
|
}
|