Skip to content

MAPC/eslint-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

eslint-config

Overview

This is a shareable configuration for ESLint, made specifically for web applications at MAPC.

Rules

Extends the recommended JS defaults from ESLint, and includes the official React/JSX ESLint rules and the official React Hooks ESLint rules.

Other small additions:

Lastly, there are some individual rule overrides, including (but not limited to):

  • Allow up to 160 characters per line
  • Enforce 2 space indentation
  • Enforce use of curly brackets
  • Enforce semicolons;
  • Enforce camelCase (except when destructuring JSON, which sometimes uses snake_case or other formats)
  • Enforce default case in case/switch statements
  • Enforce use of === and !==
  • Prohibit block-scoped var

Usage

Add as a dev dependency: yarn add -D @mapc/eslint-config

Requires eslint >= 9 as a peer dependency: yarn add -D 'eslint@>=9'

To use this in conjunction with prettier: yarn add -D prettier

The ESLint docs have a section on using shared configs.

For most of our projects, that means creating a eslint.config.js at the project root, possibly using this snippet as a starting point:

import eslintConfig from "@mapc/eslint-config";

export default eslintConfig;

You should also add a .editorconfig file which specifies the 160-character line length for Prettier:

[*]
max_line_length = 160

For guidance on combining this ESLint config with other configs/plugins, or to override particular rules, see these ESLint docs on combining configs.

About

ESLint config for use in MAPC web apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published