ESLint and Concierge

by

As an intern on the Cesium team, my work this summer was divided between two projects: packaging our ESLint configuration into a shareable format and creating a GitHub bot to automate common tasks.

Style & Syntax Checking with ESLint

At Cesium, we like to have our JavaScript code follow a core set of style and syntax guidelines. As a simple example, we use single tick ' quotes and never double-tick " in our JavaScript. Standardizing the look of our code increases its legibility and consistency which makes it easy to learn and navigate. With hundreds of thousands of lines of code, 100+ contributors, and dozens of repositories, it becomes a challenge to guarantee that we adhere to style and syntax guidelines.

JSHint solved this problem for a while, but it is not as flexible, configurable, and powerful as other options. So we recently moved to ESLint, a popular tool which gives us the power to standardize our code the way we want it. Each of the hundreds of rules can be full enabled, disabled, or configured with a level of granularity in order to control behavior at edge-cases.

After we moved to ESLint at the start of the summer, it became clear that these rules should apply to each of the repositories under the Cesium umbrella. I ported our configuration to an ESLint shareable config, giving us the ability to distribute and update our configuration through npm, Node.js’ package manager. Now, each new contributor automatically downloads the latest ESLint configuration and verifies that their code adheres to our standards.

Cesium Concierge

Meet the Cesium Concierge!

Every massive open-source project struggles with common challenges on GitHub. For Cesium, we usually have to do a lot of reminding. For example, we remind:

  • New users to sign a Contributor License Agreement (CLA) when they submit a pull request for the first time
  • Maintainers to look at pull requests that have not been updated in a certain number of days
  • Contributors to update CHANGES.md when the API changes

While all of this information is in the Contributors Guide, not all new users read or know to read it.

My project was to solve these problems with a GitHub bot: Cesium Concierge. It detects when pull requests and issues are opened or closed, and then posts comments based on their properties. It can currently:

  • Suggest editing CHANGES.md if it hasn’t been already
  • Suggest editing LICENSE.md if files in Third-party folders are changed
  • “Bump” pull requests which have not been updated in x days
  • Ask new users to fill out the CLA by checking their GitHub name with a JSON file
  • Remind users to update the forum if there are links in the issue/PR

Concierge is an open-source project built on Node.js. It uses GitHub WebHooks to efficiently respond to “events” like opened/closed pull requests, issues, etc. Using GitHub’s REST API, it chains GET and POST calls with request-promise to handle potential failures robustly without crashing.

Concierge is built with expandability in mind, and will gain more abilities as the Cesium team adds functionality. We hope to soon see it auto-label pull requests and issues, for example. Contributions are welcome on GitHub!