MetaMask / module-lint

Analyzes one or more repos for divergence from a template repo.
1 stars 3 forks source link

Add checks for Yarn compliance #11

Closed desi closed 8 months ago

desi commented 10 months ago

Since the module template uses Yarn v3, we want all projects to conform to the same thing. So, minimally, for this ticket, we want this tool to be able to look a project and verify whether it is using the same version of Yarn as is specified in the module template.

There are several ways to check that the Yarn version conforms, though. If this is the case for a project, then these things will be true:

We can create 7 rules to encapsulate all of these checks.

kanthesha commented 10 months ago

Discussed and agreed with @mcmire , that Instead of We can create 7 rules to encapsulate all of these checks., we will create a single yarn compliance rule which encapsulate all of these checks. And it would look similar to below in case of failures.

- Does the `src/` directory exist? ✅
- Does the `yarn` comply? ❌
  - `yarn@3.3.1` does not match module template `yarn@3.2.1`
  - plugin-allow-scripts.cjs does not match the same in module template
  - plugin-constraints.cjs does not match the same in module template
  - yarn-3.2.1.cjs does not match the same in module template
  - .yarnrc.yml does not match the same in module template
kanthesha commented 10 months ago

The below rules and validations have been added and available in the branch yarn-compliance.

- package.json required
- README.md required
- Yarn Compliance
  - The packageManager field in package.json should exist
  - The value of the packageManager field should match the same value as the module template
  - .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs should exist, and its contents should match what's in the module template
  - .yarn/plugins/@yarnpkg/plugin-constraints.cjs should exist, and its contents should match what's in the module template
  - .yarn/releases/yarn-3.2.1.cjs should exist, and its contents should match what's in the module template
  - The .yarnrc.yml file should exist, and the contents of this file should match the same file in the module template