Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 1.22 KB

README.md

File metadata and controls

67 lines (50 loc) · 1.22 KB

esconfig

Shared ECMAScript Config (TS, Lint, Prettier)

Usage

  1. Install

    yarn add -D @nihalgonsalves/esconfig typescript typescript-eslint eslint prettier
  2. tsconfig.json

    {
      "extends": "@nihalgonsalves/esconfig/tsconfig.shared.json",
      "compilerOptions": {
        "outDir": "./build",
        "rootDir": "./src"
      },
      "include": ["./src"]
    }
  3. eslint.config.mjs

    import tseslint from "typescript-eslint";
    
    import sharedConfig from "@nihalgonsalves/esconfig/eslint.config.shared";
    
    export default tseslint.config(
      { ignores: [] },
      ...sharedConfig,
      // ... others
    );

    If you're using React:

    import tseslint from "typescript-eslint";
    
    import sharedConfig from "@nihalgonsalves/esconfig/eslint.config.react-shared";
    
    export default tseslint.config(
      { ignores: [] },
      ...sharedConfig,
      // ... others
    );
  4. package.json

    {
      "scripts": {
        "build": "tsc",
        "lint": "eslint ./src/",
        "format": "prettier . --write",
        "format:check": "prettier . --check"
      }
    }
  5. Done! Don't forget to run build, lint and format:check in your CI workflow.