21 lines
896 B
Bash
21 lines
896 B
Bash
#!/bin/bash
|
|
|
|
#ddev-generated
|
|
## Command provided by https://github.com/ddev/ddev-drupal-contrib
|
|
## Description: Run eslint inside the web container
|
|
## Usage: eslint [flags] [args]
|
|
## Example: "ddev eslint"
|
|
## ExecRaw: true
|
|
|
|
if "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --version >/dev/null ; then
|
|
# Configure prettier
|
|
test -e .prettierrc.json || ln -s $DDEV_DOCROOT/core/.prettierrc.json .
|
|
test -e .prettierignore || echo '*.yml' > .prettierignore
|
|
# Change directory to the project root folder
|
|
cd "$DDEV_DOCROOT/modules/custom/$DDEV_SITENAME" || exit
|
|
"$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/eslint" --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core --ext=.js,.yml . "$@"
|
|
else
|
|
echo "eslint is not available. You may need to 'ddev yarn --cwd $DDEV_DOCROOT/core install'"
|
|
exit 1
|
|
fi
|