Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nx-python): add an optional fix option for the ruff-check executor #275

Conversation

agdimech
Copy link
Contributor

Allows a user to configure whether they want to fix lint errors via nx configurations by setting the fix property to true.

Current Behavior

Users are unable to specify whether a lint task should fix errors via NX configuration

Expected Behavior

Assume I have a targetDefaults in nx.json as follows:

"lint": {
      "cache": true,
      "configurations": {
        "fix": {
          "fix": true
        }
      },
      "inputs": [
        "default",
        "{workspaceRoot}/eslint.config.mjs",
        "{projectRoot}/eslint.config.mjs"
      ]
    }

By specifying fix as true, when the ruff-check executor runs it will append the --fix flag.

I tried working around this via:

"configurations": {
        "fix": {
          "__unparsed__":"--fix"
        }
      }

however NX doesn't respect the inputs passed in and is always resolved to [].

allows a user to configure whether they want to fix lint errors via nx configurations by setting the
fix property to true.
Copy link
Owner

@lucasvieirasilva lucasvieirasilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @agdimech, LTGM

@lucasvieirasilva lucasvieirasilva merged commit 2e20bfe into lucasvieirasilva:main Feb 21, 2025
3 checks passed
Copy link

🎉 This PR is included in version 20.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants