electrovir / prettier-plugin-multiline-arrays

Prettier plugin to force array elements to wrap onto new lines.
https://www.npmjs.com/package/prettier-plugin-multiline-arrays
Creative Commons Zero v1.0 Universal
136 stars 6 forks source link

Used in prettier_action but got an error #39

Open minchu0x37 opened 1 month ago

minchu0x37 commented 1 month ago

I am using prettier_action in GitHub Actions and the prettier-plugin-multiline-arrays plugin, but I encountered an error when running it. The error is shown below. 1721295068734

My config as blow: `jobs: prettier: runs-on: ubuntu-latest

steps:
  - name: Checkout
    uses: actions/checkout@v3
    with:
      ref: ${{ github.event.pull_request.head.ref }}
  - name: Install prettier plugins
    run: |
      npm install prettier-plugin-multiline-arrays
  - name: Prettify code
    uses: creyD/prettier_action@v4.3
    with:
      prettier_options: --config .prettierrc --check ./**/*.ts
      prettier_plugins: 'prettier-plugin-multiline-arrays'

The .prettierrc file is : { "plugins": ["prettier-plugin-multiline-arrays"], "multilineArraysWrapThreshold": 3, "semi": true, "trailingComma": "all", "singleQuote": true, "printWidth": 120 }`

Why did this error occur?

electrovir commented 1 month ago

That error happens when the plugin's preprocess callback isn't called by Prettier. Specifically, this function was never called: https://github.com/electrovir/prettier-plugin-multiline-arrays/blob/b1fb14403fb94cd1a25e8e0ac6e72e982bcdcb79/src/printer/original-printer.ts#L5-L7

I have no idea why that issue would happen that this specific situation 🤔

minchu0x37 commented 1 month ago

I am also very confused. It runs successfully locally, but it fails when running in GitHub Actions. 🤔