Open janakdr opened 5 years ago
In particular, eslint's error here appears to violate the acceptable styles listed in https://google.github.io/styleguide/javascriptguide.xml#Code_formatting ("Function arguments' section).
Yeah, there are a lot of cases where code that's valid according to Google style will show errors with this ESLint config. It's a trade-off between being overly strict and way too lax.
PR #50 add indentation rules based on the suggestion in https://github.com/google/eslint-config-google/issues/12#issuecomment-352134238. Previously there was no indentation enforcement (so your code wouldn't error), but that also meant someone using tabs wouldn't get an error either. This felt like a good compromise.
You can turn off the indent
rule if you're already using clang-format
. Unfortunately I don't think there's a set of ESLint config options that perfectly matches Google style for indentation.
Currently using:
'indent': ['error', 2, {'CallExpression': {'arguments': 2}, 'ignoredNodes': ['CallExpression > CallExpression', 'CallExpression > MemberExpression']}]
which works for our code for now. I'm a little surprised that I need to put the 'CallExpression': {'arguments': 2}
section in, though.
Same issue here, it seems that google ESlint is requiring a 4 space indention when you go to a newline for a function parameter...really weird.
You can fix it using: rules: { 'indent': 'off', } It will turn off indention and it will help you though
The following code is unchanged by
clang-format --style=Google
:However, running it with ESLint gives the errors:
ESLint apparently wants the lines above to be:
This seems inconsistent with clang-format's concept of ContinuationIndentWidth. Is there a workaround for this? Or is my setup wrong? The contents of my .eslintrc are:
(I was directed here from https://github.com/eslint/eslint/issues/12083)