Skip to content

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

Closed
@TheJaredWilcurt

Description

@TheJaredWilcurt

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.

Activity

brettz9

brettz9 commented on May 21, 2021

@brettz9
Collaborator

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

TheJaredWilcurt commented on May 22, 2021

@TheJaredWilcurt
Author

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

is there something I'm missing

brettz9

brettz9 commented on May 22, 2021

@brettz9
Collaborator

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

TheJaredWilcurt commented on May 22, 2021

@TheJaredWilcurt
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

brettz9 commented on May 22, 2021

@brettz9
Collaborator

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

added a commit that references this issue on Jul 9, 2021
bd018b1
added a commit that references this issue on Jul 9, 2021
5b9f379

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @brettz9@gajus@TheJaredWilcurt

      Issue actions

        check-line-alignment throwing warnings in GitHub Actions on Windows · Issue #745 · gajus/eslint-plugin-jsdoc