Introduce an ESLint plugin to standardize Beanbag JavaScript development.

Review Request #12759 — Created Jan. 2, 2023 and submitted

Information

beanbag-eslint-plugin
main

Reviewers

This introduces a new plugin for ESLint that provides standardized,
documented configurations that ensure code consistency in ES5, ES6, and
TypeScript code.

These build upon the recommended sets for ESLint and TypeScript,
tweaking them to codify the rules we aim for when writing code.

To use this, our codebases will load in the @beanbag plugin
(corresponding to @beanbag/eslint-plugin in NPM) and extend the
plugin:@beanbag/recommended configuration. This will add some rules
that apply ES5-safe rules to *.js files, ES6-safe rules to *.es6.js
files, and TypeScript rules to *.ts files.

We can also pull in "environments" for Backbone, Django, Djblets,
jasmine-suites, and Review Board to declare certain variables as known
globals with read-only behavior, for codebases consuming those.

There's a special ruleset included for test suites, where we enable
Jasmine support, pull in a plugin to check for some common issues, and
configure it appropriately for our needs. This is enabled by default for
*Tests.{js,es6.js,ts} files.

A lot of this will still need tweaking as we go. Some rules were good in
theory but bad in practice, and others (especially for TypeScript) will
need further changes made as we continue development. There's one rule
that is currently disabled, but left in with the hope that we can later
get it working right.

Going forward, we'll be able to pull in additional rules or even craft
custom ones to ensure consistency in our code, all without needing to
configure things on a repository-by-repository basis.

Tested many of the rules out in the ESLint Playground at
https://eslint.org/play/.

Tested these in the Djblets tree. Found many errors (some minor, some
that need to be fixed), and used the results to tweak the rules here.

Ran the plugin's lint rules on itself.

Summary ID
Introduce an ESLint plugin to standardize Beanbag JavaScript development.
This introduces a new plugin for ESLint that provides standardized, documented configurations that ensure code consistency in ES5, ES6, and TypeScript code. These build upon the recommended sets for ESLint and TypeScript, tweaking them to codify the rules we aim for when writing code. To use this, our codebases will load in the `@beanbag` plugin (corresponding to `@beanbag/eslint-plugin` in NPM) and extend the `plugin:@beanbag/recommended` configuration. This will add some rules that apply ES5-safe rules to `*.js` files, ES6-safe rules to `*.es6.js` files, and TypeScript rules to `*.ts` files. We can also pull in "environments" for Backbone, Django, Djblets, jasmine-suites, and Review Board to declare certain variables as known globals with read-only behavior, for codebases consuming those. There's a special ruleset included for test suites, where we enable Jasmine support, pull in a plugin to check for some common issues, and configure it appropriately for our needs. This is enabled by default for `*Test.{js,es6.js,ts}` files. A lot of this will still need tweaking as we go. Some rules were good in theory but bad in practice, and others (especially for TypeScript) will need further changes made as we continue development. Going forward, we'll be able to pull in additional rules or even craft custom ones to ensure consistency in our code, all without needing to configure things on a repository-by-repository basis.
6fce7cbd7494ecda1cd69d83b3fb54e5706ed4bd
Description From Last Updated

Missing a ` character at the end of this line.

daviddavid

Found it!

daviddavid
david
  1. 
      
  2. src/index.ts (Diff revision 1)
     
     
    Show all issues

    Missing a ` character at the end of this line.

  3. src/index.ts (Diff revision 1)
     
     
    Show all issues

    Found it!

  4. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...