Undefined browser extension response

I have communication between background and content scripts

Basically it looks like:

// background script fragment

const url = 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
(async () => {
  const tab = await chrome.tabs.create({ url });

  await new Promise(resolve => setTimeout(resolve, 2000));

  if (tab.id !== undefined) {
    const response = await chrome.tabs.sendMessage(tab.id, { action: 'EXTRACT_TAB_DATA', url });
    // case "extract text from PDF" -- undefined
    // case "set text by copy and paste" -- object with key result == "Dummy PDF file copy pasted content"
    console.log(response);
  }
})();
// case "extract text from PDF" content script fragment

import * as pdfjsLib from 'pdfjs-dist';
pdfjsLib.GlobalWorkerOptions.workerSrc = chrome.runtime.getURL('pdf.worker.js');


chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
  if (message.action === 'EXTRACT_TAB_DATA') {
    const pdfData = await fetch(message.url).then(res => res.arrayBuffer());
    const pdf = await pdfjsLib.getDocument({ data: pdfData }).promise;

    let text = '';
    for (let i = 1; i <= pdf.numPages; i++) {
      const page = await pdf.getPage(i);
      const content = await page.getTextContent();
      text += content.items.map((item: any) => item.str).join(' ') + 'n';
    }

    console.log(text); // here everything as expected: text is in console

    sendResponse({ result: text });

    return true;
  }

  return true;
});

// case "set text by copy and paste" content script fragment

import * as pdfjsLib from 'pdfjs-dist';
pdfjsLib.GlobalWorkerOptions.workerSrc = chrome.runtime.getURL('pdf.worker.js');


chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
  if (message.action === 'EXTRACT_TAB_DATA') {
    const text = 'Dummy PDF file copy pasted content';
    sendResponse({ result: text });

    return true;
  }

  return true;
});

used version of pdfjs-dist is ^2.16.105. basically it doesn’t matter the version. matter result of extracting and sending back to background script

my manifest file fragment

{
  "manifest_version": 3,
  "action": {
    "default_title": "Open sidebar",
    "default_icon": "img/logo-48.png"
  },
  "options_page": "options.html",
  "background": {
    "service_worker": "service-worker-loader.js",
    "type": "module"
  },
  "content_scripts": [
    {
      "matches": [
        "http://*/*",
        "https://*/*"
      ],
      "js": [
        "src/contentScript/index.ts-loader.js"
      ]
    }
  ],
  "web_accessible_resources": [
    {
      "resources": [
        "img/logo-16.png",
        "img/logo-32.png",
        "img/logo-48.png",
        "img/logo-128.png"
      ],
      "matches": []
    },
    {
      "matches": [
        "<all_urls>"
      ],
      "resources": [
        "**/*",
        "*"
      ],
      "use_dynamic_url": false
    }
  ],
  "permissions": [
    "sidePanel",
    "storage",
    "identity",
    "activeTab",
    "tabs",
    "scripting"
  ],
  "host_permissions": [
    "<all_urls>"
  ]
}

what is wrong with sending back message from content to background script in case extract from pdf?

How do I get this attribute value from an element?

I add my nodes in elements and then I want edges to be generated for each node according to certain node attributes (node ID for target, and a new property “origin” for source).

I’m having trouble getting that origin value into the new edge data — trying to use ele.data().

var cy = cytoscape({
  container: document.getElementById('cy'),
  layout: {
    name: 'cose'
  },
  style: [
    {
      selector: 'node',
      style: {
        'label': 'data(label)',
        'color': '#fff'
      }
    },
    {
      selector: 'edge',
      style: {
        'line-color': '#fff'
      }
    }
  ],
   elements: [
    { data: { id: 'n101', label: 'Node 1', origin: 'n104' } }, // Maybe I'm not creating the origin value correctly? No I have to do something else?
    { data: { id: 'n102', label: 'Node 2', origin: 'n101' } },
    { data: { id: 'n103', label: 'Node 3', origin: 'n102' } },
    { data: { id: 'n104', label: 'Node 4', origin: 'n103' } }
  ]
});

cy.nodes().forEach(function( ele ){
    cy.add({
      group: 'edges',
      data: { source: ele.data(origin), target: ele.id() }
      /*  ele.id() works to set the target, but
          I don't know if I'm using ele.data()
          correctly. If I replace it with something
          like 'n101', the edges get made, so I
          assume this is where my issue is? */
    })
});

