-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
After updating to prettier 3.2.3, it formats .eslintrc.json with trailing commas, here is an example:
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"plugins": ["no-only-tests"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module", <--
},
"ignorePatterns": ["node_modules/", "build"],
"rules": {
"no-console": ["off"],
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "angle-bracket", <--
}, <--
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-empty-function": "off",
"prefer-const": "off",
"no-only-tests/no-only-tests": ["error"], <--
}, <--
}
When running eslint 8.56.0, it throw an error
Cannot read config file: [foldername]/.eslintrc.json Error: Unexpected token } in JSON at position 210
I assume this is related to #15881 , and that it incorrectly identifies which files are json and which jsonc. While eslint config specifies it allows comments, I am not sure it implies it also accepts trailing commas https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-formats
[Edit]: Here are minimal replication steps:
- checkout https://github.com/fstaffa/prettier-eslintrc-issue
- run
npm ci
- run
npm run eslint
(works as exptected) - run
npm run prettier
(changes .eslintrc.json) - run
npm run eslint
(fails with error similar to what was reported above)
felladrin, ekatioz, henrikvolmer, VictorGlindasPaf, aminya and 1 more
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.