xojs/xo

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

Closed this issue · 8 comments

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

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

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.

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

bad web API wrapper packages.

Stripe example

image

@sindresorhus Have you ever used xo in your projects?

I use XO in 1000+ projects.

Stripe example

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

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.