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

Load .oxlintrc.jsonc from current directory automatically? #8688

Closed
darcien opened this issue Jan 24, 2025 · 3 comments
Closed

Load .oxlintrc.jsonc from current directory automatically? #8688

darcien opened this issue Jan 24, 2025 · 3 comments
Labels
C-enhancement Category - New feature or request

Comments

@darcien
Copy link

darcien commented Jan 24, 2025

Oxlint already load .oxlintrc.json from current directory automatically.

This PR #2121 added .jsonc extension support for config file.

Current version (Version: 0.15.7) does not look for .oxlintrc.jsonc.

Since oxlint already support .jsonc extension, loading .oxlintrc.jsonc automatically would be nice to have.

For now oxlint -c .oxlintrc.jsonc works just fine.

@darcien darcien added the C-enhancement Category - New feature or request label Jan 24, 2025
@drvn-mr
Copy link

drvn-mr commented Jan 24, 2025

As far as I can tell, you don't really need to name the extension .jsonc for comments to work.

@darcien
Copy link
Author

darcien commented Jan 25, 2025

As far as I can tell, you don't really need to name the extension .jsonc for comments to work.

Yup that's right.

In my use case, I'm using VSCode.

The built in JSON LSP complains if the .json file contains comment:

Image

To tell the LSP it should treat the JSON file as JSONC, I only know 2 ways:

  • Use .jsonc extension
  • Manually change the language mode for the file to JSONC instead of JSON
Image

Since I'm not the only person working in the git repo, I prefer if the JSONC treatment is committed to the repo so others can use it without additional config.

After digging into VSCode config, turns out there is a setting for this!

I can tell VSCode to treat .oxlintrc.json as JSONC and commit it to the repo.

{
  // in .vscode/settings.json
  "files.associations": {
    ".oxlintrc.json": "jsonc"
  },
}

Sorry for the noises. We can close this instead of adding more magic behavior to oxlint config loading.

@Sysix
Copy link
Collaborator

Sysix commented Jan 26, 2025

We oriented us on the eslint v8 autoload naming:
https://eslint.org/docs/v8.x/use/configure/configuration-files#configuration-file-formats
Because we only support JSON, there was only one option left.

You can read on the implemented PR a little bit more about it : #7348 (comment)

When you are using github you can add this to your .gitattributes file too:

# Use JSONC for syntax highlighting on github.com
*.json linguist-language=jsonc

We can close this instead of adding more magic behavior to oxlint config loading.

For simplicity I would like to keep one file name.

@Boshen Boshen closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants