@armirage/eslint-config-armirage

Adopt the Armirage Coding Style with this ESLint shareable config. Extend your editor to get real time warnings and errors.

Usage no npm install needed!

<script type="module">
  import armirageEslintConfigArmirage from 'https://cdn.skypack.dev/@armirage/eslint-config-armirage';
</script>

README

:earth_americas: :speech_balloon: English
Table of Contents

A child's hand reaches from the bottom of the frame holding a broad dandy brush. It is oversized for the small hand. The child uses it to brush the hair of a large horse. Combing the horse's messy hair into a smooth coat.
Untitled [child brushing horse] by Chris Bair, licensed under Unsplash. [1]

 

@armirage/eslint-config-armirage  npm logo  github logo

GitHub tag (latest by date) GitHub issues Github code size GitHub license armirage-style

A consistent style makes code easier to read, debug, and helps catch errors. It takes a team of 100 programmers to come together and write the next big application, yet it should look as if one person coded it. With the aid of linters, code can be programmatically checked for adherence to a convention. Making everyone's work easy to mesh together into one cohesive source of truth.

 

Screen recording showing inconsistent code being linted into the Armirage style.

Table of Contents

About

Shareable configs 2 alter or extend the base rules of ESLint.3 Making it easy to distribute a styling convention among developers. The Armirage JavaScript Style Guide has more details on the linting rules we apply and why.

Install

Open open a terminal in, or change directory to, your working directory. This should be the project folder with NPM's package.json in it.

To install ESLint and Armirage sharable config, run the following commands in the terminal:

npm install eslint @armirage/eslint-config-armirage --save-dev
  • :pencil: NOTE: The sharable config is a scoped npm package and will need to be referenced that way.

This will save both as developer dependencies. Linters are development tools and unnecessary in production builds.

While in the terminal, create the configuration file .eslintrc.json

touch .eslintrc.json
  • :pencil: NOTE: The .eslintrc.json begins with a period. This is a hidden file on many systems. To see it, enable 'show hidden files' for your OS.

To complete installation See Usage.

Usage

Once the eslint-config-armirage package is installed, you can activate the rules in the ESLint configuration file.

// .eslintrc.json

{
  "extends": "@armirage/eslint-config-armirage",
  "rules": {}
}

There are several rules in the eslint:recommended ruleset that Armirage does set. Rules we feel are better handled on a case for case basis. You might want to enforce these rules in your project for a more complete implementation.

// .eslintrc.json

{
  "extends": [
    "eslint:recommended",
    "@armirage/eslint-config-armirage"
  ],
  "rules": {}
}

You can mix in other ESLint sharable configs, and extend them as well. The last ruleset in the array will have precedence.

Options

You can also override individual rules. This can be helpful to apply rules per project. For instance I often use the following:

// .eslintrc.json

{
  "extends": [
    "eslint:recommended",
    "@armirage/eslint-config-armirage"
  ],
  "rules": {
    "prefer-destructuring": ["warn", {"object": true, "array": true}]
  }
}

This gives me the added coverage of the eslint:recommended, the Armirage conventions, and I get warnings when objects or arrays could be de-structured. Something that may be project, intent, maintainability dependent.

How to Contribute

We need more modular rulesets. The base eslint ruleset is ECMAScript 2020. It should be easy to add other modular configs to the package to account for more environments.

Review the Contributing Guidelines for ways to make this repository better.

Open Source Software (OSS) is only as strong as our Community.

Acknowledgements

ESLint for their exhaustive efforts to keep pace with the ECMAScript yearly cycle.

Contact

Armirage Github repositories and @armirage scoped NPM modules are maintained by Armirage, A Technology Solutions company, feel free to contact us!

Footnotes

Untitled [child brushing horse] by Chris Bair, licensed under Unsplash :arrow_heading_up:

[2]: Shareable Configs https://eslint.org/docs/developer-guide/shareable-configs [accessed 29 September 2020] :arrow_heading_up:

[3]: ESLint - Pluggable JavaScript linter https://eslint.org/ [accessed 29 September 2020] :arrow_heading_up:

 

 

Armirage logos Copyright © 2020, Clinton Mulligan. All rights reserved.