We write a lot of JavaScript at Beanbag, and need to keep our repositories in tip-top shape. This includes sticking to consistent standards and catching problems before they go up for review.
To help with this, we've created beanbag-eslint-plugin
, our set of standard
ESLint rules for ES5, ES6, and TypeScript codebases.
To install this plugin:
npm install --save-dev @beanbag/eslint-plugin
There are several configurations and environments provided by the plugin, but
we recommend starting with the @beanbag/recommended
configuration. This can
be enabled in your .eslintrc
file:
{
"plugins": ["@beanbag"],
"extends": [
"plugin:@beanbag/recommended"
]
}
This ruleset automatically enables the following additional configurations:
-
@beanbag/es5
: ES5 rules for*.js
files -
@beanbag/es6
: ES6 rules for*.es6.js
files -
@beanbag/typescript
: TypeScript rules for*.ts
files
A set of default rules for all JavaScript/TypeScript code, written to be aggressively browser-safe.
A set of rules enabling ES6-level JavaScript code, useful for modern JavaScript (including code being processed by Babel.
A set of rules for developing TypeScript code.
The following environments are available:
-
@beanbag/backbone
: RecordsBackbone
and_
as read-only globals, for use with Backbone. -
@beanbag/django
: Recordsdjango
,gettext
,gettext_noop
,interpolate
,ngettext
,npgettext
, andpgettext
as read-only globals, for use with Django. -
@beanbag/djblets
: RecordsDjblets
as a read-only global, for use with Djblets. -
@beanbag/jasmine-suites
: Recordssuite
as a read-only global, for use with jasmine-suites. -
@beanbag/reviewboard
: RecordsRB
as a read-only global, for use in Review Board extensions.