casey / casey/just

Feature request: setting for `allow-duplicate-aliases`

Open
#2,774 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
35.8k
Forks
846
Avg merge
27m
Merged PRs (30d)
3

Description

## Problem

I have a scenario where I am duplicating a recipe imported from another `justfile`, and I want to redeclare the `fc` alias:

```justfile
# base.just
[no-cd]
full-check: biome-check prettier-check tsc-check
alias fc := full-check

# inheriting `justfile`
full-check: biome-check prettier-check eslint-check tsc-check
alias fc := full-check
```

Trying to run `full-check` generates this error:

```text
just --list
error: Alias `fc` first defined on line 31 is redefined on line 49
——▶ node_modules/@sablier/devkit/just/base.just:49:7

49 │ alias fc := full-check
```

## Solution

Introduce an `allow-duplicate-aliases` setting.

Or maybe there is no need for this setting, and Just should always allow the inheriting recipe's alias to override the inherited alias?

**Edit**: it looks like if I remove the alias declaration from the inheriting file, the inheriting script gets executed (not the base one), even if the alias is defined in the base file. At any rate, I think this behavior is slightly confusing, and users should be allowed to override aliases if the `allow-duplicate-recipes` setting is enabled.

Maybe this will get solved by https://github.com/casey/just/issues/2349?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.