1#!/usr/bin/env bash
2
3set -eo pipefail
4
5script_dir="$(dirname "$0")"
6
7args=()
8
9# If the command is used like `yarn lint plugin` then set the target to `plugin/src`
10if [ "$1" == "plugin" ]; then
11  # Push the rest of the arguments minus the `plugin` arg
12  args+=("${@:2}")
13  args+=("plugin/src")
14  if ! [[ -d plugin ]]; then
15    # Good DX cuz Expo
16    printf "\n\033[1;33mThe \`plugin/src\` folder does not exist in this project; please create it and try again.\033[0m\n\n"
17    exit 0
18  fi
19else
20  args+=("$@")
21  args+=("src")
22fi
23
24"$script_dir/expo-module-eslint" "${args[@]}"
25