import path from "path";
import { fileURLToPath } from "url";

import { FlatCompat } from "@eslint/eslintrc";
import { defineConfig } from "eslint/config";

import orderConfig from "./imports/order.mjs";

import commonConfiguration from "../../eslint/index.mjs";
import globalsConfig from "../../eslint/globals.mjs";
import enforcedConfig from "../../eslint/imports/enforced.mjs";
import overridesConfig from "../../eslint/overrides.mjs";
import promiseConfig from "../../eslint/promise.mjs";
import reactConfig from "../../eslint/react.mjs";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({ baseDirectory: __dirname });

export default defineConfig([
  ...commonConfiguration,
  ...compat.extends("plugin:@bigbinary/neeto/nanos-recommended"),
  globalsConfig,
  orderConfig,
  overridesConfig,
  enforcedConfig,
  reactConfig,
  promiseConfig,
]);
