@jeromefitz/codestyle
TypeScript icon, indicating that this package has built-in type declarations

8.0.28 • Public • Published

@jeromefitz/codestyle

Overview

  • 🚨️ eslint + @typescript-eslint
  • 🎭️ lint-staged
  • 📐️ prettier + pretty-quick
  • 🆎️ TypeScript Config

Installation

yarn add @jeromefitz/codestyle --dev

Husky

I tend to use this with husky (w/ is-ci pinst), feel free to look at how this monorepo has it set up to follow / alter how you would like to implement.

  • ./husky

Overrides

ESLint + TypeScript

./.eslintrc.cjs

const config = require('@jeromefitz/codestyle/.eslintrc.next.cjs')

module.exports = {
  ...config,
  parser: '@babel/eslint-parser',
}

📝️ Note: Depending on if you are lifting packages in your repo, you may need to explicitly pass the parser.

lint-staged

./lint-staged.config.mjs

import config from '@jeromefitz/codestyle/lint-staged.config.js'

export default config

Prettier

./.prettierrc.cjs

const config = require('@jeromefitz/codestyle/.prettierrc.cjs')

module.exports = {
  ...config,
}

TypeScript

./tsconfig.json

{
  "extends": "@jeromefitz/codestyle/tsconfig.node.json"
}

Currently there are the following to extend:

  • tsconfig.jest.json
  • tsconfig.node.json
  • tsconfig.react-native.json
  • tsconfig.react.json

Scripts

Some packages have you call directly like yarn codestyle to run everything, however, I tend to prefer the opt-in / override approach.

If you want to add the following to your package.json scripts, these are the current recommendations:

{
  "scripts": {
    "lint:eslint": "eslint ./src --ext cjs,js,jsx,mjs,ts,tsx --max-warnings=0",
    "lint:prettier": "prettier \"./src/**/*.{cjs,js,jsx,mjs,ts,tsx,json,md,mdx,css,html,yml,yaml,scss}\" --ignore-unknown --loglevel warn",
    "lint:typescript": "tsc --noEmit --declaration",
    "lint": "yarn lint:prettier --check && yarn lint:eslint && yarn lint:typescript",
    "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write"
  }
}

Then with lint-staged you can just run yarn lint or pass yarn lint --fix (I believe yarn lint:fix may be not needed).

Readme

Keywords

none

Package Sidebar

Install

npm i @jeromefitz/codestyle

Weekly Downloads

0

Version

8.0.28

License

MIT

Unpacked Size

13.3 kB

Total Files

16

Last publish

Collaborators

  • jeromefitz