Skip to content

Commit

Permalink
chore: improve eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
nimdanitro committed Oct 8, 2024
1 parent 57c1bac commit 77b0333
Show file tree
Hide file tree
Showing 34 changed files with 2,241 additions and 2,058 deletions.
49 changes: 26 additions & 23 deletions ui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import eslint from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import react from "eslint-plugin-react";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import tseslint from "typescript-eslint";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
...tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...tseslint.configs.strict,
prettierConfig,
),
{
files: ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
ignores: ["**/*.config.js", "!**/eslint.config.js"],

export default [...compat.extends("eslint:recommended", "plugin:react/recommended"), {
plugins: {
react,
react,
},

languageOptions: {
globals: {
...globals.browser,
},
globals: {
...globals.browser,
},

ecmaVersion: 12,
sourceType: "module",
ecmaVersion: 12,
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

rules: {},
}];
},
];
7 changes: 7 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"build": "tsc && vite build",
"test": "vitest",
"preview": "vite preview",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src",
"generate-pwa-assets": "pwa-assets-generator"
},
"browserslist": {
Expand All @@ -67,6 +68,8 @@
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/hat": "^0.0.4",
"@types/jest": "^29.5.13",
"@types/lodash": "^4.17.10",
Expand All @@ -80,10 +83,13 @@
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"@typescript-eslint/typescript-estree": "^8.8.0",
"@vite-pwa/assets-generator": "^0.2.6",
"@vitejs/plugin-react-swc": "^3.7.1",
"@vitest/coverage-v8": "^2.1.2",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.1",
"globals": "^15.10.0",
"husky": "^9.1.6",
Expand All @@ -97,6 +103,7 @@
"source-map-explorer": "^2.5.3",
"ts-jest": "^29.2.5",
"typescript": "^5.6.2",
"typescript-eslint": "^8.8.0",
"vite": "^5.4.8",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-eslint": "^1.8.1",
Expand Down
1,926 changes: 955 additions & 971 deletions ui/src/components/BabsIcons.ts

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions ui/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Navbar: FunctionComponent<{ isActive?: boolean }> = ({ isActive = false })
const [isMenuActive, setIsMenuActive] = useState<boolean>(isActive);
const { t } = useTranslation();

let { incidentId } = useParams();
const { incidentId } = useParams();
const navbarMenuClass = classNames({
"navbar-menu": true,
"is-active": isMenuActive,
Expand Down Expand Up @@ -218,7 +218,7 @@ function UserNavBar() {
}

const JournalNavBar: FunctionComponent = () => {
let { incidentId, journalId } = useParams();
const { incidentId, journalId } = useParams();
const { t } = useTranslation();

if (!incidentId) return <></>;
Expand Down Expand Up @@ -286,7 +286,7 @@ const JournalNavBar: FunctionComponent = () => {
};

const TasksNavBar: FunctionComponent = () => {
let { incidentId } = useParams();
const { incidentId } = useParams();
const { t } = useTranslation();

if (!incidentId) return <></>;
Expand Down Expand Up @@ -344,7 +344,7 @@ const TasksNavBar: FunctionComponent = () => {
};

const ResourcesNavBar: FunctionComponent = () => {
let { incidentId } = useParams();
const { incidentId } = useParams();
const { t } = useTranslation();

if (!incidentId) return <></>;
Expand All @@ -367,7 +367,7 @@ const ResourcesNavBar: FunctionComponent = () => {
};

const MapNavBar: FunctionComponent = () => {
let { incidentId } = useParams();
const { incidentId } = useParams();
const { t } = useTranslation();

if (!incidentId) return <></>;
Expand Down
Loading

0 comments on commit 77b0333

Please sign in to comment.