Detecting undefined variables
Unanswered
Polish posted this in #help-forum
PolishOP
I tried the following code but it did not detect undefined variables. Any suggestions?
Next v15.3.2
eslint v9
Next v15.3.2
eslint v9
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended
});
const eslintConfig = [
...compat.config({
extends: [
"next",
"next/core-web-vitals",
"eslint:recommended",
"plugin:react/recommended"
],
rules: {
"no-undef": "error",
"no-use-before-define": "error"
},
})
];
export default eslintConfig;