@beanbag/eslint-plugin
v4.0.0
Published
Configuration used for linting Beanbag JavaScript codebases.
Downloads
196
Readme
Beanbag ESLint Plugin
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.
Installation
To install this plugin:
npm install --save-dev @beanbag/eslint-pluginUsage
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 eslint.config.mjs file:
import beanbag from '@beanbag/eslint-plugin';
import { defineConfig } from 'eslint/config';
export default defineConfig([
beanbag.configs.recommended,
{
plugins: {
'@beanbag': beanbag,
},
},
]);Configurations
beanbag.configs.recommended
This ruleset automatically enables the following additional configurations:
beanbag.configs.es5: ES5 rules for*.jsfiles.beanbag.configs.es6: ES6 rules for*.es6.jsfiles.beanbag.configs.typescript: TypeScript rules for*.tsfiles.beanbag.configs.jsx: Rules for JSX files.beanbag.configs.jasmine: Rules for Jasmine test suites.beanbag.configs.storybook: Rules for Storybook stories.
beanbag.configs.es5
A set of default rules for all JavaScript/TypeScript code, written to be aggressively browser-safe.
beanbag.configs.es6
A set of rules enabling ES6+ JavaScript code, useful for modern JavaScript (including code being processed by Babel.
beanbag.configs.typescript
A set of rules for developing TypeScript code.
Globals
Several sets of globals are also provided within the plugin. These may be
already added to languageOptions depending on which rulesets are enabled, but
are also available for your use:
beanbag.globals.backbone: Provides read-only globals configuration forBackboneand_, for use with Backbone.beanbag.globals.django: Provides read-only globals fordjango,gettext,gettext_noop,interpolate,ngettext,npgettext, andpgettext, for use with Django.beanbag.globals.djblets: Provides a read-only global forDjblets, for use with Djblets.beanbag.globals.reviewboard: Provides a read-only global forRB, for use in Review Board extensions.
