@@ -11,6 +11,9 @@ Usage: ddev eslint-fix [args]
1111
1212Applies ESLint fixes directly to files (matches standard eslint --fix behavior).
1313
14+ Defaults:
15+ - Uses --quiet (GitLab CI parity). Set DCQ_ESLINT_QUIET=0 to include warnings.
16+
1417Use --preview to see a patch preview and confirm before applying fixes.
1518This generates a patch in dcq-reports/ and prompts for confirmation.
1619
@@ -31,6 +34,11 @@ preview_mode=false
3134clean_args=()
3235ESLINT_TOOLCHAIN=" ${ESLINT_TOOLCHAIN:- auto} "
3336ESLINT_CONFIG_MODE=" ${ESLINT_CONFIG_MODE:- nearest} "
37+ DCQ_ESLINT_QUIET=" ${DCQ_ESLINT_QUIET:- 1} "
38+ QUIET_ENABLED=1
39+ case " $DCQ_ESLINT_QUIET " in
40+ 0|false|FALSE|False|no|NO|off|OFF) QUIET_ENABLED=0 ;;
41+ esac
3442
3543for arg in " $@ " ; do
3644 if [ " $arg " = " --preview" ]; then
@@ -191,7 +199,11 @@ else
191199 done
192200fi
193201
194- CMD_BASE=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --quiet)
202+ CMD_BASE=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " )
203+ DEFAULT_ARGS=()
204+ if [ " $QUIET_ENABLED " -eq 1 ]; then
205+ DEFAULT_ARGS+=(--quiet)
206+ fi
195207if [ -n " $RESOLVE_PLUGINS_DIR " ]; then
196208 CMD_BASE+=(--resolve-plugins-relative-to " $RESOLVE_PLUGINS_DIR " )
197209fi
@@ -204,6 +216,7 @@ if [ "$has_config" = false ] && [ "$ESLINT_CONFIG_MODE" != "nearest" ]; then
204216 fi
205217fi
206218CMD_BASE+=(--ext .js,.yml --ignore-pattern " **/node_modules/**" )
219+ CMD_BASE+=(" ${DEFAULT_ARGS[@]} " )
207220
208221find_nearest_config () {
209222 local file_path=" $1 "
@@ -410,11 +423,12 @@ if [ "$preview_mode" = true ]; then
410423 config_dir=" $( dirname " $config_path_abs " ) "
411424 plugins_dir=" $( resolve_plugins_dir " $config_dir " ) "
412425 echo " ESLint-fix preview: config ${config_path_abs} (${# filtered_files[@]} file(s))." >&2
413- group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --quiet -- config=" $config_path_run " )
426+ group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --config=" $config_path_run " )
414427 if [ -n " $plugins_dir " ]; then
415428 group_cmd+=(--resolve-plugins-relative-to " $plugins_dir " )
416429 fi
417430 group_cmd+=(--ext .js,.yml --ignore-pattern " **/node_modules/**" --fix)
431+ group_cmd+=(" ${DEFAULT_ARGS[@]} " )
418432 (cd " $tmp_root " && " ${group_cmd[@]} " " ${filtered_files[@]} " )
419433 status=$?
420434 if [ $status -ne 0 ]; then
@@ -496,11 +510,12 @@ if [ "$preview_mode" = true ]; then
496510 config_dir=" $( dirname " $config_path_abs " ) "
497511 plugins_dir=" $( resolve_plugins_dir " $config_dir " ) "
498512 echo " Applying ESLint fixes: config ${config_path_abs} (${# filtered_files[@]} file(s))." >&2
499- group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --quiet -- config=" $config_path_run " )
513+ group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --config=" $config_path_run " )
500514 if [ -n " $plugins_dir " ]; then
501515 group_cmd+=(--resolve-plugins-relative-to " $plugins_dir " )
502516 fi
503517 group_cmd+=(--ext .js,.yml --ignore-pattern " **/node_modules/**" --fix)
518+ group_cmd+=(" ${DEFAULT_ARGS[@]} " )
504519 " ${group_cmd[@]} " " ${filtered_files[@]} "
505520 status=$?
506521 if [ $status -ne 0 ]; then
@@ -567,11 +582,12 @@ if [ "$ESLINT_CONFIG_MODE" = "nearest" ]; then
567582 fi
568583 config_dir=" $( dirname " $config_path_abs " ) "
569584 plugins_dir=" $( resolve_plugins_dir " $config_dir " ) "
570- group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --quiet -- config=" $config_path_run " )
585+ group_cmd=(env " NODE_PATH=$NODE_PATH " node " $TOOLCHAIN_BIN " --config=" $config_path_run " )
571586 if [ -n " $plugins_dir " ]; then
572587 group_cmd+=(--resolve-plugins-relative-to " $plugins_dir " )
573588 fi
574589 group_cmd+=(--ext .js,.yml --ignore-pattern " **/node_modules/**" --fix)
590+ group_cmd+=(" ${DEFAULT_ARGS[@]} " )
575591 " ${group_cmd[@]} " " ${filtered_files[@]} "
576592 status=$?
577593 if [ $status -ne 0 ]; then
0 commit comments