Skip to content

Managing large monorepos is hard. This makes it easier.

License

Notifications You must be signed in to change notification settings

thasner/monorepolint

 
 

Repository files navigation

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:

module.exports = {
  checks: {
    ":standard-tsconfig": [
      {
        template: {
          compilerOptions: {
            target: "es5",
            module: "commonjs",
            lib: ["es2015"],
            declaration: true,
            declarationMap: true,
            sourceMap: true,
            outDir: "./build",
            rootDir: "./src",
            composite: true,
            importHelpers: true,
            strict: true,
            noUnusedLocals: true,
            noUnusedParameters: true,
            noImplicitReturns: true,
            noFallthroughCasesInSwitch: true,
            allowSyntheticDefaultImports: true,
            esModuleInterop: true
          }
        }
      }
    ],
    ":file-contents": [
      {
        options: "jest.config.js",
        templateFile: "./templates/jest.config.js"
      }
    ],
    ":package-script": [
      {
        options: {
          clean: "rm -rf build",
          "compile:typescript": "../../node_modules/.bin/tsc",
          "lint:typescript":
            "../../node_modules/.bin/tslint --config ../../tslint.json --project .",
          "test:watch":
            "../../node_modules/.bin/jest --colors --passWithNoTests --watch",
          test: "../../node_modules/.bin/jest --colors --passWithNoTests"
        }
      }
    ],
    ":package-order": [
      {
        options: [
          "name",
          "version",
          "author",
          "url",
          "license",
          "private",
          "main",
          "typings",
          "style",
          "sideEffects",
          "workspaces",
          "husky",
          "lint-staged",
          "scripts",
          "dependencies",
          "peerDependencies",
          "devDependencies",
          "publishConfig",
          "gitHead"
        ],
        includeWorkspaceRoot: true
      }
    ],
    ":alphabetical-dependencies": {}
  }
};

Contribution

Dev Setup

  1. Get in there:

    yarn
    yarn compile:watch
  2. Edit your files

  3. Test your changes:

    yarn ci
  4. Submit a pull request

Generating changelog

  1. Setup a GH Token

  2. Run this command:

sudo gem install --pre github_changelog_generator
yarn 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 yarn workspaces function, in order to get the right symlinks in node_modules/@monorepolint/whatever you need to run yarn again.

About

Managing large monorepos is hard. This makes it easier.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 93.2%
  • JavaScript 6.1%
  • CSS 0.7%