Skip to content

chore(lint): add stricter ESlint rules (in packages/extensions) #335

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

Merged
merged 1 commit into from
May 27, 2025
Merged
Show file tree
Hide file tree
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
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions packages/extensions/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import _import from "eslint-plugin-import";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import eslintPluginUnusedImports from "eslint-plugin-unused-imports";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -25,6 +27,8 @@ export default [
{
plugins: {
import: fixupPluginRules(_import),
"@typescript-eslint": tsPlugin,
"unused-imports": eslintPluginUnusedImports,
},

languageOptions: {
Expand All @@ -34,10 +38,34 @@ export default [
},

rules: {
// Import rules
"import/order": ["error"],
"import/no-unused-modules": ["error"],
"import/no-namespace": ["error"],
"unused-imports/no-unused-imports": ["error"],

"import/no-useless-path-segments": ["error"],
"react/destructuring-assignment": ["error", "always"],

// Coding style rules
"comma-dangle": ["error", "always-multiline"],
"no-unreachable": ["error"],
"prefer-const": ["error"],
"no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": ["error"],
semi: ["error", "always"],

// Identation rules
indent: ["error", 2],

"no-restricted-properties": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/src/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import * as React from "react";
import React from "react";
import { Box } from "@mui/material";
import {
OIDCSecure,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
"use client";
import React, { useEffect, useMemo, useState } from "react";
import React, { useMemo, useState } from "react";
import { useOidcAccessToken } from "@axa-fr/react-oidc";
import {
fetcher,
useOIDCContext,
} from "@dirac-grid/diracx-web-components/hooks";
import {
Alert,
Box,
Button,
Snackbar,
TextField,
Typography,
} from "@mui/material";
import { Alert, Box, Button, Snackbar, TextField } from "@mui/material";
import {
createColumnHelper,
getCoreRowModel,
Expand Down Expand Up @@ -55,17 +48,13 @@ export default function OwnerMonitor() {
name, // Set the name
}));
setOwners(transformedData);
} catch (err) {
} catch {
setError("Failed to fetch owners");
} finally {
setIsLoading(false);
}
};

useEffect(() => {
fetchOwners();
}, [accessToken]);

// Handle adding a new owner
const handleAddOwner = async () => {
if (!ownerName) return setError("Owner name cannot be empty.");
Expand All @@ -78,7 +67,7 @@ export default function OwnerMonitor() {
setSuccess(`Owner "${ownerName}" added successfully.`);
setOwnerName("");
fetchOwners(); // Refresh the owners list
} catch (err) {
} catch {
setError("Failed to add owner.");
}
};
Expand Down
Loading