Skip to content

thesis/eslint-config

Folders and files

NameName
Last commit message
Last commit date
Aug 26, 2023
Sep 19, 2021
Sep 29, 2021
Aug 26, 2023
Sep 19, 2021
Sep 29, 2021
Oct 4, 2021
Oct 5, 2022
Jun 26, 2024
Dec 21, 2023
Aug 26, 2023
Aug 28, 2023

Repository files navigation

eslint-config

A shared ESLint config based off Airbnb style guides. Covers JS and TS including React / JSX.

Getting started

  1. Install eslint and the shared config with yarn
yarn add -D eslint prettier @typescript-eslint/eslint-plugin @typescript-eslint/parser
yarn add -D @thesis-co/eslint-config
  1. In your .eslintrc.js add:
module.exports = {
  root: true,
  extends: [
      "@thesis-co"
  ]
}
  1. Add .tsconfig-eslint.json. You can add this file manually with custom configuration or symlink this file with the default options.
ln -s ./node_modules/@thesis-co/eslint-config/.tsconfig-eslint.json ./.tsconfig-eslint.json
  1. Add commands for linting to your package.json:
{
 "scripts": {
   "lint:eslint": "eslint .",
   "lint:fix:eslint": "eslint . --fix"
 }
}

Sample config for related pre-commit hook

 - repo: local
   hooks:
    - id: lint-ts
      name: 'lint ts'
      entry: /usr/bin/env bash -c "yarn lint:ts"
      files: '\.tsx$'
      language: script
      description: "Checks TS code according to the package's linter configuration"
    - id: lint-js
      name: 'lint js'
      entry: /usr/bin/env bash -c "yarn lint:js"
      files: '\.jsx$'
      language: script
      description: "Checks JS code according to the package's linter configuration"