Skip to content

Commit c2b55bc

Browse files
authored
Implement JavaScript-based constraints (#220)
* 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
1 parent 32c4d0b commit c2b55bc

11 files changed

Lines changed: 3248 additions & 2972 deletions

File tree

.depcheckrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"@lavamoat/preinstall-always-fail",
55
"@metamask/auto-changelog",
66
"@types/*",
7+
"@yarnpkg/types",
78
"prettier-plugin-packagejson",
89
"ts-node",
910
"typedoc"

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ module.exports = {
1717
extends: ['@metamask/eslint-config-nodejs'],
1818
},
1919

20+
{
21+
files: ['yarn.config.cjs'],
22+
parserOptions: {
23+
sourceType: 'script',
24+
ecmaVersion: 2020,
25+
},
26+
settings: {
27+
jsdoc: {
28+
mode: 'typescript',
29+
},
30+
},
31+
extends: ['@metamask/eslint-config-nodejs'],
32+
},
33+
2034
{
2135
files: ['*.test.ts', '*.test.js'],
2236
extends: [

.yarn/plugins/@yarnpkg/plugin-constraints.cjs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.yarn/releases/yarn-3.2.1.cjs

Lines changed: 0 additions & 786 deletions
This file was deleted.

.yarn/releases/yarn-4.1.1.cjs

Lines changed: 893 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
15
enableScripts: false
26

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

17-
yarnPath: .yarn/releases/yarn-3.2.1.cjs
19+
yarnPath: .yarn/releases/yarn-4.1.1.cjs

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ Follow these instructions when using this template.
2626

2727
## Installation
2828

29-
`yarn add @metamask/this-module`
29+
`yarn add @metamask/metamask-module-template`
3030

3131
or
3232

33-
`npm install @metamask/this-module`
33+
`npm install @metamask/metamask-module-template`
3434

3535
## Usage
3636

constraints.pro

Lines changed: 0 additions & 99 deletions
This file was deleted.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@metamask/module-template",
2+
"name": "@metamask/metamask-module-template",
33
"version": "0.0.0",
44
"description": "The MetaMask Node module template",
55
"homepage": "https://github.com/MetaMask/metamask-module-template#readme",
@@ -13,9 +13,9 @@
1313
"sideEffects": false,
1414
"exports": {
1515
".": {
16+
"types": "./dist/types/index.d.ts",
1617
"import": "./dist/index.mjs",
17-
"require": "./dist/index.js",
18-
"types": "./dist/types/index.d.ts"
18+
"require": "./dist/index.js"
1919
},
2020
"./package.json": "./package.json"
2121
},
@@ -33,7 +33,7 @@
3333
"lint:changelog": "auto-changelog validate --prettier",
3434
"lint:constraints": "yarn constraints",
3535
"lint:dependencies": "depcheck && yarn dedupe",
36-
"lint:eslint": "eslint . --cache --ext js,ts",
36+
"lint:eslint": "eslint . --cache --ext js,cjs,ts",
3737
"lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog",
3838
"lint:misc": "prettier '**/*.json' '**/*.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
3939
"prepack": "./scripts/prepack.sh",
@@ -52,6 +52,7 @@
5252
"@types/node": "^16",
5353
"@typescript-eslint/eslint-plugin": "^5.43.0",
5454
"@typescript-eslint/parser": "^5.43.0",
55+
"@yarnpkg/types": "^4.0.0-rc.52",
5556
"depcheck": "^1.4.3",
5657
"eslint": "^8.44.0",
5758
"eslint-config-prettier": "^8.8.0",
@@ -71,7 +72,7 @@
7172
"typedoc": "^0.23.15",
7273
"typescript": "~4.8.4"
7374
},
74-
"packageManager": "yarn@3.2.1",
75+
"packageManager": "yarn@4.1.1",
7576
"engines": {
7677
"node": "^18.18 || >=20"
7778
},

0 commit comments

Comments
 (0)