---
lint:prettier:
  stage: lint
  image:
    name: megabytelabs/prettier-write:slim
    entrypoint: ['']
  allow_failure: true
  rules:
    - if: $DO_CI == 'false'
      when: never
    - if: $CI_COMMIT_BRANCH == 'synchronize'
      when: never
  needs: []
  variables:
    GIT_DEPTH: 1
    NODE_MODULES_PATH: /usr/local/lib/node_modules
    PRETTIER_CONFIG: '@mblabs/prettier-config'
  before_script:
    - git config pull.ff only
    - git checkout "$CI_COMMIT_REF_NAME"
    - git pull origin "$CI_COMMIT_REF_NAME"
  script:
    - set -eo pipefail
    - echo "***Prettier Configuration*** ---> $PRETTIER_CONFIG"
    - cat "$NODE_MODULES_PATH/$PRETTIER_CONFIG/index.js"
    - prettier --config "$NODE_MODULES_PATH/$PRETTIER_CONFIG/index.js" --list-different .
