Skip to content

Commit

Permalink
Implement JavaScript-based constraints (#220)
Browse files Browse the repository at this point in the history
* Implement JavaScript-based constraints

* Add more constraints for README.md and pull_request_template.md

* Update constraints to match latest module template

* Use latest version of Yarn

* Check if types export is the first

* Fix linting of Yarn config

* Revert change to ESLint config files

* Update `files` constraint

* Get workspace name from Yarn identifier instead of folder name

* Fix jsdoc
  • Loading branch information
Mrtenz authored Mar 15, 2024
1 parent 32c4d0b commit c2b55bc
Show file tree
Hide file tree
Showing 11 changed files with 3,248 additions and 2,972 deletions.
1 change: 1 addition & 0 deletions .depcheckrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"@lavamoat/preinstall-always-fail",
"@metamask/auto-changelog",
"@types/*",
"@yarnpkg/types",
"prettier-plugin-packagejson",
"ts-node",
"typedoc"
Expand Down
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ module.exports = {
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['yarn.config.cjs'],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2020,
},
settings: {
jsdoc: {
mode: 'typescript',
},
},
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['*.test.ts', '*.test.js'],
extends: [
Expand Down
52 changes: 0 additions & 52 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

This file was deleted.

786 changes: 0 additions & 786 deletions .yarn/releases/yarn-3.2.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

enableScripts: false

enableTelemetry: 0
Expand All @@ -11,7 +15,5 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js"
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-4.1.1.cjs
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Follow these instructions when using this template.

## Installation

`yarn add @metamask/this-module`
`yarn add @metamask/metamask-module-template`

or

`npm install @metamask/this-module`
`npm install @metamask/metamask-module-template`

## Usage

Expand Down
99 changes: 0 additions & 99 deletions constraints.pro

This file was deleted.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@metamask/module-template",
"name": "@metamask/metamask-module-template",
"version": "0.0.0",
"description": "The MetaMask Node module template",
"homepage": "https://github.com/MetaMask/metamask-module-template#readme",
Expand All @@ -13,9 +13,9 @@
"sideEffects": false,
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
Expand All @@ -33,7 +33,7 @@
"lint:changelog": "auto-changelog validate --prettier",
"lint:constraints": "yarn constraints",
"lint:dependencies": "depcheck && yarn dedupe",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:eslint": "eslint . --cache --ext js,cjs,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog",
"lint:misc": "prettier '**/*.json' '**/*.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
"prepack": "./scripts/prepack.sh",
Expand All @@ -52,6 +52,7 @@
"@types/node": "^16",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@yarnpkg/types": "^4.0.0-rc.52",
"depcheck": "^1.4.3",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
Expand All @@ -71,7 +72,7 @@
"typedoc": "^0.23.15",
"typescript": "~4.8.4"
},
"packageManager": "yarn@3.2.1",
"packageManager": "yarn@4.1.1",
"engines": {
"node": "^18.18 || >=20"
},
Expand Down
Loading

0 comments on commit c2b55bc

Please sign in to comment.