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

Object Literal Property must match one of the following formats: strictCamelCase #747

Closed
maxpain opened this issue Feb 29, 2024 · 8 comments

Comments

@maxpain
Copy link

maxpain commented Feb 29, 2024

Hello. A lot of npm packages accept only snake_case fields in object parameters.
It will be cool to ignore this rule if we use such npm packages or external APIs.

await openai.beta.threads.runs.create(threadId, {
	assistant_id: assistantId,
})
Object Literal Property name `assistant_id` must match one of the following formats: strictCamelCase (@typescript-eslint/naming-convention)XO[@typescript-eslint/naming-convention](https://typescript-eslint.io/rules/naming-convention)
(property) RunCreateParams.assistant_id: string
@sindresorhus
Copy link
Member

sindresorhus commented Feb 29, 2024

The convention in JS is camel-case. You can use ESLint ignore comments for cases like this.

@sindresorhus
Copy link
Member

A lot of npm packages accept only snake_case fields in object parameters.

This is not correct. The only packages that require it are bad web API wrapper packages.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Feb 29, 2024
@maxpain
Copy link
Author

maxpain commented Mar 8, 2024

This is not correct. The only packages that require it are bad web API wrapper packages.

May I look at some examples of pretty large codebases with xo and a lot of npm packages?

Here is my example
image

@maxpain
Copy link
Author

maxpain commented Mar 8, 2024

bad web API wrapper packages.

Stripe example

image

@maxpain
Copy link
Author

maxpain commented Mar 8, 2024

@sindresorhus Have you ever used xo in your projects?

@sindresorhus
Copy link
Member

I use XO in 1000+ projects.

@sindresorhus
Copy link
Member

Stripe example

They only use snake-case because the programmatic API is generated from their API docs.

@sindresorhus
Copy link
Member

You don't have to ESLint ignore each line, you can apply it to a block or a whole file. You could even allow snake_case for the whole project if you want.

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

No branches or pull requests

2 participants