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

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

Closed
constgen opened this issue Dec 28, 2020 · 0 comments · Fixed by #29
Closed

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

constgen opened this issue Dec 28, 2020 · 0 comments · Fixed by #29

Comments

@constgen
Copy link

constgen commented Dec 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant