Skip to content

Update eslint and migrate to @tailwindcss/vite #390

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

Closed
Closed
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
22 changes: 0 additions & 22 deletions .eslintrc.cjs

This file was deleted.

39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import react from "eslint-plugin-react";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import prettier from "eslint-config-prettier/flat";

export default defineConfig([
globalIgnores(["dist/"]),
reactHooks.configs["recommended-latest"],
reactRefresh.configs.vite,
{
plugins: { js, react },
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
extends: [js.configs.recommended],
rules: {
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"react/prop-types": 0,
},
settings: { react: { version: "18.2" } },
languageOptions: {
parserOptions: { ecmaFeatures: { jsx: true } },
globals: { ...globals.browser, ...globals.es2020 },
},
},
{
files: ["**/context/**/*.jsx", "**/context/**/*.tsx"],
rules: {
"react-refresh/only-export-components": "off",
},
},
prettier,
]);
2,666 changes: 1,599 additions & 1,067 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -41,17 +41,17 @@
"usehooks-ts": "^3.1.0"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.14",
"@tailwindcss/vite": "^4.1.4",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"postcss": "^8.4.32",
"prettier": "3.2.5",
"eslint": "^9.25.1",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.0.0",
"prettier": "^3.5.3",
"tailwindcss": "^4.0.14",
"vite": "^6.3.4"
},
5 changes: 0 additions & 5 deletions postcss.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/EditorHeader/ControlPanel.jsx
Original file line number Diff line number Diff line change
@@ -716,7 +716,7 @@ export default function ControlPanel({
let obj = null;
try {
obj = JSON.parse(text);
} catch (error) {
} catch {
return;
}
const v = new Validator();
2 changes: 1 addition & 1 deletion src/components/EditorHeader/Modal/ImportDiagram.jsx
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ export default function ImportDiagram({
let jsonObject = null;
try {
jsonObject = JSON.parse(e.target.result);
} catch (error) {
} catch {
setError({
type: STATUS.ERROR,
message: "The file contains an error.",
1 change: 1 addition & 0 deletions src/components/Workspace.jsx
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import { isRtl } from "../i18n/utils/rtl";
import { useSearchParams } from "react-router-dom";
import { get } from "../api/gists";

// eslint-disable-next-line react-refresh/only-export-components
export const IdContext = createContext({ gistId: "", setGistId: () => {} });

export default function WorkSpace() {
9 changes: 5 additions & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
plugins: [tailwindcss(), react()],
});