Description
This issue is related to #407
🐛 Bug Report
tslint-to-eslint-config
version: 1.5.0- ESLint version: ^7.10.0
- Node version: 12.18.3
Actual Behavior
tslint-to-eslint-config
overwrite's entire .vscode/settings.json
with an empty config if there is a trailing comma
With trailing comma
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 44f8082..ca2996c 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,14 @@
-{
- "editor.formatOnSave": true,
-}
+/*
+👋 Hi! This file was autogenerated by tslint-to-eslint-config.
+https://github.com/typescript-eslint/tslint-to-eslint-config
+
+It represents the closest reasonable ESLint configuration to this
+project's original TSLint configuration.
+
+We recommend eventually switching this configuration to extend from
+the recommended rulesets in typescript-eslint.
+https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
+
+Happy linting! 💖
+*/
+{}
Without trailing comma
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f89ed5f..1eadf3f 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,16 @@
+/*
+👋 Hi! This file was autogenerated by tslint-to-eslint-config.
+https://github.com/typescript-eslint/tslint-to-eslint-config
+
+It represents the closest reasonable ESLint configuration to this
+project's original TSLint configuration.
+
+We recommend eventually switching this configuration to extend from
+the recommended rulesets in typescript-eslint.
+https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
+
+Happy linting! 💖
+*/
{
"editor.formatOnSave": true
}
Expected Behavior
1. The actual bug represented in this issue
It should accept trailing commas as they are valid in vscode configs.
2. The bigger, not exactly this bug, but related problem:
It should not overwrite any settings in .vscode/* folder without an explicit option.
From the readme:
The tslint-to-eslint-config command reads in any existing linter, TypeScript, and package configuration files, then creates an .eslintrc.js result based on them.
This does not indicate it's going to modify my editor files at all, only that it will create a new file, .eslintrc.js
. Please require an option/flag for any changes to editor configs!
Reproduction
Add a trailing comma to your last item in your .vscode/settings.json
, and run tslint-to-eslint-config
, you'll see that it outputs an empty object.