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

ddev eslint breaks due to hyphens in project name #56

Open
jameswilson opened this issue May 26, 2024 · 5 comments
Open

ddev eslint breaks due to hyphens in project name #56

jameswilson opened this issue May 26, 2024 · 5 comments

Comments

@jameswilson
Copy link

Problem Statement

I see the following error:

$ ddev eslint
/mnt/ddev_config/commands/web/eslint: line 16: cd: web/modules/custom/my-module: No such file or directory
Failed to run eslint : exit status 1

The problematic line is this one:

cd "$DDEV_DOCROOT/modules/custom/$DDEV_SITENAME"

Ddev doesn't allow you to create a project name with underscores in it, because it creates an invalid domain name. Therefore, module names that contain underscores (eg "my_module") must be converted to hyphens for the Ddev project name.

When this happens the module name (my_module) is not the same as the Ddev project name (my-module, and so cd web/modules/custom/my-module will fail.

Proposed resolution

If possible refactor the eslint command file to execute eslint from the project root folder ( like all of the other commands currently do). Pass in the path to the project folder as a flag or option to the eslint command, ideally using wildcard syntax $DDEV_DOCROOT/modules/custom/* so that we don't have to decypher the actual project folder name. (I don't think we have an environment variable for this).

@xpersonas
Copy link

I'm hitting same issue. All my modules have underscores. I don't know if there's a workaround at this time. If so, please let me know. Just got up and running with this project today so it's all pretty new to me.

@rfay
Copy link
Member

rfay commented Jul 12, 2024

Related: will be automatically replaced with hyphen in next DDEV release, but of course you can do the same manually right now in the .ddev/config.yaml.

@weitzman
Copy link
Collaborator

So can this issue be closed?

@rfay
Copy link
Member

rfay commented Aug 13, 2024

In DDEV v1.23.4, projects automatically are named with underscores replaced with hyphens. Maybe a PR can add ddev_version_constraint: '>=v1.23.4' as a solution to this and not have to do anything else.

@hanoii
Copy link
Contributor

hanoii commented Oct 28, 2024

I think this was fixed on #81

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

No branches or pull requests

5 participants