ota-meshi / eslint-plugin-jsonc

ESLint plugin for JSON(C|5)? files
https://ota-meshi.github.io/eslint-plugin-jsonc/
MIT License
181 stars 17 forks source link

sort-keys: Misplaced comments in tsconfig.json #261

Open LangLangBart opened 9 months ago

LangLangBart commented 9 months ago

description

reproduction

{
  "dependencies": {
    "eslint": "^8.49.0",
    "eslint-plugin-jsonc": "^2.9.0"
  },
  "eslintConfig": {
    "plugins": [
      "eslint-plugin-jsonc"
    ],
    "parser": "jsonc-eslint-parser",
    "rules": {
      "jsonc/sort-keys": [
        "error",
        {
          "pathPattern": "^compilerOptions$",
          "order": [
            "target",
            "strict"
          ]
        }
      ]
    }
  }
}
{
  "compilerOptions": {
    "strict": true, /* Enable all strict type-checking options. */
    "target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
  }
}
{
  "compilerOptions": { /* Enable all strict type-checking options. */
    "target": "esnext",
    "strict": true /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
  }
}

reference

ota-meshi commented 9 months ago

It looks like a bug, but I think we need to think about how we handle comments. If you have an idea, please consider submitting a pull request.