Skip to content

Failed linting of JSON fragments in Markdown on GitLab CI #28

@constgen

Description

@constgen

When linting JSON fragments in Markdown file using eslint-plugin-markdown linting throw an error. But this can be reproduced only in GitLab CI environment but not local. I believe it depends on OS. GitLab is Linux, local is Windows.
Also tried on a similar but another project using Travis and it didn't fail.

Pay attention to the "virtual" file path /builds/company_name/repository_name/README.md/2_2.json. The exception itself is thrown by ESLint function when thi s expression is called directoryExists('C:\Projects\Projects_Compane\project_name\README.md\2_2.json') when linter meets the first JSON code

Oops! Something went wrong! :(
ESLint: 7.16.0
Error: ENOTDIR: not a directory, stat '/builds/company_name/repository_name/README.md/2_2.json'
    at Object.statSync (fs.js:1016:3)
    at directoryExists (/builds/company_name/repository_name/node_modules/eslint/lib/cli-engine/cli-engine.js:532:19)
    at CLIEngine.getConfigForFile (/builds/company_name/repository_name/node_modules/eslint/lib/cli-engine/cli-engine.js:944:13)
    at getConfig (/builds/company_name/repository_name/node_modules/eslint-plugin-jsonc/dist/processors/auto-config.js:13:27)
    at preprocess (/builds/company_name/repository_name/node_modules/eslint-plugin-jsonc/dist/processors/auto-config.js:22:24)
    at Linter._verifyWithProcessor (/builds/company_name/repository_name/node_modules/eslint/lib/linter/linter.js:1292:30)
    at Linter._verifyWithConfigArray (/builds/company_name/repository_name/node_modules/eslint/lib/linter/linter.js:1264:25)
    at /builds/company_name/repository_name/node_modules/eslint/lib/linter/linter.js:1312:29
    at Array.map (<anonymous>)
    at Linter._verifyWithProcessor (/builds/company_name/repository_name/node_modules/eslint/lib/linter/linter.js:1292:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 2

What difference I noticed that local Windows environment throws ENOENT error which is chedked in condition in directoryExists() function and returned as false. But GitLab env throws ENOTDIR which is escalated and thrown on eslint-plugin-jsonc/dist/processors/auto-config.js:13:27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions