Add ESLint and Prettier
Prettier owns formatting: .prettierrc.json, format and format:check scripts, and a one-off pass over the repo so the check is green from the start. Embedded language formatting is off deliberately - the renderers build HTML in html tagged templates and letting Prettier reflow those would change the markup customers receive. docs/ is excluded because it is hand-wrapped prose, and shell scripts have no Prettier parser. ESLint covers the JavaScript: the two browser scripts, the build and check scripts, and its own config. no-var is scoped out for the browser scripts on purpose; they are plain ES5-shaped IIFEs and a hoisting difference would only show up in a browser. ESLint cannot lint the TypeScript here: typescript@7 is the native port with no JavaScript compiler API, and typescript-eslint requires a 4.8-6.1 peer, so it refuses to install and forcing it through would leave a parser that cannot read the compiler. tsc --noEmit stays the TypeScript gate; README records the two ways to change that. lint and format:check now run in deploy.sh, and VS Code formats on save with Prettier and surfaces ESLint findings.
This commit is contained in:
1 parent
ce8079355b
commit
e64f65642f
40 files changed
+1469
-172
No files matched your search
@@ -58,7 +58,10 @@ describe('createImagePipeline', () => {
|
||||
|
||||
it('accepts PNG and WebP as well as JPEG', async () => {
|
||||
assert.equal((await pipeline.process(await photo(800, 600, 'png'), 'a.png')).sourceExt, 'png');
|
||||
assert.equal((await pipeline.process(await photo(800, 600, 'webp'), 'a.webp')).sourceExt, 'webp');
|
||||
assert.equal(
|
||||
(await pipeline.process(await photo(800, 600, 'webp'), 'a.webp')).sourceExt,
|
||||
'webp',
|
||||
);
|
||||
assert.deepEqual([...ACCEPTED_MIME_TYPES], ['image/jpeg', 'image/png', 'image/webp']);
|
||||
});
|
||||
|
||||
@@ -105,8 +108,7 @@ describe('createImagePipeline', () => {
|
||||
.toBuffer();
|
||||
await assert.rejects(
|
||||
() => pipeline.process(gif, 'anim.gif'),
|
||||
(error: unknown) =>
|
||||
error instanceof UnsupportedImageError && error.message.includes('gif'),
|
||||
(error: unknown) => error instanceof UnsupportedImageError && error.message.includes('gif'),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user