Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lint #18

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
prettierConfig,
eslintPluginPrettierRecommended,
];
25 changes: 0 additions & 25 deletions client/eslint.config.mjs

This file was deleted.

2,463 changes: 151 additions & 2,312 deletions client/package-lock.json

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@
"main": "build/bundle.js",
"type": "module",
"scripts": {
"build": "tsx scripts/build.ts",
"serve": "tsx scripts/serve.ts",
"lint": "eslint ./src/",
"lint:fix": "eslint ./src/ --fix",
"clean": "rm -rf build"
"build": "node scripts/build.js",
"serve": "node scripts/serve.js",
"lint": "eslint ./src ./scripts",
"lint:fix": "eslint ./src ./scripts --fix",
"clean": "rm -rf build",
"clean:all": "rm -rf build node_modules"
},
"author": "Yaacov Zamir<[email protected]>",
"license": "Apache-2.0",
"devDependencies": {
"@eslint/js": "^9.8.0",
"@stylistic/eslint-plugin": "^2.6.1",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.1.0",
"@web/dev-server-esbuild": "^1.0.2",
"esbuild": "^0.23.0",
"esbuild-plugin-lit-css": "^3.0.1",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "3.3.3",
"tsx": "^4.16.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0"
Expand Down
12 changes: 12 additions & 0 deletions client/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
trailingComma: 'es5',
tabWidth: 2,
semi: true,
singleQuote: true,
};

export default config;
26 changes: 26 additions & 0 deletions client/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable no-undef */
import * as esbuild from 'esbuild';
import {
copyAssets,
copyAndProcessIndexHtml,
getBuildConfig,
} from './settings.js';

// Build configuration for esbuild
async function build() {
try {
const config = getBuildConfig({ minify: true });
await esbuild.build(config);

// Copy static assets and index.html
copyAndProcessIndexHtml();
copyAssets();

console.log('Build completed successfully');
} catch (error) {
console.error('Build failed:', error);
process.exit(1);
}
}

build();
103 changes: 0 additions & 103 deletions client/scripts/build.ts

This file was deleted.

39 changes: 39 additions & 0 deletions client/scripts/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-undef */
import * as esbuild from 'esbuild';
import {
copyAssets,
copyAndProcessIndexHtml,
getBuildConfig,
} from './settings.js';

/**
* Serve configuration for esbuild with watch and live reload.
*/
async function serve() {
// Copy static assets and index.html
copyAndProcessIndexHtml();
copyAssets();

// Define the shorter JavaScript banner for live reload
const config = getBuildConfig({
sourcemap: true,
banner: {
js: `new EventSource('/esbuild').onmessage = () => location.reload();`, // Shorter reload script
},
});

const ctx = await esbuild.context(config);

// Start the server and watch for changes
const server = await ctx.serve({
servedir: 'build',
});

// Watch *.ts files
ctx.watch();

const { host, port } = server;
console.log(`Server is running at http://${host}:${port}`);
}

serve();
103 changes: 0 additions & 103 deletions client/scripts/serve.ts

This file was deleted.

Loading
Loading