Giter Club home page Giter Club logo

monorepolint's Introduction

monorepolint

Managing large monorepos is hard. This makes it easier to standardize them.

CircleCI lerna Greenkeeper badge linted with monorepo

Installation

yarn add monorepolint

or

npm install monorepolint

Running

Check for issues

Good for CI.

monorepolint check

or use the shortcut (which i will only use now):

mrl check

Lets see more details

mrl check --verbose

Automatically fix issues

mrl check --fix

Configuration

For now, look at .monorepolint.config.ts in this repo.

Sample:

import * as Rules from "monorepolint/rules";

const META_PACKAGES = ["monorepolint"];
const DOCS = "@monorepolint/docs";

// FIXME: This is still suboptimal
const DELETE_SCRIPT_ENTRTY = { options: [undefined], fixValue: undefined };

export default {
  rules: [
    Rules.standardTsConfig({
      options: {
        templateFile: "./templates/tsconfig.json",
      },
      excludePackages: [DOCS],
    }),
    Rules.fileContents({
      options: {
        file: "jest.config.cjs",
        templateFile: "./templates/jest.config.cjs",
      },
      excludePackages: [DOCS],
    }),
    Rules.packageScript({
      options: {
        scripts: {
          clean: "rm -rf build dist lib node_modules *.tgz tsconfig.tsbuildinfo",
          "compile-typescript": "tsc --build",
          "lint:typescript": DELETE_SCRIPT_ENTRTY,
          jest: DELETE_SCRIPT_ENTRTY, // this syntax needs work :(
          "jest:watch": DELETE_SCRIPT_ENTRTY,
          lint: "eslint .",
          "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --colors --passWithNoTests --watch",
          test: "NODE_OPTIONS=--experimental-vm-modules jest --colors --passWithNoTests",
        },
      },
      excludePackages: [DOCS, ...META_PACKAGES],
    }),
    Rules.packageScript({
      options: {
        scripts: {
          clean: DELETE_SCRIPT_ENTRTY,
          "compile-typescript": DELETE_SCRIPT_ENTRTY,
          "lint:typescript": DELETE_SCRIPT_ENTRTY,
          jest: DELETE_SCRIPT_ENTRTY, // this syntax needs work :(
          "jest:watch": DELETE_SCRIPT_ENTRTY,
          lint: DELETE_SCRIPT_ENTRTY,
          "test:watch": DELETE_SCRIPT_ENTRTY,
          test: DELETE_SCRIPT_ENTRTY,
        },
      },
      includePackages: [...META_PACKAGES],
    }),
    Rules.packageOrder({}),
    Rules.alphabeticalDependencies({}),
    Rules.alphabeticalScripts({}),
    Rules.consistentDependencies({}),
    Rules.bannedDependencies({
      options: {
        bannedDependencies: ["lodash"],
      },
    }),
    Rules.requireDependency({
      options: {
        devDependencies: {
          typescript: "^4.9.5",
          "@types/jest": "^29.2.4",
          prettier: "^2.8.3",
          "ts-jest": "^29.0.5",
          jest: "^29.3.1",
          "@jest/globals": "^29.3.1",
          tslib: "^2.5.0",
          "@typescript-eslint/parser": "^5.45.1",
          "@typescript-eslint/eslint-plugin": "^5.45.1",
          eslint: "^8.29.0",
        },
      },
    }),
  ],
};

Contribution

Dev Setup

  1. Get in there:

    pnpm
    pnpm compile:watch
  2. Edit your files

  3. Test your changes:

    pnpm ci
  4. Submit a pull request

Generating changelog

  1. Setup a GH Token

  2. Run this command:

sudo gem install --pre github_changelog_generator
pnpm run changelog
  1. Submit a pull request

FAQ

I added a new package but I can't get it to work with the local monorepo.lint.ts. What?

The way pnpm workspaces function, in order to get the right symlinks in node_modules/@monorepolint/whatever you need to run pnpm again.

monorepolint's People

Contributors

ericanderson avatar maclockard avatar dependabot[bot] avatar thasner avatar styu avatar greenkeeper[bot] avatar gluxon avatar pgoldberg avatar walkerburgin avatar adidahiya avatar johnwiseheart avatar mfedderly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.