Review Request #12759 — Created Jan. 2, 2023 and submitted
This introduces a new plugin for ESLint that provides standardized,
documented configurations that ensure code consistency in ES5, ES6, and
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/eslint-pluginin NPM) and extend the
plugin:@beanbag/recommendedconfiguration. This will add some rules
that apply ES5-safe rules to
*.jsfiles, ES6-safe rules to
files, and TypeScript rules to
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
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
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.
Added missing backticks in a doc comment.
Revision 2 (+10208)
Checks run (2 succeeded)