Hi all, JavaScript quality checks against our new JavaScript styleguide <https://github.com/edx/eslint-config-edx> are now live in the UI Toolkit, the UX Pattern Library, Insights, and, as of today, the edx-platform codebase*. Pull requests to these repositories that include JavaScript will now fail quality checks unless they conform to the style guide.
Nobody wants a failed build on their pull request, so below are instructions for configuring your editor to use ESLint with eslint-config-edx as you develop so you can catch style issues before you push. *PyCharm:* Use the Pycharm ESLint plugin <https://www.jetbrains.com/help/pycharm/2016.1/eslint.html> (installed by default, activated under Settings > Languages and Frameworks > JavaScript > Code Quality Tools > ESLint). The linter should pick up the .eslintconfig.js(on)? in your repository automatically and begin working immediately. *Atom:* Use the Atom linter plugin <https://atom.io/packages/linter> along with the linter-eslint plugin <https://atom.io/packages/linter-eslint>. After installation and an Atom restart, the plugin should pick up the .eslintconfig.js(on)? in your repository automatically. *SublimeText:* Use the SublimeLinter plugin (for ST2 <https://github.com/SublimeLinter/SublimeLinter-for-ST2> or ST3 <https://github.com/SublimeLinter/SublimeLinter3>) along with the SublimeLinter-eslint <https://github.com/roadhump/SublimeLinter-eslint> plugin. After an installation and a Sublime restart, the plugin should pick up the .eslintconfig.js(on)? in your repository automatically. *Vim/Emacs/Other:* ESLint maintains some documentation about the plugin ecosystem for other editors on their Integrations page <http://eslint.org/docs/user-guide/integrations>. I have not tested any of these. If your editor doesn't have an ESLint integration/plugin or you're unable to configure it, you can always run ESLint from the command line. The method for doing this will vary on based on the repository: - In the UITK, UXPL and Insights: gulp lint - In edx-platform: paver run_quality - In repos without a build/scripting tool: $(npm bin)/eslint . If you're using another editor and would like to share how you configured ESLint in it, feel free to chime in. * Note that for the next little bit, edx-platform will be running both ESLint and JSHint as part of a gradual switchover so our tools and reports stay happy. Our configurations for these two tools *should* be compatible, but if you encounter issues due to this, let me know. On Friday, June 24, 2016 at 10:52:17 AM UTC-4, [email protected] wrote: > > Hi All, > > The front-end working group at edX has recently launched several > initiatives to bring modernity and consistency to how our community builds > user interfaces and writes front-end code. Yesterday we released version > 1.0 of eslint-config-edx to NPM > <https://www.npmjs.com/package/eslint-config-edx>, which will bring > further consistency and quality to edX JavaScript. > > The project has two goals: > > 1) Create a specific, thorough and well-documented style guide for how > JavaScript at edX should be written > > 2) Provide tools to promote that style during development and in > continuous integration. > > To meet these goals, edX has adopted a style guide for JavaScript based on > the Airbnb JavaScript Style Guide for ES5 > <https://github.com/airbnb/javascript/blob/master/es5/README.md>, with > several extensions and customizations documented here > <https://github.com/edx/eslint-config-edx/blob/master/README.md#the-config>. > These stylistic rules have been packaged up into a configuration for the > tool ESLint, which we'll be installing into all edX JavaScript repos over > the coming weeks. Contributors can start practicing this style today - > smaller JavaScript projects like the Pattern Library and the UI Toolkit > will begin enforcing this style next week, and over time it will become the > standard for all JavaScript contributions to larger repos like edx-platform. > > Please let me know if you have questions or feedback - we expect the style > guide to evolve as we undertake more projects to modernize JavaScript at > edX and add more contributors to the front-end community. > > Thanks, > > > P.S. If you're interested in the discussions that led to the adoption of > this particular style, see this pull request > <https://github.com/edx/eslint-config-edx/pull/1> and the #hack-eslint > channel <https://openedx.slack.com/messages/hack-eslint/> in the Open edX > Slack team. > -- You received this message because you are subscribed to the Google Groups "General Open edX discussion" group. To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/e1e234a6-3400-4a59-ba09-ebb770a2cc81%40googlegroups.com.
