diff --git a/Makefile b/Makefile index 6f661b5..762c921 100644 --- a/Makefile +++ b/Makefile @@ -61,19 +61,19 @@ gen-cppjswasm: ## regenerate the cppjswasm template from scratch cd ../python-template-cppjswasm && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yaml gen-uitk-svelte: ## regenerate the Svelte UI toolkit template from scratch - mkdir -p ../javascript-template-uitk-svelte && cd ../javascript-template-uitk-svelte && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc + mkdir -p ../javascript-template-uitk-svelte && cd ../javascript-template-uitk-svelte && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc .oxfmtrc.json .oxlintrc.json copier copy -w . ../javascript-template-uitk-svelte --data-file examples/uitk-svelte.yaml gen-uitk-webawesome: ## regenerate the Lit and Web Awesome UI toolkit template from scratch - mkdir -p ../javascript-template-uitk-webawesome && cd ../javascript-template-uitk-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc + mkdir -p ../javascript-template-uitk-webawesome && cd ../javascript-template-uitk-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc .oxfmtrc.json .oxlintrc.json copier copy -w . ../javascript-template-uitk-webawesome --data-file examples/uitk-webawesome.yaml gen-site-sveltekit: ## regenerate the SvelteKit site template from scratch - mkdir -p ../javascript-template-site-sveltekit && cd ../javascript-template-site-sveltekit && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc + mkdir -p ../javascript-template-site-sveltekit && cd ../javascript-template-site-sveltekit && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc .oxfmtrc.json .oxlintrc.json copier copy -w . ../javascript-template-site-sveltekit --data-file examples/site-sveltekit.yaml gen-site-webawesome: ## regenerate the Web Awesome site template from scratch - mkdir -p ../javascript-template-site-webawesome && cd ../javascript-template-site-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc + mkdir -p ../javascript-template-site-webawesome && cd ../javascript-template-site-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc .oxfmtrc.json .oxlintrc.json copier copy -w . ../javascript-template-site-webawesome --data-file examples/site-webawesome.yaml .PHONY: test-python test-cpp test-js test-jupyter test-rust test-rustjswasm test-cppjswasm test-uitk-svelte test-uitk-webawesome test-site-sveltekit test-site-webawesome diff --git a/javascript/site-sveltekit/.oxfmtrc.json.jinja b/javascript/site-sveltekit/.oxfmtrc.json.jinja new file mode 100644 index 0000000..979eb24 --- /dev/null +++ b/javascript/site-sveltekit/.oxfmtrc.json.jinja @@ -0,0 +1,18 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 120, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "sortPackageJson": false, + "svelte": true, + "ignorePatterns": [ + ".svelte-kit/**", + ".copier-answers.yaml", + "build/**", + "coverage/**", + "playwright-report/**", + "test-results/**" + ] +} diff --git a/javascript/site-sveltekit/.oxlintrc.json.jinja b/javascript/site-sveltekit/.oxlintrc.json.jinja new file mode 100644 index 0000000..7042007 --- /dev/null +++ b/javascript/site-sveltekit/.oxlintrc.json.jinja @@ -0,0 +1,9 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true, + "svelte": true + } +} diff --git a/javascript/site-sveltekit/.prettierignore.jinja b/javascript/site-sveltekit/.prettierignore.jinja deleted file mode 100644 index 9dbe2af..0000000 --- a/javascript/site-sveltekit/.prettierignore.jinja +++ /dev/null @@ -1,8 +0,0 @@ -.svelte-kit -.copier-answers.yaml -build -coverage -node_modules -playwright-report -pnpm-lock.yaml -test-results diff --git a/javascript/site-sveltekit/.prettierrc.jinja b/javascript/site-sveltekit/.prettierrc.jinja deleted file mode 100644 index 6b53085..0000000 --- a/javascript/site-sveltekit/.prettierrc.jinja +++ /dev/null @@ -1,9 +0,0 @@ -{ - "printWidth": 120, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "none", - "plugins": ["prettier-plugin-svelte"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] -} diff --git a/javascript/site-sveltekit/package.json.jinja b/javascript/site-sveltekit/package.json.jinja index 4afc2ce..e58d99b 100644 --- a/javascript/site-sveltekit/package.json.jinja +++ b/javascript/site-sveltekit/package.json.jinja @@ -13,8 +13,8 @@ "build": "vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "lint": "prettier --check .", - "fix": "prettier --write .", + "lint": "oxlint . && oxfmt --check .", + "fix": "oxlint --fix . && oxfmt --write .", "test": "pnpm test:e2e", "test:e2e": "playwright test", "test:e2e:update": "playwright test --update-snapshots" @@ -27,8 +27,8 @@ "@sveltejs/vite-plugin-svelte": "^7.1.2", "@tailwindcss/vite": "^4.3.3", "@types/node": "^24.0.0", - "prettier": "^3.8.4", - "prettier-plugin-svelte": "^4.1.1", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "svelte": "^5.56.0", "svelte-check": "^4.3.0", "tailwindcss": "^4.3.3", diff --git a/javascript/site-webawesome/.oxfmtrc.json.jinja b/javascript/site-webawesome/.oxfmtrc.json.jinja new file mode 100644 index 0000000..1eab9a6 --- /dev/null +++ b/javascript/site-webawesome/.oxfmtrc.json.jinja @@ -0,0 +1,10 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 120, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "sortPackageJson": false, + "ignorePatterns": [".copier-answers.yaml", "coverage/**", "dist/**", "playwright-report/**", "test-results/**"] +} diff --git a/javascript/site-webawesome/.oxlintrc.json.jinja b/javascript/site-webawesome/.oxlintrc.json.jinja new file mode 100644 index 0000000..b521a88 --- /dev/null +++ b/javascript/site-webawesome/.oxlintrc.json.jinja @@ -0,0 +1,8 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + } +} diff --git a/javascript/site-webawesome/.prettierignore.jinja b/javascript/site-webawesome/.prettierignore.jinja deleted file mode 100644 index 051cdbd..0000000 --- a/javascript/site-webawesome/.prettierignore.jinja +++ /dev/null @@ -1,7 +0,0 @@ -dist -.copier-answers.yaml -coverage -node_modules -playwright-report -pnpm-lock.yaml -test-results diff --git a/javascript/site-webawesome/.prettierrc.jinja b/javascript/site-webawesome/.prettierrc.jinja deleted file mode 100644 index a6c60e2..0000000 --- a/javascript/site-webawesome/.prettierrc.jinja +++ /dev/null @@ -1,7 +0,0 @@ -{ - "printWidth": 120, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "none" -} diff --git a/javascript/site-webawesome/package.json.jinja b/javascript/site-webawesome/package.json.jinja index 2536fdb..09a8f45 100644 --- a/javascript/site-webawesome/package.json.jinja +++ b/javascript/site-webawesome/package.json.jinja @@ -13,8 +13,8 @@ "build": "vite build", "preview": "vite preview", "check": "tsc --noEmit", - "lint": "prettier --check .", - "fix": "prettier --write .", + "lint": "oxlint . && oxfmt --check .", + "fix": "oxlint --fix . && oxfmt --write .", "test": "pnpm test:e2e", "test:e2e": "playwright test", "test:e2e:update": "playwright test --update-snapshots" @@ -26,7 +26,8 @@ "@axe-core/playwright": "^4.12.1", "@playwright/test": "^1.60.0", "@types/node": "^24.0.0", - "prettier": "^3.8.4", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "typescript": "^5.9.3", "vite": "^8.1.5" } diff --git a/javascript/uitk-svelte/.oxfmtrc.json.jinja b/javascript/uitk-svelte/.oxfmtrc.json.jinja new file mode 100644 index 0000000..e319964 --- /dev/null +++ b/javascript/uitk-svelte/.oxfmtrc.json.jinja @@ -0,0 +1,19 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 120, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "sortPackageJson": false, + "svelte": true, + "ignorePatterns": [ + ".svelte-kit/**", + ".copier-answers.yaml", + "build/**", + "coverage/**", + "dist/**", + "playwright-report/**", + "test-results/**" + ] +} diff --git a/javascript/uitk-svelte/.oxlintrc.json.jinja b/javascript/uitk-svelte/.oxlintrc.json.jinja new file mode 100644 index 0000000..7042007 --- /dev/null +++ b/javascript/uitk-svelte/.oxlintrc.json.jinja @@ -0,0 +1,9 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true, + "svelte": true + } +} diff --git a/javascript/uitk-svelte/.prettierignore.jinja b/javascript/uitk-svelte/.prettierignore.jinja deleted file mode 100644 index 4e6c2de..0000000 --- a/javascript/uitk-svelte/.prettierignore.jinja +++ /dev/null @@ -1,9 +0,0 @@ -.copier-answers.yaml -node_modules -dist -pnpm-lock.yaml -.svelte-kit -build -coverage -playwright-report -test-results diff --git a/javascript/uitk-svelte/.prettierrc.jinja b/javascript/uitk-svelte/.prettierrc.jinja deleted file mode 100644 index 6b53085..0000000 --- a/javascript/uitk-svelte/.prettierrc.jinja +++ /dev/null @@ -1,9 +0,0 @@ -{ - "printWidth": 120, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "none", - "plugins": ["prettier-plugin-svelte"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] -} diff --git a/javascript/uitk-svelte/package.json.jinja b/javascript/uitk-svelte/package.json.jinja index a187ed6..863ea80 100644 --- a/javascript/uitk-svelte/package.json.jinja +++ b/javascript/uitk-svelte/package.json.jinja @@ -34,8 +34,8 @@ "prepare": "svelte-kit sync", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "preview": "vite preview", - "lint": "prettier --check .", - "fix": "prettier --write .", + "lint": "oxlint . && oxfmt --check .", + "fix": "oxlint --fix . && oxfmt --write .", "test": "pnpm test:unit && pnpm test:e2e", "test:unit": "vitest run", "test:e2e": "playwright test", @@ -53,8 +53,8 @@ "@sveltejs/vite-plugin-svelte": "^7.1.2", "@types/node": "^24.0.0", "jsdom": "^29.0.0", - "prettier": "^3.8.4", - "prettier-plugin-svelte": "^4.1.1", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "publint": "^0.3.21", "svelte": "^5.56.0", "svelte-check": "^4.3.0", diff --git a/javascript/uitk-webawesome/.oxfmtrc.json.jinja b/javascript/uitk-webawesome/.oxfmtrc.json.jinja new file mode 100644 index 0000000..59d6585 --- /dev/null +++ b/javascript/uitk-webawesome/.oxfmtrc.json.jinja @@ -0,0 +1,18 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 120, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "sortPackageJson": false, + "ignorePatterns": [ + ".svelte-kit/**", + ".copier-answers.yaml", + "build/**", + "coverage/**", + "dist/**", + "playwright-report/**", + "test-results/**" + ] +} diff --git a/javascript/uitk-webawesome/.oxlintrc.json.jinja b/javascript/uitk-webawesome/.oxlintrc.json.jinja new file mode 100644 index 0000000..b521a88 --- /dev/null +++ b/javascript/uitk-webawesome/.oxlintrc.json.jinja @@ -0,0 +1,8 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + } +} diff --git a/javascript/uitk-webawesome/.prettierignore.jinja b/javascript/uitk-webawesome/.prettierignore.jinja deleted file mode 100644 index 4e6c2de..0000000 --- a/javascript/uitk-webawesome/.prettierignore.jinja +++ /dev/null @@ -1,9 +0,0 @@ -.copier-answers.yaml -node_modules -dist -pnpm-lock.yaml -.svelte-kit -build -coverage -playwright-report -test-results diff --git a/javascript/uitk-webawesome/.prettierrc.jinja b/javascript/uitk-webawesome/.prettierrc.jinja deleted file mode 100644 index 5c4f4a6..0000000 --- a/javascript/uitk-webawesome/.prettierrc.jinja +++ /dev/null @@ -1,9 +0,0 @@ -{ - "printWidth": 120, - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "none", - "plugins": [], - "overrides": [] -} diff --git a/javascript/uitk-webawesome/package.json.jinja b/javascript/uitk-webawesome/package.json.jinja index 35ae98b..c2a8c28 100644 --- a/javascript/uitk-webawesome/package.json.jinja +++ b/javascript/uitk-webawesome/package.json.jinja @@ -32,8 +32,8 @@ "build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly && publint", "check": "tsc --noEmit", "preview": "vite preview", - "lint": "prettier --check .", - "fix": "prettier --write .", + "lint": "oxlint . && oxfmt --check .", + "fix": "oxlint --fix . && oxfmt --write .", "test": "pnpm test:unit && pnpm test:e2e", "test:unit": "vitest run", "test:e2e": "playwright test", @@ -50,7 +50,8 @@ "lit": "^3.3.3", "@types/node": "^24.0.0", "jsdom": "^29.0.0", - "prettier": "^3.8.4", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "publint": "^0.3.21", "typescript": "^5.9.3", "vite": "^8.1.5", diff --git a/python/cppjswasm/.vscode/settings.json b/python/cppjswasm/.vscode/settings.json deleted file mode 100644 index 75a1a79..0000000 --- a/python/cppjswasm/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["./js"] -} diff --git a/python/cppjswasm/js/.oxfmtrc.json b/python/cppjswasm/js/.oxfmtrc.json new file mode 100644 index 0000000..a6f0347 --- /dev/null +++ b/python/cppjswasm/js/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 80, + "sortPackageJson": false +} diff --git a/python/cppjswasm/js/.oxlintrc.json b/python/cppjswasm/js/.oxlintrc.json new file mode 100644 index 0000000..1436dd0 --- /dev/null +++ b/python/cppjswasm/js/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + }, + "rules": { + "unicorn/no-empty-file": "off" + } +} diff --git a/python/cppjswasm/js/package.json.jinja b/python/cppjswasm/js/package.json.jinja index 32aed72..71e9a76 100644 --- a/python/cppjswasm/js/package.json.jinja +++ b/python/cppjswasm/js/package.json.jinja @@ -32,10 +32,10 @@ "build": "npm-run-all build:cpp build:prod", "clean": "rm -rf dist lib playwright-report ../{{ module }}/extension", "dev": "npm-run-all -p start watch", - "lint:js": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "lint:js": "oxlint . && oxfmt --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "lint:cpp": "clang-format --dry-run -Werror -style=file:../.clang-format src/cpp/*.cpp", "lint": "npm-run-all lint:*", - "fix:js": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "fix:js": "oxlint --fix . && oxfmt --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "fix:cpp": "clang-format -i -style=file:../.clang-format src/cpp/*.cpp", "fix": "npm-run-all fix:*", "preinstall": "npx only-allow pnpm", @@ -55,7 +55,8 @@ "http-server": "^14.1.1", "nodemon": "^3.1.10", "npm-run-all": "^4.1.5", - "prettier": "^3.9.6", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "typescript": "^7.0.2" } } diff --git a/python/cppjswasm/js/tests/index.spec.js b/python/cppjswasm/js/tests/index.spec.js index 0fa5b16..2370e6b 100644 --- a/python/cppjswasm/js/tests/index.spec.js +++ b/python/cppjswasm/js/tests/index.spec.js @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; test.describe("Basics", () => { - test("basic", async ({ page }) => { + test("basic", async () => { await expect("").toBe(""); }); }); diff --git a/python/cppjswasm/js/tools/bundle.mjs b/python/cppjswasm/js/tools/bundle.mjs index b417871..f493141 100644 --- a/python/cppjswasm/js/tools/bundle.mjs +++ b/python/cppjswasm/js/tools/bundle.mjs @@ -11,49 +11,49 @@ const COMMON_DEFINE = { }; const COMMON_LOADER = { - ".css": "text", - ".html": "text", - ".jsx": "jsx", - ".png": "file", - ".ttf": "file", - ".wasm": "file", + ".css": "text", + ".html": "text", + ".jsx": "jsx", + ".png": "file", + ".ttf": "file", + ".wasm": "file", }; const DEFAULT_BUILD = { - target: ["es2022"], - bundle: true, - format: "esm", - minify: DEBUG, - sourcemap: true, - metafile: true, - entryNames: "[name]", - chunkNames: "[name]", - assetNames: "[name]", - define: COMMON_DEFINE, - loader: COMMON_LOADER, - plugins: [], + target: ["es2022"], + bundle: true, + format: "esm", + minify: DEBUG, + sourcemap: true, + metafile: true, + entryNames: "[name]", + chunkNames: "[name]", + assetNames: "[name]", + define: COMMON_DEFINE, + loader: COMMON_LOADER, + plugins: [], }; export const bundle = async (config) => { - const result = await esbuild.build({ - ...DEFAULT_BUILD, - ...config, - }); - - if (result.metafile) { - for (const output of Object.keys(result.metafile.outputs)) { - const { inputs, bytes } = result.metafile.outputs[output]; - for (const input of Object.keys(inputs)) { - if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { - delete inputs[input]; - } - } + const result = await esbuild.build({ + ...DEFAULT_BUILD, + ...config, + }); + + if (result.metafile) { + for (const output of Object.keys(result.metafile.outputs)) { + const { inputs, bytes } = result.metafile.outputs[output]; + for (const input of Object.keys(inputs)) { + if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { + delete inputs[input]; } + } + } - const text = await esbuild.analyzeMetafile(result.metafile, { - color: true, - }); + const text = await esbuild.analyzeMetafile(result.metafile, { + color: true, + }); - console.log(text); - } + console.log(text); + } }; diff --git a/python/cppjswasm/js/tools/css.mjs b/python/cppjswasm/js/tools/css.mjs index 67aa219..e7b2168 100644 --- a/python/cppjswasm/js/tools/css.mjs +++ b/python/cppjswasm/js/tools/css.mjs @@ -39,7 +39,10 @@ const bundle_one = async (file, resolver) => { fs.writeFileSync(path.join("./dist/css", outName), code); }; -export const bundle_css = async (root = "src/css/index.css", resolver = null) => { +export const bundle_css = async ( + root = "src/css/index.css", + resolver = null, +) => { const resolved = path.resolve(root); if (fs.statSync(resolved).isDirectory()) { const files = fs.readdirSync(resolved).filter((f) => f.endsWith(".css")); @@ -49,4 +52,4 @@ export const bundle_css = async (root = "src/css/index.css", resolver = null) => } else { await bundle_one(root, resolver); } -} +}; diff --git a/python/cppjswasm/js/tools/externals.mjs b/python/cppjswasm/js/tools/externals.mjs index 0ee4835..9542759 100644 --- a/python/cppjswasm/js/tools/externals.mjs +++ b/python/cppjswasm/js/tools/externals.mjs @@ -1,18 +1,18 @@ export const node_modules_external = (whitelist) => { - function setup(build) { - build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => { - if (!whitelist || !args.path.startsWith(whitelist)) { - return { - path: args.path, - external: true, - namespace: "skip-node-modules", - }; - } - }); - } + function setup(build) { + build.onResolve({ filter: /^[A-Za-z0-9@]/ }, (args) => { + if (!whitelist || !args.path.startsWith(whitelist)) { + return { + path: args.path, + external: true, + namespace: "skip-node-modules", + }; + } + }); + } - return { - name: "node_modules_external", - setup, - }; + return { + name: "node_modules_external", + setup, + }; }; diff --git a/python/cppjswasm/js/tools/getarg.mjs b/python/cppjswasm/js/tools/getarg.mjs index 9cfe88c..34cb7e8 100644 --- a/python/cppjswasm/js/tools/getarg.mjs +++ b/python/cppjswasm/js/tools/getarg.mjs @@ -1,23 +1,23 @@ export const getarg = (flag, ...args) => { - if (Array.isArray(flag)) { - flag = flag.map((x, i) => x + (args[i] || "")).join(""); - } - const argv = process.argv.slice(2); - if (flag) { - const index = argv.indexOf(flag); - if (index > -1) { - const next = argv[index + 1]; - if (next) { - return next; - } else { - return true; - } + if (Array.isArray(flag)) { + flag = flag.map((x, i) => x + (args[i] || "")).join(""); + } + const argv = process.argv.slice(2); + if (flag) { + const index = argv.indexOf(flag); + if (index > -1) { + const next = argv[index + 1]; + if (next) { + return next; + } else { + return true; } - } else { - return argv - .map(function (arg) { - return "'" + arg.replace(/'/g, "'\\''") + "'"; - }) - .join(" "); } - }; + } else { + return argv + .map(function (arg) { + return "'" + arg.replace(/'/g, "'\\''") + "'"; + }) + .join(" "); + } +}; diff --git a/python/cppjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja b/python/cppjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja index 4875eee..22a4845 100644 --- a/python/cppjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja +++ b/python/cppjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja @@ -71,7 +71,7 @@ make build | Python | `ruff` | `ruff` | Style | | Python | `ruff` | `ruff` | Imports | | C++ | `clang-format` | `clang-format` | Style | -| JavaScript | `prettier` | `prettier` | Style | +| JavaScript | `oxlint` | `oxfmt` | Style | | Markdown | `mdformat` | `mdformat` | Style | | Markdown | `codespell` | | Spelling | diff --git a/python/js/.vscode/settings.json b/python/js/.vscode/settings.json deleted file mode 100644 index dab99f9..0000000 --- a/python/js/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["./js"] -} \ No newline at end of file diff --git a/python/js/js/.oxfmtrc.json b/python/js/js/.oxfmtrc.json new file mode 100644 index 0000000..a6f0347 --- /dev/null +++ b/python/js/js/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 80, + "sortPackageJson": false +} diff --git a/python/js/js/.oxlintrc.json b/python/js/js/.oxlintrc.json new file mode 100644 index 0000000..1436dd0 --- /dev/null +++ b/python/js/js/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + }, + "rules": { + "unicorn/no-empty-file": "off" + } +} diff --git a/python/js/js/package.json.jinja b/python/js/js/package.json.jinja index afce90d..ffa8db3 100644 --- a/python/js/js/package.json.jinja +++ b/python/js/js/package.json.jinja @@ -30,8 +30,8 @@ "build": "node build.mjs", "clean": "rm -rf dist playwright-report ../{{ module }}/extension", "dev": "npm-run-all -p start watch", - "lint": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", - "fix": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "lint": "oxlint . && oxfmt --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "fix": "oxlint --fix . && oxfmt --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "preinstall": "npx only-allow pnpm", "prepack": "npm run build", "start": "http-server -p 3000 -o examples/", @@ -48,7 +48,8 @@ "http-server": "^14.1.1", "nodemon": "^3.1.10", "npm-run-all": "^4.1.5", - "prettier": "^3.9.6", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "typescript": "^7.0.2" } } diff --git a/python/js/js/tests/index.spec.js b/python/js/js/tests/index.spec.js index 0fa5b16..2370e6b 100644 --- a/python/js/js/tests/index.spec.js +++ b/python/js/js/tests/index.spec.js @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; test.describe("Basics", () => { - test("basic", async ({ page }) => { + test("basic", async () => { await expect("").toBe(""); }); }); diff --git a/python/js/js/tools/bundle.mjs b/python/js/js/tools/bundle.mjs index b417871..f493141 100644 --- a/python/js/js/tools/bundle.mjs +++ b/python/js/js/tools/bundle.mjs @@ -11,49 +11,49 @@ const COMMON_DEFINE = { }; const COMMON_LOADER = { - ".css": "text", - ".html": "text", - ".jsx": "jsx", - ".png": "file", - ".ttf": "file", - ".wasm": "file", + ".css": "text", + ".html": "text", + ".jsx": "jsx", + ".png": "file", + ".ttf": "file", + ".wasm": "file", }; const DEFAULT_BUILD = { - target: ["es2022"], - bundle: true, - format: "esm", - minify: DEBUG, - sourcemap: true, - metafile: true, - entryNames: "[name]", - chunkNames: "[name]", - assetNames: "[name]", - define: COMMON_DEFINE, - loader: COMMON_LOADER, - plugins: [], + target: ["es2022"], + bundle: true, + format: "esm", + minify: DEBUG, + sourcemap: true, + metafile: true, + entryNames: "[name]", + chunkNames: "[name]", + assetNames: "[name]", + define: COMMON_DEFINE, + loader: COMMON_LOADER, + plugins: [], }; export const bundle = async (config) => { - const result = await esbuild.build({ - ...DEFAULT_BUILD, - ...config, - }); - - if (result.metafile) { - for (const output of Object.keys(result.metafile.outputs)) { - const { inputs, bytes } = result.metafile.outputs[output]; - for (const input of Object.keys(inputs)) { - if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { - delete inputs[input]; - } - } + const result = await esbuild.build({ + ...DEFAULT_BUILD, + ...config, + }); + + if (result.metafile) { + for (const output of Object.keys(result.metafile.outputs)) { + const { inputs, bytes } = result.metafile.outputs[output]; + for (const input of Object.keys(inputs)) { + if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { + delete inputs[input]; } + } + } - const text = await esbuild.analyzeMetafile(result.metafile, { - color: true, - }); + const text = await esbuild.analyzeMetafile(result.metafile, { + color: true, + }); - console.log(text); - } + console.log(text); + } }; diff --git a/python/js/js/tools/css.mjs b/python/js/js/tools/css.mjs index 67aa219..e7b2168 100644 --- a/python/js/js/tools/css.mjs +++ b/python/js/js/tools/css.mjs @@ -39,7 +39,10 @@ const bundle_one = async (file, resolver) => { fs.writeFileSync(path.join("./dist/css", outName), code); }; -export const bundle_css = async (root = "src/css/index.css", resolver = null) => { +export const bundle_css = async ( + root = "src/css/index.css", + resolver = null, +) => { const resolved = path.resolve(root); if (fs.statSync(resolved).isDirectory()) { const files = fs.readdirSync(resolved).filter((f) => f.endsWith(".css")); @@ -49,4 +52,4 @@ export const bundle_css = async (root = "src/css/index.css", resolver = null) => } else { await bundle_one(root, resolver); } -} +}; diff --git a/python/js/js/tools/externals.mjs b/python/js/js/tools/externals.mjs index 0ee4835..9542759 100644 --- a/python/js/js/tools/externals.mjs +++ b/python/js/js/tools/externals.mjs @@ -1,18 +1,18 @@ export const node_modules_external = (whitelist) => { - function setup(build) { - build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => { - if (!whitelist || !args.path.startsWith(whitelist)) { - return { - path: args.path, - external: true, - namespace: "skip-node-modules", - }; - } - }); - } + function setup(build) { + build.onResolve({ filter: /^[A-Za-z0-9@]/ }, (args) => { + if (!whitelist || !args.path.startsWith(whitelist)) { + return { + path: args.path, + external: true, + namespace: "skip-node-modules", + }; + } + }); + } - return { - name: "node_modules_external", - setup, - }; + return { + name: "node_modules_external", + setup, + }; }; diff --git a/python/js/js/tools/getarg.mjs b/python/js/js/tools/getarg.mjs index 9cfe88c..34cb7e8 100644 --- a/python/js/js/tools/getarg.mjs +++ b/python/js/js/tools/getarg.mjs @@ -1,23 +1,23 @@ export const getarg = (flag, ...args) => { - if (Array.isArray(flag)) { - flag = flag.map((x, i) => x + (args[i] || "")).join(""); - } - const argv = process.argv.slice(2); - if (flag) { - const index = argv.indexOf(flag); - if (index > -1) { - const next = argv[index + 1]; - if (next) { - return next; - } else { - return true; - } + if (Array.isArray(flag)) { + flag = flag.map((x, i) => x + (args[i] || "")).join(""); + } + const argv = process.argv.slice(2); + if (flag) { + const index = argv.indexOf(flag); + if (index > -1) { + const next = argv[index + 1]; + if (next) { + return next; + } else { + return true; } - } else { - return argv - .map(function (arg) { - return "'" + arg.replace(/'/g, "'\\''") + "'"; - }) - .join(" "); } - }; + } else { + return argv + .map(function (arg) { + return "'" + arg.replace(/'/g, "'\\''") + "'"; + }) + .join(" "); + } +}; diff --git a/python/js/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja b/python/js/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja index eb55769..44464e3 100644 --- a/python/js/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja +++ b/python/js/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja @@ -70,7 +70,7 @@ make build | :--------- | :---------- | :------------ | :---------- | | Python | `ruff` | `ruff` | Style | | Python | `ruff` | `ruff` | Imports | -| JavaScript | `prettier` | `prettier` | Style | +| JavaScript | `oxlint` | `oxfmt` | Style | | Markdown | `mdformat` | `mdformat` | Style | | Markdown | `codespell` | | Spelling | diff --git a/python/jupyter/.vscode/settings.json b/python/jupyter/.vscode/settings.json deleted file mode 100644 index dab99f9..0000000 --- a/python/jupyter/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["./js"] -} \ No newline at end of file diff --git a/python/jupyter/js/.eslintrc.js b/python/jupyter/js/.eslintrc.js deleted file mode 100644 index 1882e1e..0000000 --- a/python/jupyter/js/.eslintrc.js +++ /dev/null @@ -1,59 +0,0 @@ -module.exports = { - parser: "@babel/eslint-parser", - extends: ["airbnb-base", "prettier", "plugin:json/recommended"], - plugins: ["prettier", "jest"], - env: { - browser: true, - commonjs: true, - es6: true, - node: true, - jasmine: true, - jest: true, - "jest/globals": true, - }, - parserOptions: { - ecmaVersion: 2017, - ecmaFeatures: {}, - sourceType: "module", - experimentalObjectRestSpread: true, - }, - rules: { - "prettier/prettier": [ - "error", - { - printWidth: 200, - tabWidth: 2, - bracketSpacing: false, - }, - ], - "max-len": [ - "warn", - { - code: 200, - comments: 200, - ignoreTrailingComments: true, - }, - ], - camelcase: "off", - "class-methods-use-this": "off", - "constructor-super": "error", - indent: "off", - "linebreak-style": ["error", "unix"], - "no-const-assign": "error", - "no-nested-ternary": "warn", - "no-this-before-super": "error", - "no-undef": "error", - "no-underscore-dangle": "off", - "no-unreachable": "error", - "no-unused-vars": "warn", - "object-curly-spacing": "off", - quotes: "off", - "spaced-comment": "off", - "valid-typeof": "error", - - "import/extensions": "off", - "import/no-unresolved": "off", - "import/prefer-default-export": "off", - "import/no-extraneous-dependencies": "off", - }, -}; \ No newline at end of file diff --git a/python/jupyter/js/.oxfmtrc.json b/python/jupyter/js/.oxfmtrc.json new file mode 100644 index 0000000..77ee537 --- /dev/null +++ b/python/jupyter/js/.oxfmtrc.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "bracketSpacing": false, + "printWidth": 200, + "sortPackageJson": false, + "tabWidth": 2 +} diff --git a/python/jupyter/js/.oxlintrc.json b/python/jupyter/js/.oxlintrc.json new file mode 100644 index 0000000..f644b2b --- /dev/null +++ b/python/jupyter/js/.oxlintrc.json @@ -0,0 +1,19 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["eslint", "import", "jest", "unicorn", "oxc"], + "env": { + "browser": true, + "commonjs": true, + "es6": true, + "jasmine": true, + "jest": true, + "node": true + }, + "rules": { + "no-nested-ternary": "warn", + "no-unused-vars": "warn", + "import/extensions": "off", + "import/prefer-default-export": "off", + "unicorn/no-empty-file": "off" + } +} diff --git a/python/jupyter/js/package.json.jinja b/python/jupyter/js/package.json.jinja index 6cca590..82188cd 100644 --- a/python/jupyter/js/package.json.jinja +++ b/python/jupyter/js/package.json.jinja @@ -36,8 +36,8 @@ "build:labextension": "rimraf ../{{ module }}/labextension && jupyter labextension build .", "build": "pnpm clean && pnpm build:babel && pnpm build:extension && pnpm build:labextension && pnpm build:nbextension", "clean": "rimraf lib", - "fix": "pnpm lint --fix", - "lint": "eslint -c .eslintrc.js --ext .js src/ tests/", + "fix": "oxlint --fix src/ tests/ && oxfmt --write \"src/**/*.js\" \"tests/**/*.js\"", + "lint": "oxlint src/ tests/ && oxfmt --check \"src/**/*.js\" \"tests/**/*.js\"", "preinstall": "npx only-allow pnpm", "prepublishOnly": "pnpm run build", "test": "jest --coverage --collectCoverageFrom=src/*.{js}" @@ -52,26 +52,18 @@ "devDependencies": { "@babel/cli": "^7.28.6", "@babel/core": "^7.29.0", - "@babel/eslint-parser": "^7.28.6", "@babel/preset-env": "^7.29.3", "@jupyterlab/builder": "^4.5.10", "babel-jest": "^30.4.1", "cpy-cli": "^6.0.0", - "eslint": "^8.57.1", - "eslint-config-airbnb": "^19.0.4", - "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-prettier": "^10.1.8", - "eslint-plugin-import": "^2.32.0", - "eslint-plugin-jest": "^29.16.0", - "eslint-plugin-json": "^3.1.0", - "eslint-plugin-prettier": "^5.5.4", "isomorphic-fetch": "^3.0.0", "jest": "^30.4.2", "jest-environment-jsdom": "^30.4.1", "jest-junit": "^17.0.0", "jest-transform-css": "^6.0.3", "mkdirp": "^3.0.1", - "prettier": "^3.9.6", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "rimraf": "^6.1.3" } } diff --git a/python/jupyter/js/src/index.js.jinja b/python/jupyter/js/src/index.js.jinja index ac18b55..70eabe3 100644 --- a/python/jupyter/js/src/index.js.jinja +++ b/python/jupyter/js/src/index.js.jinja @@ -1,7 +1,7 @@ import "../style/index.css"; -async function activate(app) { - // eslint-disable-next-line no-console +async function activate(_app) { + // oxlint-disable-next-line no-console console.log("JupyterLab extension {{ project_name_formatted }} is activated!"); } diff --git a/python/jupyter/js/tests/activate.test.js b/python/jupyter/js/tests/activate.test.js index 97638e7..0147fa0 100644 --- a/python/jupyter/js/tests/activate.test.js +++ b/python/jupyter/js/tests/activate.test.js @@ -4,6 +4,6 @@ import {_activate} from "../src/index"; describe("Checks activate", () => { test("Check activate", () => { - expect(_activate); + expect(_activate).toBeDefined(); }); }); diff --git a/python/jupyter/js/tests/export.test.js b/python/jupyter/js/tests/export.test.js index ddef5cf..2455b64 100644 --- a/python/jupyter/js/tests/export.test.js +++ b/python/jupyter/js/tests/export.test.js @@ -4,6 +4,6 @@ import * as extension from "../src/index"; describe("Checks exports", () => { test("Check extension", () => { - expect(extension); + expect(extension).toBeDefined(); }); }); diff --git a/python/jupyter/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja b/python/jupyter/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja index eb55769..44464e3 100644 --- a/python/jupyter/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja +++ b/python/jupyter/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja @@ -70,7 +70,7 @@ make build | :--------- | :---------- | :------------ | :---------- | | Python | `ruff` | `ruff` | Style | | Python | `ruff` | `ruff` | Imports | -| JavaScript | `prettier` | `prettier` | Style | +| JavaScript | `oxlint` | `oxfmt` | Style | | Markdown | `mdformat` | `mdformat` | Style | | Markdown | `codespell` | | Spelling | diff --git a/python/rustjswasm/.vscode/settings.json b/python/rustjswasm/.vscode/settings.json deleted file mode 100644 index dab99f9..0000000 --- a/python/rustjswasm/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["./js"] -} \ No newline at end of file diff --git a/python/rustjswasm/js/.oxfmtrc.json b/python/rustjswasm/js/.oxfmtrc.json new file mode 100644 index 0000000..a6f0347 --- /dev/null +++ b/python/rustjswasm/js/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 80, + "sortPackageJson": false +} diff --git a/python/rustjswasm/js/.oxlintrc.json b/python/rustjswasm/js/.oxlintrc.json new file mode 100644 index 0000000..1436dd0 --- /dev/null +++ b/python/rustjswasm/js/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + }, + "rules": { + "unicorn/no-empty-file": "off" + } +} diff --git a/python/rustjswasm/js/package.json.jinja b/python/rustjswasm/js/package.json.jinja index 0311208..936715d 100644 --- a/python/rustjswasm/js/package.json.jinja +++ b/python/rustjswasm/js/package.json.jinja @@ -34,10 +34,10 @@ "build": "npm-run-all build:rust build:wasm-bindgen build:prod", "clean": "rm -rf dist lib playwright-report ../{{ module }}/extension", "dev": "npm-run-all -p start watch", - "lint:js": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "lint:js": "oxlint . && oxfmt --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "lint:rust": "cargo clippy --all-features && cargo fmt --all -- --check", "lint": "npm-run-all lint:*", - "fix:js": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "fix:js": "oxlint --fix . && oxfmt --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "fix:rust": "cargo fmt --all", "fix": "npm-run-all fix:*", "preinstall": "npx only-allow pnpm", @@ -58,7 +58,8 @@ "http-server": "^14.1.1", "nodemon": "^3.1.14", "npm-run-all": "^4.1.5", - "prettier": "^3.9.6", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "typescript": "^7.0.2" } } diff --git a/python/rustjswasm/js/tests/index.spec.js b/python/rustjswasm/js/tests/index.spec.js index 0fa5b16..2370e6b 100644 --- a/python/rustjswasm/js/tests/index.spec.js +++ b/python/rustjswasm/js/tests/index.spec.js @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; test.describe("Basics", () => { - test("basic", async ({ page }) => { + test("basic", async () => { await expect("").toBe(""); }); }); diff --git a/python/rustjswasm/js/tools/bundle.mjs b/python/rustjswasm/js/tools/bundle.mjs index b417871..f493141 100644 --- a/python/rustjswasm/js/tools/bundle.mjs +++ b/python/rustjswasm/js/tools/bundle.mjs @@ -11,49 +11,49 @@ const COMMON_DEFINE = { }; const COMMON_LOADER = { - ".css": "text", - ".html": "text", - ".jsx": "jsx", - ".png": "file", - ".ttf": "file", - ".wasm": "file", + ".css": "text", + ".html": "text", + ".jsx": "jsx", + ".png": "file", + ".ttf": "file", + ".wasm": "file", }; const DEFAULT_BUILD = { - target: ["es2022"], - bundle: true, - format: "esm", - minify: DEBUG, - sourcemap: true, - metafile: true, - entryNames: "[name]", - chunkNames: "[name]", - assetNames: "[name]", - define: COMMON_DEFINE, - loader: COMMON_LOADER, - plugins: [], + target: ["es2022"], + bundle: true, + format: "esm", + minify: DEBUG, + sourcemap: true, + metafile: true, + entryNames: "[name]", + chunkNames: "[name]", + assetNames: "[name]", + define: COMMON_DEFINE, + loader: COMMON_LOADER, + plugins: [], }; export const bundle = async (config) => { - const result = await esbuild.build({ - ...DEFAULT_BUILD, - ...config, - }); - - if (result.metafile) { - for (const output of Object.keys(result.metafile.outputs)) { - const { inputs, bytes } = result.metafile.outputs[output]; - for (const input of Object.keys(inputs)) { - if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { - delete inputs[input]; - } - } + const result = await esbuild.build({ + ...DEFAULT_BUILD, + ...config, + }); + + if (result.metafile) { + for (const output of Object.keys(result.metafile.outputs)) { + const { inputs, bytes } = result.metafile.outputs[output]; + for (const input of Object.keys(inputs)) { + if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { + delete inputs[input]; } + } + } - const text = await esbuild.analyzeMetafile(result.metafile, { - color: true, - }); + const text = await esbuild.analyzeMetafile(result.metafile, { + color: true, + }); - console.log(text); - } + console.log(text); + } }; diff --git a/python/rustjswasm/js/tools/css.mjs b/python/rustjswasm/js/tools/css.mjs index 67aa219..e7b2168 100644 --- a/python/rustjswasm/js/tools/css.mjs +++ b/python/rustjswasm/js/tools/css.mjs @@ -39,7 +39,10 @@ const bundle_one = async (file, resolver) => { fs.writeFileSync(path.join("./dist/css", outName), code); }; -export const bundle_css = async (root = "src/css/index.css", resolver = null) => { +export const bundle_css = async ( + root = "src/css/index.css", + resolver = null, +) => { const resolved = path.resolve(root); if (fs.statSync(resolved).isDirectory()) { const files = fs.readdirSync(resolved).filter((f) => f.endsWith(".css")); @@ -49,4 +52,4 @@ export const bundle_css = async (root = "src/css/index.css", resolver = null) => } else { await bundle_one(root, resolver); } -} +}; diff --git a/python/rustjswasm/js/tools/externals.mjs b/python/rustjswasm/js/tools/externals.mjs index 0ee4835..9542759 100644 --- a/python/rustjswasm/js/tools/externals.mjs +++ b/python/rustjswasm/js/tools/externals.mjs @@ -1,18 +1,18 @@ export const node_modules_external = (whitelist) => { - function setup(build) { - build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => { - if (!whitelist || !args.path.startsWith(whitelist)) { - return { - path: args.path, - external: true, - namespace: "skip-node-modules", - }; - } - }); - } + function setup(build) { + build.onResolve({ filter: /^[A-Za-z0-9@]/ }, (args) => { + if (!whitelist || !args.path.startsWith(whitelist)) { + return { + path: args.path, + external: true, + namespace: "skip-node-modules", + }; + } + }); + } - return { - name: "node_modules_external", - setup, - }; + return { + name: "node_modules_external", + setup, + }; }; diff --git a/python/rustjswasm/js/tools/getarg.mjs b/python/rustjswasm/js/tools/getarg.mjs index 9cfe88c..34cb7e8 100644 --- a/python/rustjswasm/js/tools/getarg.mjs +++ b/python/rustjswasm/js/tools/getarg.mjs @@ -1,23 +1,23 @@ export const getarg = (flag, ...args) => { - if (Array.isArray(flag)) { - flag = flag.map((x, i) => x + (args[i] || "")).join(""); - } - const argv = process.argv.slice(2); - if (flag) { - const index = argv.indexOf(flag); - if (index > -1) { - const next = argv[index + 1]; - if (next) { - return next; - } else { - return true; - } + if (Array.isArray(flag)) { + flag = flag.map((x, i) => x + (args[i] || "")).join(""); + } + const argv = process.argv.slice(2); + if (flag) { + const index = argv.indexOf(flag); + if (index > -1) { + const next = argv[index + 1]; + if (next) { + return next; + } else { + return true; } - } else { - return argv - .map(function (arg) { - return "'" + arg.replace(/'/g, "'\\''") + "'"; - }) - .join(" "); } - }; + } else { + return argv + .map(function (arg) { + return "'" + arg.replace(/'/g, "'\\''") + "'"; + }) + .join(" "); + } +}; diff --git a/python/rustjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja b/python/rustjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja index 2d332da..3e646a1 100644 --- a/python/rustjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja +++ b/python/rustjswasm/{% if add_wiki %}docs{% endif %}/wiki/contribute/Build-from-Source.md.jinja @@ -62,13 +62,14 @@ make build `{{ project_name_formatted }}` has linting and auto formatting. -| Language | Linter | Autoformatter | Description | -| :------- | :---------- | :------------ | :---------- | -| Python | `ruff` | `ruff` | Style | -| Python | `ruff` | `ruff` | Imports | -| Rust | `clippy` | `clippy` | Style | -| Markdown | `mdformat` | `mdformat` | Style | -| Markdown | `codespell` | | Spelling | +| Language | Linter | Autoformatter | Description | +| :--------- | :---------- | :------------ | :---------- | +| Python | `ruff` | `ruff` | Style | +| Python | `ruff` | `ruff` | Imports | +| Rust | `clippy` | `clippy` | Style | +| JavaScript | `oxlint` | `oxfmt` | Style | +| Markdown | `mdformat` | `mdformat` | Style | +| Markdown | `codespell` | | Spelling | **Python Linting**