chore: fix eslint rules
This commit is contained in:
parent
a34e215202
commit
ee9207a7f4
9 changed files with 33 additions and 42 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -1,28 +1,22 @@
|
||||||
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
||||||
import { fixupPluginRules } from "@eslint/compat";
|
import { fixupPluginRules } from "@eslint/compat";
|
||||||
import js from "@eslint/js";
|
import eslint from '@eslint/js';
|
||||||
import deprecationPlugin from "eslint-plugin-deprecation";
|
import deprecationPlugin from "eslint-plugin-deprecation";
|
||||||
import importPlugin from "eslint-plugin-import";
|
|
||||||
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
||||||
import tailwind from "eslint-plugin-tailwindcss";
|
import tailwind from "eslint-plugin-tailwindcss";
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
js.configs.recommended,
|
eslint.configs.recommended,
|
||||||
importPlugin.flatConfigs.recommended,
|
|
||||||
comments.recommended,
|
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
...tailwind.configs["flat/recommended"],
|
...tailwind.configs["flat/recommended"],
|
||||||
{
|
{
|
||||||
plugins: {
|
plugins: {
|
||||||
"@typescript-eslint": tseslint.plugin,
|
|
||||||
deprecation: fixupPluginRules(deprecationPlugin),
|
deprecation: fixupPluginRules(deprecationPlugin),
|
||||||
import: fixupPluginRules(importPlugin),
|
|
||||||
"simple-import-sort": simpleImportSortPlugin,
|
"simple-import-sort": simpleImportSortPlugin,
|
||||||
},
|
},
|
||||||
ignores: ["**/node_modules/**", "**/public/**"],
|
ignores: ["**/node_modules/**"],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
projectService: true,
|
projectService: true,
|
||||||
|
|
@ -36,12 +30,11 @@ export default tseslint.config(
|
||||||
...globals.browser,
|
...globals.browser,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
files: ["**/*.{js,mjs,cjs}"],
|
files: ["**/*.{js,mjs,cjs,tsx}"],
|
||||||
rules: {
|
rules: {
|
||||||
"tailwindcss/no-custom-classname": [
|
"tailwindcss/no-custom-classname": [
|
||||||
"error",
|
"warn",
|
||||||
{
|
{
|
||||||
config: "./tailwind.config.js",
|
|
||||||
whitelist: [
|
whitelist: [
|
||||||
"select_container",
|
"select_container",
|
||||||
"convert_to_popup",
|
"convert_to_popup",
|
||||||
|
|
@ -51,7 +44,6 @@ export default tseslint.config(
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"import/no-named-as-default": "off",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
13
package.json
13
package.json
|
|
@ -4,12 +4,12 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --watch src/index.tsx",
|
"dev": "bun run --watch src/index.tsx",
|
||||||
"hot": "bun run --hot src/index.tsx",
|
"hot": "bun run --hot src/index.tsx",
|
||||||
"format": "eslint --fix ./src",
|
"format": "eslint --fix .",
|
||||||
"build": "postcss ./src/main.css -o ./src/public/generated.css",
|
"build": "postcss ./src/main.css -o ./src/public/generated.css",
|
||||||
"lint": "run-p 'lint:*'",
|
"lint": "run-p 'lint:*'",
|
||||||
"lint:tsc": "tsc --noEmit",
|
"lint:tsc": "tsc --noEmit",
|
||||||
"lint:knip": "knip",
|
"lint:knip": "knip",
|
||||||
"lint:eslint": "eslint ./src",
|
"lint:eslint": "eslint ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@elysiajs/cookie": "^0.8.0",
|
"@elysiajs/cookie": "^0.8.0",
|
||||||
|
|
@ -24,12 +24,10 @@
|
||||||
"start": "bun run src/index.tsx"
|
"start": "bun run src/index.tsx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
||||||
"@eslint/compat": "^1.1.1",
|
"@eslint/compat": "^1.1.1",
|
||||||
"@eslint/js": "^9.11.1",
|
"@eslint/js": "^9.12.0",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
||||||
"@kitajs/ts-html-plugin": "^4.1.0",
|
"@kitajs/ts-html-plugin": "^4.1.0",
|
||||||
"@picocss/pico": "^2.0.6",
|
|
||||||
"@total-typescript/ts-reset": "^0.6.1",
|
"@total-typescript/ts-reset": "^0.6.1",
|
||||||
"@types/bun": "^1.1.10",
|
"@types/bun": "^1.1.10",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
|
|
@ -40,10 +38,9 @@
|
||||||
"@typescript-eslint/parser": "^8.7.0",
|
"@typescript-eslint/parser": "^8.7.0",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"cssnano": "^7.0.6",
|
"cssnano": "^7.0.6",
|
||||||
"eslint": "^9.11.1",
|
"eslint": "^9.12.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-deprecation": "^3.0.0",
|
"eslint-plugin-deprecation": "^3.0.0",
|
||||||
"eslint-plugin-import": "^2.30.0",
|
|
||||||
"eslint-plugin-isaacscript": "^4.0.0",
|
"eslint-plugin-isaacscript": "^4.0.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
|
|
@ -58,6 +55,6 @@
|
||||||
"tailwind-scrollbar": "^3.1.0",
|
"tailwind-scrollbar": "^3.1.0",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "^3.4.13",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.2",
|
||||||
"typescript-eslint": "^8.7.0"
|
"typescript-eslint": "^8.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -689,7 +689,8 @@ export async function convert(
|
||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
options?: any,
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
options?: unknown,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const command = `ffmpeg -i "${filePath}" "${targetPath}"`;
|
const command = `ffmpeg -i "${filePath}" "${targetPath}"`;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,9 @@ const properties: Record<
|
||||||
fileType: string,
|
fileType: string,
|
||||||
convertTo: string,
|
convertTo: string,
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
options?: unknown,
|
options?: unknown,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
) => unknown;
|
||||||
) => any;
|
|
||||||
}
|
}
|
||||||
> = {
|
> = {
|
||||||
libjxl: {
|
libjxl: {
|
||||||
|
|
@ -97,17 +96,14 @@ const properties: Record<
|
||||||
export async function mainConverter(
|
export async function mainConverter(
|
||||||
inputFilePath: string,
|
inputFilePath: string,
|
||||||
fileTypeOriginal: string,
|
fileTypeOriginal: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
convertTo: string,
|
||||||
convertTo: any,
|
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
options?: unknown,
|
options?: unknown,
|
||||||
converterName?: string,
|
converterName?: string,
|
||||||
) {
|
) {
|
||||||
const fileType = normalizeFiletype(fileTypeOriginal);
|
const fileType = normalizeFiletype(fileTypeOriginal);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
let converterFunc: ((filePath: string, fileType: string, convertTo: string, targetPath: string, options?: unknown) => unknown) | undefined;
|
||||||
let converterFunc: any;
|
|
||||||
// let converterName = converterName;
|
// let converterName = converterName;
|
||||||
|
|
||||||
if (converterName) {
|
if (converterName) {
|
||||||
|
|
@ -211,6 +207,7 @@ for (const converterName in properties) {
|
||||||
}
|
}
|
||||||
possibleInputs.sort();
|
possibleInputs.sort();
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const getPossibleInputs = () => {
|
const getPossibleInputs = () => {
|
||||||
return possibleInputs;
|
return possibleInputs;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,9 @@ const app = new Elysia({
|
||||||
<main class="mx-auto w-full max-w-4xl px-4">
|
<main class="mx-auto w-full max-w-4xl px-4">
|
||||||
<h1 class="my-8 text-3xl">Welcome to ConvertX!</h1>
|
<h1 class="my-8 text-3xl">Welcome to ConvertX!</h1>
|
||||||
<article class="article p-0">
|
<article class="article p-0">
|
||||||
<header class="w-full bg-neutral-800 p-4">Create your account</header>
|
<header class="w-full bg-neutral-800 p-4">
|
||||||
|
Create your account
|
||||||
|
</header>
|
||||||
<form method="post" action="/register" class="p-4">
|
<form method="post" action="/register" class="p-4">
|
||||||
<fieldset class="mb-4 flex flex-col gap-4">
|
<fieldset class="mb-4 flex flex-col gap-4">
|
||||||
<label class="flex flex-col gap-1">
|
<label class="flex flex-col gap-1">
|
||||||
|
|
@ -565,7 +567,7 @@ const app = new Elysia({
|
||||||
{Object.entries(getAllTargets()).map(
|
{Object.entries(getAllTargets()).map(
|
||||||
([converter, targets]) => (
|
([converter, targets]) => (
|
||||||
<article
|
<article
|
||||||
class="convert_to_group w-full border-b border-neutral-700 p-4 flex flex-col"
|
class="convert_to_group flex w-full flex-col border-b border-neutral-700 p-4"
|
||||||
data-converter={converter}
|
data-converter={converter}
|
||||||
>
|
>
|
||||||
<header class="mb-2 w-full text-xl font-bold" safe>
|
<header class="mb-2 w-full text-xl font-bold" safe>
|
||||||
|
|
@ -633,7 +635,7 @@ const app = new Elysia({
|
||||||
{Object.entries(getPossibleTargets(body.fileType)).map(
|
{Object.entries(getPossibleTargets(body.fileType)).map(
|
||||||
([converter, targets]) => (
|
([converter, targets]) => (
|
||||||
<article
|
<article
|
||||||
class="convert_to_group w-full border-b border-neutral-700 p-4 flex flex-col"
|
class="convert_to_group flex w-full flex-col border-b border-neutral-700 p-4"
|
||||||
data-converter={converter}
|
data-converter={converter}
|
||||||
>
|
>
|
||||||
<header class="mb-2 w-full text-xl font-bold" safe>
|
<header class="mb-2 w-full text-xl font-bold" safe>
|
||||||
|
|
@ -713,7 +715,7 @@ const app = new Elysia({
|
||||||
await Bun.write(`${userUploadsDir}${file.name}`, file);
|
await Bun.write(`${userUploadsDir}${file.name}`, file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/dot-notation
|
|
||||||
await Bun.write(`${userUploadsDir}${body.file["name"]}`, body.file);
|
await Bun.write(`${userUploadsDir}${body.file["name"]}`, body.file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ const dropZone = document.getElementById("dropzone");
|
||||||
const fileNames = [];
|
const fileNames = [];
|
||||||
let fileType;
|
let fileType;
|
||||||
|
|
||||||
dropZone.addEventListener("dragover", (e) => {
|
dropZone.addEventListener("dragover", () => {
|
||||||
dropZone.classList.add("dragover");
|
dropZone.classList.add("dragover");
|
||||||
});
|
});
|
||||||
|
|
||||||
dropZone.addEventListener("dragleave", (e) => {
|
dropZone.addEventListener("dragleave", () => {
|
||||||
dropZone.classList.remove("dragover");
|
dropZone.classList.remove("dragover");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -153,6 +153,7 @@ const setTitle = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add a onclick for the delete button
|
// Add a onclick for the delete button
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const deleteRow = (target) => {
|
const deleteRow = (target) => {
|
||||||
const filename = target.parentElement.parentElement.children[0].textContent;
|
const filename = target.parentElement.parentElement.children[0].textContent;
|
||||||
const row = target.parentElement.parentElement;
|
const row = target.parentElement.parentElement;
|
||||||
|
|
@ -203,7 +204,7 @@ const uploadFiles = (files) => {
|
||||||
|
|
||||||
const formConvert = document.querySelector("form[action='/convert']");
|
const formConvert = document.querySelector("form[action='/convert']");
|
||||||
|
|
||||||
formConvert.addEventListener("submit", (e) => {
|
formConvert.addEventListener("submit", () => {
|
||||||
const hiddenInput = document.querySelector("input[name='file_names']");
|
const hiddenInput = document.querySelector("input[name='file_names']");
|
||||||
hiddenInput.value = JSON.stringify(fileNames);
|
hiddenInput.value = JSON.stringify(fileNames);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
content: ["./src/**/*.{html,js,tsx,jsx,cjs,mjs}"],
|
content: ["./src/**/*.{html,js,tsx,jsx,cjs,mjs}"],
|
||||||
theme: {
|
theme: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue