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

useNamingConvention: support uppercase function names for HTTP verbs #2314

Closed
1 task done
kevinwolfcr opened this issue Apr 4, 2024 · 4 comments · Fixed by #2770
Closed
1 task done

useNamingConvention: support uppercase function names for HTTP verbs #2314

kevinwolfcr opened this issue Apr 4, 2024 · 4 comments · Fixed by #2770
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Enhancement Status: Improve an existing feature

Comments

@kevinwolfcr
Copy link
Contributor

Environment information

CLI:
  Version:                      1.6.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.10.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "bun/1.0.35"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Linter:
  Recommended:                  false
  All:                          true
  Rules:                        nursery/useSortedClasses = {"level":"error","options":{"attributes":["class","className","className","classList"],"functions":["clsx","cva","tw","cn"]}}

Workspace:
  Open Documents:               0

Rule name

useNamingConvention

Playground link

https://biomejs.dev/playground/?lintRules=all&code=ZQB4AHAAbwByAHQAIABmAHUAbgBjAHQAaQBvAG4AIABHAEUAVAAoACkAIAB7AAoAIAAgAC8ALwAgAAoAfQA%3D

Expected result

Some frameworks like Next.js allows creating API endpoints. For that you should export functions using any HTTP verb, in uppercase mode. I think they could be allowed on this rule.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos
Copy link
Member

Conaclos commented Apr 4, 2024

I am not sure that this should be allowed by default because it is a specific usage.

This could be addressed via configuration?
We have an open issue #1900 for adding some options to useNamingConvention.

@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Enhancement Status: Improve an existing feature labels Apr 4, 2024
@Conaclos Conaclos changed the title 💅 useNamingConvention: support uppercase function names for HTTP verbs useNamingConvention: support uppercase function names for HTTP verbs Apr 4, 2024
@Conaclos Conaclos self-assigned this Apr 9, 2024
@ematipico
Copy link
Member

I am not sure that this should be allowed by default because it is a specific usage.

Unfortunately, no. Other frameworks are using this pattern: SvelteKit and Astro

@Conaclos
Copy link
Member

Conaclos commented Apr 10, 2024

NextJS supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.

Astro seems to support all HTTP methods.

I need to think about it. I am open to any suggestion to support this convention.

@kevinwolfcr
Copy link
Contributor Author

Maybe allow only the HTTP verbs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Enhancement Status: Improve an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants