/* eslint-disable import/extensions */
/**
 * ESLint config for projects using @shopify/shop-minis-react
 * @fileoverview Recommended ESLint configuration for Shop Minis apps
 *
 * This config uses ESLint flat config format (supported in ESLint 8.57+)
 */

// Import the plugin directly so consumers don't need to install it separately
const reactPlugin = require('eslint-plugin-react')

const shopMinisPlugin = require('./index.cjs')

module.exports = {
  files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
  languageOptions: {
    parser: require('@typescript-eslint/parser'),
    ecmaVersion: 'latest',
    sourceType: 'module',
    parserOptions: {
      ecmaFeatures: {
        jsx: true,
      },
    },
  },
  plugins: {
    'shop-minis': shopMinisPlugin,
    react: reactPlugin,
  },
  rules: {
    'no-console': 'warn',
    'react/no-danger': 'error',
    'shop-minis/no-internal-imports': 'error',
    'shop-minis/prefer-sdk-components': 'warn',
    'shop-minis/prefer-sdk-hooks': 'warn',
    'shop-minis/validate-manifest': 'error',
  },
}
