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

Opt-in Atom editor conversion #728

Merged
merged 6 commits into from
Oct 17, 2020
Merged

Opt-in Atom editor conversion #728

merged 6 commits into from
Oct 17, 2020

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 2, 2020

PR Checklist

Overview

Builds off the excellent work by @MrCube42 (#133 -> #250) to make a general convertEditorConfigs function, which calls convertEditorConfig for each requested --editor configuration. Instead of assuming VS Code for all editors, a editorConfigDescriptors dependency is added that lists the known file path formats and matches to a known format if possible.

Trims down the logic around retrieving the settings keys and such to be a bit more manual in the editor configs. It was a nice thing to build off of but:

  • Atom's editor settings such as linter-eslint and linter-tslint use nested properties, which are more difficult to support dynamically.
  • The relevant editor extensions ended up not adding many new features, so the infrastructure was less necessary than I'd thought.

Adds two runtime dependencies to package.json:

Example output snippets from running node ../tslint-to-eslint-config/bin/tslint-to-eslint-config --editor .vscode/settings.json:

✨ 1 editor file augmented with its ESLint equivalent. ✨

❓ 1 vscode/settings.json editor setting is not known by tslint-to-eslint-config to have an ESLint equivalent. ❓
  Check ./tslint-to-eslint-config.log for details.
2 rules are not known by tslint-to-eslint-config to have ESLint equivalents:
  * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "typedef".
  * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "whitespace".

@JoshuaKGoldberg JoshuaKGoldberg changed the title WIP: Atom editor conversion Opt-in Atom editor conversion Oct 15, 2020
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review October 15, 2020 21:37
Copy link
Collaborator

@KingDarBoja KingDarBoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great to me, although I wish there was a easier way to spot changes when renaming files 😆

Btw, fix the merge conflict on package.json and should be ready to merge 🚀

"eslint-config-prettier": "6.12.0",
"glob": "7.1.6",
"lodash": "^4.17.20",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psss, you could have used lodash-es which is tree-shakable hence reduces bundle size. 🍸

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! I can never keep track of which Lodash is the right one to use now 😄. Will do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, https://www.npmjs.com/package/lodash-es is a year out of date 😕 ... I'll skip this for now, but if it ends up getting regularly published it'd be great to include.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh fun, this is an actively discussed topic: https://github.com/lodash/lodash/issues/4879

@@ -52,3 +54,5 @@ export const uniqueFromSources = <T>(...sources: (T | T[] | undefined)[]) => {

return Array.from(new Set(items));
};

export const parseJson = (text: string) => JSON.parse(stripJsonComments(text));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging this one, should be good to change the JSON.parse by json5.parse as stated on #742

Comment on lines +7 to +13
const knownMissingSettings = [
"tslint.alwaysShowRuleFailuresAsWarnings",
"tslint.exclude",
"tslint.ignoreDefinitionFiles",
"tslint.jsEnable",
"tslint.suppressWhileTypeErrorsPresent",
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever approach 🍰

@JoshuaKGoldberg JoshuaKGoldberg merged commit f77f533 into main Oct 17, 2020
@JoshuaKGoldberg JoshuaKGoldberg deleted the jg-atom-conversion branch October 17, 2020 23:52
@@ -12,8 +12,10 @@
"dependencies": {
"chalk": "4.1.0",
"commander": "6.1.0",
"cson-parser": "^4.0.5",
Copy link

@skovalyov skovalyov Nov 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error npm ERR! 404 Not Found - GET http://my-registry-url/coffeescript/-/coffeescript-1.12.8.tgz during installation on Windows. It comes from cson-parser. There are some mentions of this problem, for example at jashkenas/coffeescript/issues/4805, but it's not clear how to fix it while installing Angular Eslint with ng add @angular-eslint/schematics

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, can you open a new issue in order to track the error with Angular ESLint + this package? Thank you :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, we will look into these and provide a proper fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch editor config conversions to opt-in Support Atom editor setting conversion
3 participants