We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
sort-keys
ESLint version: 9.17.0 @eslint/json version: 0.9.0 Node version: 20.11.0 npm version: 10.8.2 Operating System: macOS 15.1
json
import json from '@eslint/json'; const sortKeys = { 'sort-keys': [`error`, `asc`, { allowLineSeparatedGroups: true, }], }; export default [ { files: [`index.js`], rules: sortKeys, }, { files: [`index.json`], language: `json/json`, plugins: { json, }, rules: sortKeys, } ];
An error for sort-keys is thrown in this file as expected:
export default { "bbb": "bbb", "aaa": "aaa" };
No sort-keys error is thrown in this file:
{ "bbb": "bbb", "aaa": "aaa" }
I expected a sort-keys error to be thrown because the JSON object's keys were not in alphabetical order.
A sort-keys error was not thrown.
https://stackblitz.com/edit/stackblitz-starters-pauaycvs?file=eslint.config.js
https://eslint.org/docs/latest/rules/sort-keys
The text was updated successfully, but these errors were encountered:
sort-keys is a JavaScript-specific rule, so it can't work with JSON. We'd have to recreate a JSON-specific one.
Sorry, something went wrong.
No branches or pull requests
Environment
ESLint version: 9.17.0
@eslint/json version: 0.9.0
Node version: 20.11.0
npm version: 10.8.2
Operating System: macOS 15.1
Which language are you using?
json
What did you do?
Configuration
index.js
An error for
sort-keys
is thrown in this file as expected:index.json
No
sort-keys
error is thrown in this file:What did you expect to happen?
I expected a
sort-keys
error to be thrown because the JSON object's keys were not in alphabetical order.What actually happened?
A
sort-keys
error was not thrown.Link to Minimal Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-pauaycvs?file=eslint.config.js
Participation
Additional comments
https://eslint.org/docs/latest/rules/sort-keys
The text was updated successfully, but these errors were encountered: