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

check-line-alignment throwing warnings in GitHub Actions on Windows #745

Closed
TheJaredWilcurt opened this issue May 21, 2021 · 6 comments · Fixed by #763
Closed

check-line-alignment throwing warnings in GitHub Actions on Windows #745

TheJaredWilcurt opened this issue May 21, 2021 · 6 comments · Fixed by #763

Comments

@TheJaredWilcurt
Copy link

So this is a weird one. I added check-line-alignment and it works locally on Windows.

My repo is a cross-platform library, so I run GitHub Actions against it on Linux, OSX, and Windows with Node 14 (and Node 8, but ESLint 7 doesn't support Node 8, so just ignore that).

The weird thing is that only the Windows version is failing. And it isn't failing when ran locally on Windows.

Here is the GHA checks. you can switch between each OS and see that it's only on the Windows branch.

No idea what the cause is, all the code is stored in LF, so unless the GHA Windows VM is cloning in CRLF and I need to change some GHA setting, I don't think it's related to that.

@brettz9
Copy link
Collaborator

brettz9 commented May 21, 2021

As mentioned, you might try updating the deprecated babel-eslint to @babel/eslint-parser (you will need to add @babel/core (should be just a devDep. if your parser is) as well as add either a Babel config or add requireConfigFile: false to parserOptions. A bug in the parser could perhaps be presenting issues.

@TheJaredWilcurt
Copy link
Author

@brettz9 I think I did what you said, but it's still happening:

is there something I'm missing

@brettz9
Copy link
Collaborator

brettz9 commented May 22, 2021

Hmm, ok. (That was just a guess, as thought it'd be good to do that anyways, and ensure we control our variables.) I think solving this might require someone doing a bunch of logging within a fork of the plug-in and seeing where things go awry on Windows.

@TheJaredWilcurt
Copy link
Author

Turns out it was line ending related.

I changed .gitattributes from

* text=LF

to

# 2010
* -crlf

# 2020
* text eol=lf

And that fixed it. But at least I got some parser updates too out of this.

@brettz9
Copy link
Collaborator

brettz9 commented May 22, 2021

Should have thought of this earlier...

Here is what should be a valid test case but fails:

{
      code: `\r
        /**\r
         * Function description.\r
         *\r
         * @param {string} lorem Description.\r
         * @param {int}    sit   Description multi words.\r
         */\r
        const fn = ( lorem, sit ) => {}\r
      `,
      options: ['always'],
    },

(An equivalent "never" example with alignment removed works fine with carriage returns, however.)

Then there is this invalid case which fails:

{
      code: `\r
        /**\r
         * Function description.\r
         *\r
         * @param {string} lorem Description.\r
         * @param {int} sit Description multi words.\r
         */\r
        const fn = ( lorem, sit ) => {}\r
      `,
      errors: [
        {
          line: 2,
          message: 'Expected JSDoc block lines to be aligned.',
          type: 'Block',
        },
      ],
      options: [
        'always',
      ],
      output: `\r
        /**\r
         * Function description.\r
         *\r
         * @param {string} lorem Description.\r
         * @param {int}    sit   Description multi words.\r
         */\r
        const fn = ( lorem, sit ) => {}\r
      `,
    },

Here's what does work though:

output: `\r
        /**
         * Function description.
         *
         * @param {string} lorem Description.
         * @param {int}    sit   Description multi words.
         */\r
        const fn = ( lorem, sit ) => {}\r
      `,

I think this should probably be reported to comment-parser which I see does split by optional carriage returns while joining with newlines only. Reopening (feel free to unsubscribe if not interested). Update: Now reported to syavorsky/comment-parser#129

@gajus
Copy link
Owner

gajus commented Jul 9, 2021

🎉 This issue has been resolved in version 35.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants