Add eslint

This commit is contained in:
Triston Armstrong 2024-10-25 11:07:23 +07:00
parent 4f573042f1
commit 06094adbcc
Signed by: tristonarmstrong
GPG Key ID: A23B48AE45EB6EFE
5 changed files with 64 additions and 6 deletions

BIN
bun.lockb

Binary file not shown.

40
eslint.config.js Normal file
View File

@ -0,0 +1,40 @@
import globals from "globals"
import pluginJs from "@eslint/js"
import tseslint from "typescript-eslint"
import pluginReact from "eslint-plugin-react"
export default [
{ files: ["./src/**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ plugins: { react: pluginReact } },
{
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: globals.browser,
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
]

View File

@ -15,12 +15,18 @@
"kaioken": "^0.31.0"
},
"devDependencies": {
"@eslint/js": "^9.13.0",
"@tauri-apps/cli": "^2.0.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.13.0",
"eslint-plugin-react": "^7.37.2",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.8",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-kaioken": "^0.13.1"
}
}

View File

@ -15,8 +15,8 @@
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"jsx": "preserve"
},

View File

@ -1,9 +1,21 @@
import { defineConfig } from "vite";
import kaioken from "vite-plugin-kaioken";
import { defineConfig } from "vite"
import kaioken from "vite-plugin-kaioken"
import eslint from "vite-plugin-eslint"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [kaioken()],
plugins: [
kaioken(),
eslint({
cache: true,
ignorePatterns: ["src-tauri"],
emitError: true,
emitWarning: true,
failOnError: false,
failOnWarning: false,
lintOnStart: true,
}),
],
esbuild: {
jsxInject: `import * as kaioken from "kaioken"`,
jsx: "transform",
@ -25,4 +37,4 @@ export default defineConfig({
ignored: ["**/src-tauri/**"],
},
},
});
})