Skip to content

Commit

Permalink
Manually re-enable eslint plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeza committed Aug 6, 2024
1 parent db0e083 commit 900ba2c
Show file tree
Hide file tree
Showing 17 changed files with 479 additions and 339 deletions.
703 changes: 401 additions & 302 deletions Cargo.lock

Large diffs are not rendered by default.

Binary file modified liberica/bun.lockb
Binary file not shown.
49 changes: 29 additions & 20 deletions liberica/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@ import globals from "globals";
import eslintJs from "@eslint/js";
import tseslint from "typescript-eslint";

/* import eslintPluginReact from "eslint-plugin-react";
* import eslintPluginReactHooks from "eslint-plugin-react-hooks";
* import eslintPluginReactRefresh from "eslint-plugin-react-refresh";
*/ import eslintPlugini18next from "eslint-plugin-i18next";
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
import eslintPluginReact from "eslint-plugin-react";
import eslintPlugini18next from "eslint-plugin-i18next";

// Prettier
import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
import eslintConfigPrettier from "eslint-config-prettier";

/* Currently some React related plugins are still not supported:
*
* - eslint-plugin-react
* - eslint-plugin-react-hooks
* - eslint-plugin-react-refresh
* - eslint-plutin-i18next
*
* For more information see the corresponding PRs:
* - https://github.com/jsx-eslint/eslint-plugin-react/pull/3743
* - https://github.com/edvardchen/eslint-plugin-i18next/pull/126
* - https://github.com/facebook/react/pull/29770
*/
const reactPlugin = {
plugins: {
react: eslintPluginReact,
},
rules: eslintPluginReact.configs.recommended.rules,
settings: {
react: { version: "detect" },
},
};

const reactHooksPlugin = {
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
};

const i18Plugin = {
plugins: {
i18next: eslintPlugini18next,
},
rules: eslintPlugini18next.configs.recommended.rules,
};

/** @type {import("eslint").Config} */
export default [
Expand All @@ -37,10 +47,9 @@ export default [
},
},

eslintJs.configs.recommended,

// eslintPluginReact.configs.recommended,
// eslintPlugini18next.configs.recommended,
reactPlugin,
reactHooksPlugin,
i18Plugin,

eslintPluginPrettier,
eslintConfigPrettier, // disables some rules that cause conflicts
Expand Down
31 changes: 15 additions & 16 deletions liberica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,42 @@
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.7.2",
"i18next": "^23.12.1",
"axios": "^1.7.3",
"i18next": "^23.12.2",
"i18next-browser-languagedetector": "^8.0.0",
"leaflet": "^1.9.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.0.0",
"react-icons": "^5.2.1",
"react-leaflet": "^4.2.1",
"react-router-dom": "^6.25.1",
"react-router-dom": "^6.26.0",
"runtypes": "^6.7.0",
"use-interval": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@eslint/js": "^9.8.0",
"@types/leaflet": "^1.9.12",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.19",
"eslint": "^9.7.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-i18next": "^6.0.9",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.8",
"globals": "^15.8.0",
"postcss": "^8.4.39",
"globals": "^15.9.0",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"tailwindcss": "^3.4.6",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.1",
"vite": "^5.3.4",
"tailwindcss": "^3.4.7",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1",
"vite": "^5.3.5",
"vite-tsconfig-paths": "^4.3.2"
},
"packageManager": "[email protected]"
Expand Down
20 changes: 19 additions & 1 deletion liberica/site.webmanifest
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
{
"name": "Mister X",
"short_name": "Mister X",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
2 changes: 2 additions & 0 deletions liberica/src/components/InputElements.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from "react";

export const TextInput = ({
className,
onTextChange,
Expand Down
2 changes: 2 additions & 0 deletions liberica/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Button } from "./InputElements";
import { FaHome } from "react-icons/fa";
import { useNavigate } from "react-router-dom";

import React from "react";

export function Navbar(props: PropsWithChildren) {
return (
<div
Expand Down
2 changes: 2 additions & 0 deletions liberica/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from "react";

export function Spinner(props: { color?: string }) {
const color = props.color ?? "white";
return (
Expand Down
1 change: 1 addition & 0 deletions liberica/src/components/TeamCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Team } from "lib/bindings";
import React from "react";

export function TeamCard(props: {
team: Team;
Expand Down
1 change: 1 addition & 0 deletions liberica/src/components/map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { GameState, Stop, TeamState, Train } from "lib/bindings";
import { getStops } from "lib/api";
import { getContrastingTextColor } from "lib/util";
import Style from "style/Map.module.css";
import React from "react";

export const GameStateContext = createContext<GameState>({
teams: [],
Expand Down
1 change: 1 addition & 0 deletions liberica/src/components/map/Marker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PropsWithChildren } from "react";
import { Marker as LMarker } from "react-leaflet";
import { Icon } from "leaflet";
import React from "react";

export function Marker(
props: PropsWithChildren & {
Expand Down
1 change: 1 addition & 0 deletions liberica/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "style/main.css";
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import React from "react";

import en_translation from "i18n/en.json";
import de_translation from "i18n/de.json";
Expand Down
1 change: 1 addition & 0 deletions liberica/src/page/Admin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTranslation } from "react-i18next";
import React from "react";

export function Admin() {
const { t } = useTranslation();
Expand Down
1 change: 1 addition & 0 deletions liberica/src/page/CreateTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FormEvent, useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { red, pink, lime, cyan, purple } from "tailwindcss/colors";
import React from "react";

export function CreateTeam() {
const [color, setColor] = useState<string>(purple["500"]);
Expand Down
1 change: 1 addition & 0 deletions liberica/src/page/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useLocation } from "react-router-dom";
import { HomeButton, Navbar } from "components/Navbar";
import { Button } from "components/InputElements";
import { useTranslation } from "react-i18next";
import React from "react";

export function Game() {
const [ws, setWS] = useState<WebSocketApi>();
Expand Down
1 change: 1 addition & 0 deletions liberica/src/page/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Team } from "lib/bindings";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom";
import React from "react";

export function Home() {
const [teams, setTeams] = useState<Team[]>([]);
Expand Down
1 change: 1 addition & 0 deletions liberica/src/page/Replay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { clamp } from "lib/util";
import schema from "lib/schema";
import { FaPlay, FaPause } from "react-icons/fa";
import { useTranslation } from "react-i18next";
import React from "react";

// configuration
const defaultSpeed = 10;
Expand Down

0 comments on commit 900ba2c

Please sign in to comment.