Scroll event behavior changed in Chrome (now flickers on virtual scrolling)

I have a long experience with virtual tables, my latest implementation in Vue. It’s complex, the table rows have child components, etc. So a virtual table would work for years without seeing re-rendering of the updated rows, for example the new rows at the top or the bottom in Chrome. In Firefox the re-rendering was always visible. In some latest build of Chrome the re-rendering became visible in Chrome too which is greatly ruins UX. No code changes were introduced (in fact, the old version of the virtual grid started behave the same).

So my question: is anybody aware of some recent changes in Chrome’s rendering (especially on a scroll event).

I’ve tried to recreate a vue virtual table in the playground. You could see a heavy scroll listener, so the scrolling is heavy/lagging, BUT no flickering. Unfortunately the very first version of my Vue virtual table flickers so there’s no way to catch with git bisect when it started flickering. So maybe some Chrome hack is available, or at least to understand why Chrome started flickering on scrolling.

Oops.. Failed to load Errors in Telegram browser

enter image description here

Hello Everyone! I have problem with telegram browser. Firstly web site open but 4,5 second after output error (Oops.. Failed to load website)

How to find solution of problem, I cannot open browser console so I’m having trouble finding the error.How can I get rid of the error or how can I find the problem?

How does click event behavior work when dragging?

I’m experiencing unexpected behavior click and drag events between a div and the body in JavaScript.

Here’s the behavior I’m seeing when I click and drag:

  • Start in the floating div, release in body → logs Body Event
  • Start and release in floating → logs Floating Event
  • Start in body, release in floating → logs Body Event
  • Start and release in body → logs Body Event

The surprising case is the third one: Why doesn’t the click event fire on the floating div when I release the mouse over it, even though the mouseup happens on it?

Here’s the setup:

document.getElementById('floating').addEventListener('click', (e) => {
  e.stopPropagation();
  console.log('Floating Event');
});

