apollo-tooling
apollo-tooling copied to clipboard
Add an option to remove underscores from generated interfaces.
Codegen generates interfaces with underscores.
For example: myQuery_foo_bar.
This default behaviour causes problems when using ESLint camelcase rule -https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.md.
Importing these interfaces triggers a linting error.
I'd suggest adding --no-underscores flag that would cause interfaces to be generated without underscores. For example: myQueryFooBar.
Consider using this: https://graphql-code-generator.com/
Hi, I got the same issue here... it's a tiny detail but it's actually pretty annoying.
Seems odd to me to add so much tooling when the main feature is already available for such an option.
Are you open for PR? At least for typescript codegen?
We have the same issue. I much prefer the output from apollo-codegen than from graphql-code-generator as it is easier to use query results in nested react components but the underscores break linting and style requirements for our project.
Would be great if there was an option to use camelCase instead of underscores.
Having the ability to pick a "namingConvention" such as: Underscores (aka snake_case), camelCase, PascalCase, kebab-case and any other common variation I may have missed, would be ideal.
e.g:
// apollo.config.js
module.exports = {
client: {
service: {
name: "My Client",
namingConvention: "camel", // default: "snake" optional: "camel" "pascal" "kebab" etc.
},
},
};
or
apollo client:codegen --target typescript --namingConvention camel
Any plans for this issue? Would be great to have.