codeclimate / codeclimate-eslint

Code Climate Engine for ESLint
MIT License
95 stars 93 forks source link

Cascading with ESLint config files doesn't work #412

Closed efueger closed 3 years ago

efueger commented 6 years ago

Bug Template

Actual Behavior

Repo uses 2 .eslintrc.js files. The deeper-nested config file doesn't seem to be used with CLI or hosted results.

CLI Debug output:

$ CODECLIMATE_DEBUG=1 codeclimate analyze -e eslint
Starting analysis
I, [2018-09-06T02:06:12.980096 #1]  INFO -- : starting engine eslint
D, [2018-09-06T02:06:13.061906 #1] DEBUG -- : /config.json content: {"enabled"=>true, "channel"=>"eslint-4", "config"=>{"config"=>"projects/frontend/.eslintrc.js", "ignore_path"=>"projects/frontend/.eslintignore"}, "include_paths"=>["projects/", "README.md", ".codeclimate.yml"], "debug"=>"1"}
D, [2018-09-06T02:06:13.070547 #1] DEBUG -- : docker run: ["docker", "run", "--name", "cc-engines-eslint-eslint-4-72e688d0-b4f5-4d8e-8092-0b9b5d3a49d5", "--cap-drop", "all", "--label", "com.codeclimate.label=e7f857b9-175a-415a-9a21-103f9785f005", "--log-driver", "none", "--memory-swap", "-1", "--net", "none", "--rm", "--volume", "/Users/emily/workspace/code-climate-eslint:/code:ro", "--volume", "/tmp/cc/4b9bcc94-2d0f-4920-9c66-0a70862e10c9:/config.json:ro", "--user", "9000:9000", "--memory", "1024000000", "codeclimate/codeclimate-eslint:eslint-4"]
D, [2018-09-06T02:06:14.294718 #1] DEBUG -- : engine stderr: ESLint is running with the default parser.
D, [2018-09-06T02:06:14.323883 #1] DEBUG -- : engine stderr: Ignoring the following rules that rely on module resolution:
D, [2018-09-06T02:06:14.323959 #1] DEBUG -- : engine stderr: 
D, [2018-09-06T02:06:14.324959 #1] DEBUG -- : engine stderr: * import/extensions
D, [2018-09-06T02:06:14.325121 #1] DEBUG -- : engine stderr: * import/no-unresolved
D, [2018-09-06T02:06:14.325590 #1] DEBUG -- : engine stderr: * import/no-extraneous-dependencies
D, [2018-09-06T02:06:14.326118 #1] DEBUG -- : engine stderr: * import/no-named-as-default
D, [2018-09-06T02:06:14.326756 #1] DEBUG -- : engine stderr: * import/no-absolute-path
D, [2018-09-06T02:06:14.327965 #1] DEBUG -- : engine stderr: * import/no-duplicates
D, [2018-09-06T02:06:14.328130 #1] DEBUG -- : engine stderr: * import/no-named-as-default-member
D, [2018-09-06T02:06:14.489979 #1] DEBUG -- : engine stdout: {"type":"issue","categories":["Style"],"check_name":"import/prefer-default-export","description":"Prefer default export.","content":{"body":"For more information visit Source: http://eslint.org/docs/rules/\n"},"location":{"path":"projects/frontend/src/testFile.js","positions":{"begin":{"line":1,"column":1},"end":{"line":1,"column":1}}},"remediation_points":50000}
D, [2018-09-06T02:06:14.507635 #1] DEBUG -- : engine stdout: 

{"type":"issue","categories":["Style"],"check_name":"import/prefer-default-export","description":"Prefer default export.","content":{"body":"For more information visit Source: http://eslint.org/docs/rules/\n"},"location":{"path":"projects/frontend/src/util/testUtil.js","positions":{"begin":{"line":1,"column":1},"end":{"line":1,"column":1}}},"remediation_points":50000}
D, [2018-09-06T02:06:14.846249 #1] DEBUG -- : engine stdout: 

I, [2018-09-06T02:06:14.848194 #1]  INFO -- : finished engine eslint

== projects/frontend/src/testFile.js (1 issue) ==
1: Prefer default export. [eslint]

== projects/frontend/src/util/testUtil.js (1 issue) ==
1: Prefer default export. [eslint]

Analysis complete! Found 2 issues.

wfleming commented 6 years ago

We use cascading ESLint config files ourselves internally, so they do work at least most of the time. I'm looking into this to try and identify why they wouldn't work in this particular repo. Thanks for the isolated test case.

eutopian commented 6 years ago

@efueger do you still have the files for the repo? that link does not work anymore.

efueger commented 6 years ago

@eutopian - I DM'd files to you

hurrycaner commented 4 years ago

Any news about this? Almost 2 years now and it does not work with monorepos :(

not-Ryan commented 3 years ago

I'd also like to know if there is any status on this? It makes it CodeClimate (eslint / javascript) impossible for monorepos :(

efueger commented 3 years ago

HI @not-Ryan - thanks for asking about this! Another customer found if there's no .eslintrc at the root, then we throw this "Error: No ESLint configuration found in /code." error.

We're working on a fix for that now.

In the meantime, he found a workaround:

if I add a file with the contents "{}" (an empty config) to /.eslintrc (the root of the project)then Code Climate seems to correctly use /a/.eslintrc in /a/ and /b/.eslintrc in /b/.

Let me know if that works for you! Again, working on a fix for this here, but wanted to offer in the interim.

not-Ryan commented 3 years ago

It worked! Many thanks!