document.body.addEventListener('click', () => {
  console.log('Body Event');
});
body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.floating-object {
  position: absolute;
  top: 60px;
  left: 200px;
  width: 150px;
  height: 150px;
  background: orange;
  border-radius: 50%;
  z-index: 1002;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
<div class="floating-object" id="floating"></div>

PDF FOLDER NOT STORE IN PLESK

I created a simple Laravel application on Plesk.

I tried to store some PDF files in public/storage/pdf, and I saved the file path in the database as a VARCHAR.

However, the PDF file is not being stored in that folder.
Please help me — I am new to web hosting and Laravel.

    //ivocontorller
    <?php

    namespace AppHttpControllers;

    use IlluminateHttpRequest;
    use AppModelsivo_input;
    use IlluminateSupportFacadesStorage; // Import Storage facade for file handling

    class IvoController extends Controller
    {
        public function index()
        
        {
             $ivo=ivo_input::all();
             return view('IVO.bootstaps',['ivo'=>$ivo]);  // Assuming you have a view named 'ivo.index'
            // Retrieve all records from the ivo_input tableS
        }

        public function show()
        
        {
             $ivo=ivo_input::all();
             return view('IVO.show',['ivo'=>$ivo]);  // Assuming you have a view named 'ivo.index'
            // Retrieve all records from the ivo_input tableS
        }

        public function create(){return view('IVO.create');  // Assuming you have a view named 'ivo.create'
        }

        public function store(Request $request)
    {
        // Validate the request inputs
        $data = $request->validate([
            'description' => 'required',
            'type' => 'required',
            'job_title' => 'required',
            'department' => 'required',
            'Jd_pdf' => 'required', // PDF only, max 2MB
        ]);

        // Store the PDF and get its path
        $path = $request->file('Jd_pdf')->store('storage/pdf', 'public');

        //dd($path); // Debugging line to check the file path

        // Add the file path to the data array
        $data['Jd_pdf'] = $path;

        // Create the new record in the database
        ivo_input::create($data);

        // Redirect to index route
        return redirect(route('ivo.index'));
    }


        public function edit( ivo_input $ivo)//kena letak model sama dengan dia punya variable yang di pass
        {
         //return view('ivo.edit', ['ivo' => $ivo]); //ivo edit ada value pass the value

          return view('IVO.edit', ['ivo' => $ivo]); //ivo edit ada value pass the value
         
        }

        public function update(Request $request, ivo_input $ivo)
        {
                 $data= $request->validate([
                'description' => 'required',
                'type' => 'required',
                'job_title' => 'required',
                'department' => 'required',
                 ]);

            $ivo->update($data); // Update the record in the ivo_input table
            return redirect(route('ivo.index'))->with('success','Vacancy Updated Successffully'); // Redirect to the index route
        }

        public function destroy(ivo_input $ivo)
        {
            // Delete the file from storage if it exists

        if ($ivo->Jd_pdf && Storage::disk('public')->exists($ivo->Jd_pdf)) {
            Storage::disk('public')->delete($ivo->Jd_pdf);
        }
            $ivo->delete(); // Delete the record from the ivo_input table
            return redirect(route('ivo.index'))->with('success', 'Vacancy Deleted Successfully'); // Redirect to the index route
        }

    }

<ivo_input>(model controller)

<?php

namespace AppModels;

use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentFactoriesHasFactory;
class ivo_input extends Model //nama kena sama dengan nama table dalam database, kalau tak sama kena guna protected $table
{
use HasFactory;

protected $table = 'ivo_tables'; // guna ni kalau nama model lain dengan nama table
protected $fillable = [
'description',
'type',
'job_title',
'department',
'Jd_pdf',
];
}
viewer

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round|Open+Sans">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="{{ asset('/resources/css/bootsrap.css') }}">
{{-- Rasa tak perlu import pun sebab bootstrap tu dah siap ada --}}
{{-- nanti nak letak js atau css masuk dalam public folder --}}
{{-- ni tak boleh odan, rasa sebab bukan dalam file public tu dia tak boleh nak access, simpan dalam public okay ? --}}

{{-- <link rel="stylesheet" href="../resources/css/bootsrap.css"> --}}

{{-- <div class="btn btn-primary">asdasdasd</div> --}}
<script src="{{ url('/resources/js/template.js') }}"></script>
</head>
<body>
<div class="container-lg">
<div class="table-responsive">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-8"><h2>VACANCY OPENING <b>Details</b></h2></div>
<div class="col-sm-4">
<button type="button" class="btn btn-info add-new" onclick="window.location.href='{{ route('ivo.create') }}'">
<i class="fa fa-plus"></i> Add New
</button>

</div>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Job Title</th>
<th>Job Description</th>
<th>Job Position</th>
<th>Status</th>
<th>Department</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>

@foreach($ivo as $ivos)
<tr>
<td>{{ $ivos->job_title }}</td>
<td> <a href="{{ asset($ivos->Jd_pdf) }}" target="_blank">View PDF</a></td>
<td>{{ $ivos->description }}</td>
<td>{{ $ivos->type }}</td>
<td>{{ $ivos->department }}</td>
<td>
<a href='{{ route('ivo.create') }}'class="add" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>

<a href="{{ route('ivo.edit', $ivos->id) }}" class="edit" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
{{-- <a class="add" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a> --}}
</td>
<td>
<form method="post" action="{{ route('ivo.destroy', $ivos->id) }}">
@csrf
@method('delete')
<button type="submit" class="delete" title="Delete" data-toggle="tooltip" style="background: none; border: none; margin: 0%;">
<i class="material-icons">&#xE872;</i>
</button>
</form>

</td>

</tr>
@endforeach
{{-- <tr>
<td>John Doe</td>
<td>Administration</td>
<td>(171) 555-2222</td>
<td></td>
<td>
<a class="add" title="Add" data-toggle="tooltip"><i class="material-icons">&#xE03B;</i></a>
<a class="edit" title="Edit" data-toggle="tooltip"><i class="material-icons">&#xE254;</i></a>
<a class="delete" title="Delete" data-toggle="tooltip"><i class="material-icons">&#xE872;</i></a>
</td>
</tr> --}}

</tbody>
</table>
</div>
</div>
</div>
</body>
</html>

i managed to insert data into database but not able to store in pdf file.

Wocommerce PHP – MYSQL Get sets of values of products and variations variation exists

I am having a nightmare with getting data in the format I need using mysql/php. I have a query which gives me all the details I need for a product, but this also feeds me the main product details for a variable product.

I have tried and tried to make a simple query to just get variation details but for some reason getting no luck.

My aim is to get a the details for each product, and then all the same details for the variation IF the product has a variation – and if it has a variation, I do not need the main product for it, just the variations details.

Below is my query to get the details I want for a product but, I can not get the variations details no matter what I do. Can anyone help?

    SELECT ID, post_title, guid, post_type, sku_meta.meta_value AS `SKU`, 
stock_meta.meta_value AS 'QTY', 
salesprice_meta.meta_value AS 'SALEPRICE', 
ean_meta.meta_value AS 'EAN',
regularprice_meta.meta_value AS 'RRP'
FROM wp_posts
LEFT JOIN wp_postmeta sku_meta on wp_posts.ID = sku_meta.post_id
  AND sku_meta.meta_key = '_sku'
  LEFT JOIN wp_postmeta stock_meta on wp_posts.ID = stock_meta.post_id
  AND stock_meta.meta_key = '_stock'
  LEFT JOIN wp_postmeta salesprice_meta on wp_posts.ID = salesprice_meta.post_id
  AND salesprice_meta.meta_key = '_price'
  LEFT JOIN wp_postmeta ean_meta on wp_posts.ID = ean_meta.post_id
  AND ean_meta.meta_key = '_global_unique_id'
  LEFT JOIN wp_postmeta regularprice_meta on wp_posts.ID = regularprice_meta.post_id
  AND regularprice_meta.meta_key = '_regular_price'
WHERE post_type = 'product'

How to fix “Undefined Array Key ‘id’ Error” of the Dashboard Page (After Login)? [duplicate]

Can anyone help me how to fix the Undefined Array Key ‘id’ Error in Dashboard Page (Welcome Page) After Redirect from Login Page?
Thank You…

In Login Page:

<?php 
    session_start(); 
    if(isset($_POST['submit'])) { 
    extract($_POST); 
    include 'database.php'; 
    $sql = mysqli_query($conn,"SELECT * FROM registration where regno='$regno' and pass='$pass'"); 
    $row = mysqli_fetch_array($sql); 

    if(is_array($row)) { 
    if($_SESSION["captcha"] == $_POST["captcha"]) {

    $_SESSION["id"] = $row['id'];  
    header("Location: dashboard.php"); 

    } else {
    echo "Invalid CAPTCHA Code!";
    }} else {
    echo "Invalid Reg ID or Password!";
    }
    }
?>

Where $regno = Registration Number, $pass = Password & “captcha” = CAPTCHA Code

I’ve tried in Dashboard Page:

<?php
    session_start();
    include 'database.php';
    $id = $_SESSION["id"];
    $sql = mysqli_query($conn,"SELECT * FROM registration where id='$id'");
    $row = mysqli_fetch_array($sql);

    if(!isset($_SESSION['id'])){
    header("Location: login.php");
    exit();
    }
?>

It shows “Undefined Array Key ‘id’ Error” in dashboard.php
Any help?

How to Replace DOCX Placeholder with Formatted HTML in PHPWord

I’m using the PHPWord package in Laravel to replace placeholders in a DOCX template.

I have a placeholder ${html} in my DOCX file, and I’m trying to replace it with HTML content like:
<p>Hello,<br><br><strong>Welcome</strong></p>

Currently, PHPWord is inserting the raw HTML tags as text, but I want the content to be rendered with proper formatting (bold text, line breaks, etc.).

I’ve checked the PHPWord documentation but couldn’t find a clear solution for HTML parsing. Any suggestions or examples would be appreciated.

I am trying to understand how to upload a file to this code

I’m trying to make a little script for my home network but I don’t entirely understand how to use curl with the mytestupload.php script could someone maybe help explain how I can post my file to it and what I’m doing wrong here?

mytestupload.php below

<?php 

    function jss($data)
    {
        echo json_encode( $data );
    }

    $comm = $_POST['cmd'];

    if( !empty( $comm ) ){

        if( $comm == "test" ){

            jss(array(
                "code" => 200,
            ));

        }

        if( $comm == "mkdir" ){

            $tmp_dir = $_POST['dir'];

            mkdir( $tmp_dir );
            chmod( $tmp_dir , 0755 );

            jss(array(
                "code" => 200,
            ));

        }

        if( $comm == "upload" ){

            $post_file = $_POST['file'];
            $post_data = $_POST['data'];

            $post_data_enc = base64_decode( $post_data );

            file_put_contents( $post_file , $post_data_enc );
            chmod( $post_file , 0644 );

            jss(array(
                "code" => 200,
            ));

        }

    }

I thought this command would work but it seems I am missing something:

$ curl -F 'file=@/tmp/test.txt' -F 'cmd=upload' http://127.0.0.1/mytestupload.php
{"code":200}

It returned 200 but I don’t know why the file doesn’t upload

Can someone explain how to fix my curl command to work ? I was expecting a file to show up in my folder but I’m not getting something right.

Any help really appreciated!

throw new TypeError(‘argument handler must be a function’) | node_modulesrouterindex.js | node.js

Error I’m facing :
enter image description here

My server file :

const express = require('express');
const cors = require('cors');

const todoRoutes = require('./routes/todoRoutes');

const app = express();
// To remove  res.setHeader('X-Powered-By', 'Express'); error :
app.disable('x-powered-by');

//midlleware 
app.use(cors());
app.use(express.json()); 

// Routers :
app.use('/api/todo', todoRoutes); 


app.listen(5000);  

Router file :

const express = require('express');

const router = express.Router();

const todoController = require('../controller/todoController'); 

router.route('/').post(todoController.addTodo).get(todoController.getTodo);
router.route('/:id').get(todoController.getTodoByID).put(todoController.updateTodo).delete( todoController.deleteTodo);

Controller file :

const pool = require("../db");

const addTodo = async (req, res, next) => {
    try {
        const { description } = req.body;
        const newTodo = await pool.query(
          "INSERT INTO todo (description) VALUES($1) RETURNING *",
          [description]
        );
    
        res.json(newTodo.rows[0]);
      } catch (err) {
        console.error(err.message);
      }
};


module.exports = { addTodo };

I’m unable to understand what’s wrong?

How to filter pokemon locations by game version?

I have a version (eg. diamond-pearl) and want to filter encounters. The encounters return data like diamond. I can do a simple string check (which I currently do), but this is not ideal because it isn’t perfect. I could hard code each one but this defeats the purpose of an API and requires updating any time new data is entered, which is somthing I 100% want to avoid.

Current implementation (svelte 5):

let filteredEncounters = $derived.by(() => {
        console.log(encounters);
        if (version === 'all') return encounters;

        return encounters
            .map((e) => {
                // TODO: Stupid string match: checks if `version` (eg. `diamond-pearl`) includes `version.name` (eg. `diamond`)
                // In the future, we need to map games and versions which are different
                const matchingVersions = e.version_details.filter((v) => version.includes(v.version.name));

                if (matchingVersions.length > 0) {
                    return {
                        ...e,
                        version_details: matchingVersions
                    };
                }

                return null;
            })
            .filter(Boolean);
    });

How to migrate my CRA .eslintrc.js config to eslint.config.js in a new Vite + React 19 app

I’m trying to set up the same ESLint configuration in my new React 19 + Vite app using the modern eslint.config.js format. However, it’s not working — the linter doesn’t show any errors or warnings in the editor.
New eslint.config.js

import pluginReact from "eslint-plugin-react";
import { defineConfig } from "eslint/config";

import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import prettier from "eslint-plugin-prettier";
import importPlugin from "eslint-plugin-import";
import react from "eslint-plugin-react";
import jsxA11y from "eslint-plugin-jsx-a11y";

export default defineConfig([
  { ignores: ["dist"] },
  {
    files: ["**/*.{js,mjs,cjs,jsx}"],
    languageOptions: {
      ecmaVersion: 2020,
      globals: globals.browser,
      parserOptions: {
        ecmaVersion: "latest",
        ecmaFeatures: { jsx: true },
        sourceType: "module",
      },
    },
    plugins: {
      "react-hooks": reactHooks,
      "react-refresh": reactRefresh,
      prettier,
      import: importPlugin,
      react,
      "jsx-a11y": jsxA11y,
    },
    rules: {
      ...js.configs.recommended.rules,
      ...reactHooks.configs.recommended.rules,
      // "no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }],
      // "no-undef": ["error", { globals: { process: true } }],
      // Vite React specific
      "react-refresh/only-export-components": [
        "warn",
        { allowConstantExport: true },
      ],

      // Your custom rules from old config
      "prettier/prettier": "off",
      "no-nested-ternary": "off",
      "no-underscore-dangle": "off",
      "default-param-last": "off",
      "prefer-arrow-callback": "error",
      camelcase: ["error", { properties: "never", ignoreDestructuring: true }],
      "no-else-return": ["error", { allowElseIf: true }],
      "no-param-reassign": ["error", { props: false }],

      // Import rules
      "import/no-extraneous-dependencies": [
        "error",
        {
          devDependencies: false,
          optionalDependencies: false,
          peerDependencies: false,
        },
      ],
      "import/order": [
        "error",
        {
          pathGroups: [
            {
              pattern: "react",
              group: "external",
              position: "before",
            },
          ],
          pathGroupsExcludedImportTypes: ["builtin"],
        },
      ],
      "import/no-unused-modules": ["error", { unusedExports: true }],

      // React rules
      "react/require-default-props": "off",
      "react/jsx-no-undef": ["error", { allowGlobals: true }],
      "react/jsx-uses-vars": "error",

      // Best Practices
      eqeqeq: "error",
      "no-invalid-this": "error",
      "no-return-assign": "error",
      "no-unused-expressions": ["error", { allowTernary: true }],
      "no-useless-concat": "error",
      "no-useless-return": "error",
      "no-use-before-define": "error",
      "no-duplicate-imports": "error",
      "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],

      // Variable and import rules
      "no-undef": "error",
      "no-unused-vars": [
        "error",
        {
          vars: "all",
          args: "after-used",
          ignoreRestSiblings: true,
          varsIgnorePattern: "^[A-Z_]", // Keep the pattern from new config
        },
      ],
    },
    settings: {
      react: {
        version: "detect",
      },
    },
  },
  pluginReact.configs.recommended,
]);

This is the ESLint config I used successfully in my older CRA app (.eslintrc.js):

  env: {
    browser: true,
    es2021: true,
    node: true,
  },
  extends: ["prettier"],

  plugins: ["prettier", "import", "react", "react-hooks", "jsx-a11y"],
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 12,
    sourceType: "module",
  },
  rules: {
    "prettier/prettier": "off",
    "no-nested-ternary": "off",
    "react/require-default-props": "off",
    "no-underscore-dangle": ["off"],
    "default-param-last": "off",
    "prefer-arrow-callback": "error",
    camelcase: ["error", { properties: "never", ignoreDestructuring: true }],
    "no-else-return": ["error", { allowElseIf: true }],
    "no-param-reassign": ["error", { props: false }],
    // Best Practices
    "import/no-extraneous-dependencies": [
      "error",
      {
        devDependencies: false,
        optionalDependencies: false,
        peerDependencies: false,
      },
    ],
    eqeqeq: "error",
    "no-invalid-this": "error",
    "no-return-assign": "error",
    "no-unused-expressions": ["error", { allowTernary: true }],
    "no-useless-concat": "error",
    "no-useless-return": "error",
    "no-use-before-define": "error",
    "no-duplicate-imports": "error",
    "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
    "import/order": [
      "error",
      {
        pathGroups: [
          {
            pattern: "react",
            group: "external",
            position: "before",
          },
        ],
        pathGroupsExcludedImportTypes: ["builtin"],
      },
    ],
    // Ensure components are imported if used
    "react/jsx-no-undef": ["error", { allowGlobals: true }],
    // Ensure all variables are declared before use
    "no-undef": "error",
    // Ensure there are no unused variables
    "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
    // Ensure there are no unused imports
    "import/no-unused-modules": ["error", { unusedExports: true }],
    // Mark variables used in JSX as used
    "react/jsx-uses-vars": "error",
  },
  settings: {
    react: {
      version: "detect",
    },
  },
};

I did try npm run lint but I get this
Oops! Something went wrong! 🙁

ESLint: 9.28.0

ESLint couldn’t find a configuration file. To set up a configuration file for this project, please run:

`npm init @eslint/config@latest`

And if I run this command, it resets full eslint.config.js file

But I’m not sure how to properly convert or apply it to the new flat config (eslint.config.js).
Any ideas on how to correctly set it up so ESLint works in the new environment?