old_contents: import shutil
  import os
  import json
  from subprocess import call
  
  from django.apps import apps
  from django.core.management.base import BaseCommand
  from django.core.management import call_command
  from django.conf import settings
  
  
  class Command(BaseCommand):
      help = 'Check JavaScript files with ESLint'
  
      def add_arguments(self, parser):
          parser.add_argument(
              '--fix',
              action='store_true',
              dest='fix',
              default=False,
              help='Whether to also attempt to fix files'
          )
  
      def handle(self, *args, **options):
          call_command("npm_install")
          shutil.os.chdir(settings.PROJECT_PATH)
          apps_paths = []
          for app in list(apps.get_app_configs()):
              apps_paths.append(app.path)
          os.environ['DJANGO_APPS_PATHS'] = json.dumps(apps_paths)
          command_array = [
              os.path.join(
                  settings.PROJECT_PATH,
                  ".transpile/node_modules/.bin/eslint"
              ),
              "--max-warnings=0",
              "--ignore-path",
              os.path.join(
                  settings.SRC_PATH,
                  ".eslintignore"
              ),
              "-c",
              os.path.join(
                  settings.SRC_PATH,
                  ".eslintrc.js"
              ),
              "."
          ]
          if options['fix']:
              command_array.append('--fix')
          return_value = call(command_array)
          if return_value > 0:
              exit(return_value)
  
new_contents: import shutil
  import os
  import json
  from subprocess import call
  
  from django.apps import apps
  from django.core.management.base import BaseCommand
  from django.core.management import call_command
  from django.conf import settings
  
  
  def dir_path(path):
      if os.path.isdir(path):
          return path
      else:
          raise argparse.ArgumentTypeError(f"readable_dir:{path} is not a valid path")
  
  class Command(BaseCommand):
      help = 'Check JavaScript files with ESLint'
  
      def add_arguments(self, parser):
          parser.add_argument(
              'dir',
              nargs='?',
              default='.',
              help='Directory to check'
          )
          parser.add_argument(
              '--fix',
              action='store_true',
              dest='fix',
              default=False,
              help='Whether to also attempt to fix files'
          )
  
      def handle(self, *args, **options):
          call_command("npm_install")
          shutil.os.chdir(settings.PROJECT_PATH)
          apps_paths = []
          for app in list(apps.get_app_configs()):
              apps_paths.append(app.path)
          os.environ['DJANGO_APPS_PATHS'] = json.dumps(apps_paths)
          command_array = [
              os.path.join(
                  settings.PROJECT_PATH,
                  ".transpile/node_modules/.bin/eslint"
              ),
              "--max-warnings=0",
              "--ignore-path",
              os.path.join(
                  settings.SRC_PATH,
                  ".eslintignore"
              ),
              "-c",
              os.path.join(
                  settings.SRC_PATH,
                  ".eslintrc.js"
              ),
              options['dir'],
          ]
          if options['fix']:
              command_array.append('--fix')
          return_value = call(command_array)
          if return_value > 0:
              exit(return_value)
  
subject: add optional dir argument to lint_js