This is an Eslint sharable configuration that contains an opinionated take on best practices in writing and formatting JavaScript code. I reviewed the eslint recommended settings, the standard configuration, and the Airbnb configuration and carefully considered their recommendations balanced with my own experience developing with JavaScript.
This config itself extends the eslint:recommended
ruleset.
This is the result. It leans towards minimalism (no semicolons or other unnecessary punctuation with a few exceptions), the Allman/BSD style of indentation for maximum clarity, tabs for indentation, organized import statements, etc.
If you generally like this approach but with some small modifications, you can extend this and provide rule overrides.
This package also follows the bluejava approach of small, simple, single-purpose, minimal tooling - so it would be easy to clone this and make changes or rip out any valuable bits for your own sharable configuration.
To use this package, simply install it:
npm install --save-dev eslint-config-bluejava
or
yarn add --dev eslint-config-bluejava
For ESLint v9 and above, create an eslint.config.js
file in your project root:
import bluejavaConfig from 'eslint-config-bluejava';
export default [
...bluejavaConfig,
// Your custom configurations here
];
Note: If your project is not using ES modules, name this file eslint.config.mjs
.
For ESLint v8 and below, in your package.json
, add the following:
"eslintConfig": {
"extends": "bluejava"
},
Or create an .eslintrc.js
file in your project root:
module.exports = {
extends: 'bluejava'
};
Once configured you can check your code via the command line (eslint <src>
) or more commonly, via an eslint plugin for your browser.
You can learn more about Shareable Configs on the official ESLint website.
For help in integrating with your editor, see Integrations.
The final resulting ruleset created by this configuration can be seen in the rules-report.json file in this repository.
See the LICENSE file for license rights and limitations (MIT).