Code Formatting - For Discussion Only#1213
Draft
anthonysena wants to merge 1 commit into
Draft
Conversation
Collaborator
Author
|
From Atlas call discussion:
|
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: This PR is only for review and should not be merged.
Per our ATLAS WG call today, I've made an initial attempt to implement EditorConfig and ESLint rules for ATLAS. The goal is to close out all open PRs for Atlas 2.7, implement these code formatting standards and then re-format the code base in a single PR so that moving forward we can avoid code formatting issues in subsequent PRs.
This aims to address #655 and is part of #990 (comment).
Work Notes
EditorConfig
editorconfigto the project and based it on vscode's project settings. Added some additional settings for ensuring the file format is UTF-8 and that there is a newline at the end of each file for making it nicer when scrolling to the bottom of a fileESLint
Added in
eslint, to package.json via npm.Installed ESLint for VSCode which provides some nice shortcuts when working in VSCode.
Using the VSCode plugin, I initialized the
.eslintrc.jsonfile. If you look at this file, you'll see the following choices that I made as part of the setup:Opened up
js/settings.jsand ESLint flagged a number of problems. Most were easily remedied using the VSCode ESLint plugin which has a command to fix all auto-fixable problems. This left me with a few exceptions which I was able to override using theoverridesconfiguration section in.eslintrc.jsonNext, I opened
js/const.jsand ESLint had trouble parsing the file. Per this SO article I installed and configuredbabel-eslintas the parser in.eslintrc.json. During the course of digging into this error, I also discovered an ESLint plugin for RequireJS and added that as well. I'm unsure if we need this but for now I've configured this to use the recommended ESLint settings for RequireJS.Once I took the steps above, I was able to auto-fix the ESLint errors in
js/const.jsvia VSCode.I also took out
.jshintrc(JSHint config) since I wasn't sure if that would cause any compatibility issues (nor am I sure if we still need this for linting if we go with ESLint instead?)Next Steps
.eslintrc.jsonas I did in this example or if there is another approach for selectively applying code formatting rules.Tagging: @pavgra, @chrisknoll, @fdefalco, @johnSamilin