import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import { fileURLToPath } from "url";
import { dirname } from "path";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
  baseDirectory: __dirname,
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all,
});

export default [
  {
    ignores: ["**/build/**", "**/lib/**"],
  },
  ...compat.extends("@spscommerce/eslint-config-typescript"),
  {
    languageOptions: {
      globals: {
        JSX: true,
      },
    },
    rules: {
      "@typescript-eslint/explicit-function-return-type": ["off"],
      "@typescript-eslint/array-element-newline": [0],
    },
  },
];
