Skip to content

Commit 0470b2e

Browse files
authored
Merge branch 'main' into deps-json-rpc-engine
2 parents 7624988 + 94175cd commit 0470b2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9270
-3
lines changed

constraints.pro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,15 @@ gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, DependencyType) :-
298298
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType),
299299
DependencyType == 'devDependencies'.
300300

301-
% If a controller dependency (other than `base-controller` and
302-
% `eth-keyring-controller`) is listed under "dependencies", it should also be
301+
% If a controller dependency (other than `base-controller`, `eth-keyring-controller` and
302+
% `polling-controller`) is listed under "dependencies", it should also be
303303
% listed under "peerDependencies". Each controller is a singleton, so we need
304304
% to ensure the versions used match expectations.
305305
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'peerDependencies') :-
306306
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'),
307307
DependencyIdent \= '@metamask/base-controller',
308308
DependencyIdent \= '@metamask/eth-keyring-controller',
309+
DependencyIdent \= '@metamask/polling-controller',
309310
is_controller(DependencyIdent).
310311

311312
% All packages must specify a minimum Node version of 16.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"ignores": [
3+
"@lavamoat/allow-scripts",
4+
"@metamask/auto-changelog",
5+
"@types/*",
6+
"prettier-plugin-packagejson",
7+
"ts-node",
8+
"typedoc"
9+
]
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],
4+
ignorePatterns: [
5+
'!.eslintrc.js',
6+
'!jest.config.js',
7+
'node_modules',
8+
'dist',
9+
'docs',
10+
'coverage',
11+
// 'merged-packages',
12+
],
13+
overrides: [
14+
{
15+
files: ['*.test.{ts,js}', '**/tests/**/*.{ts,js}'],
16+
extends: ['@metamask/eslint-config-jest'],
17+
rules: {
18+
// TODO: Re-enable
19+
'import/no-named-as-default-member': 'off',
20+
'jest/no-conditional-expect': 'off',
21+
},
22+
},
23+
{
24+
// These files are test helpers, not tests. We still use the Jest ESLint
25+
// config here to ensure that ESLint expects a test-like environment, but
26+
// various rules meant just to apply to tests have been disabled.
27+
files: ['**/tests/**/*.{ts,js}', '!*.test.{ts,js}'],
28+
rules: {
29+
'jest/no-export': 'off',
30+
'jest/require-top-level-describe': 'off',
31+
'jest/no-if': 'off',
32+
'jest/no-test-return-statement': 'off',
33+
// TODO: Re-enable this rule; we can accomodate this even in our test helpers
34+
'jest/expect-expect': 'off',
35+
},
36+
},
37+
{
38+
files: ['*.js'],
39+
parserOptions: {
40+
sourceType: 'script',
41+
ecmaVersion: '2018',
42+
},
43+
},
44+
{
45+
files: ['*.ts'],
46+
extends: ['@metamask/eslint-config-typescript'],
47+
parserOptions: {
48+
tsconfigRootDir: __dirname,
49+
project: ['./tsconfig.json'],
50+
},
51+
rules: {
52+
// disabled due to incompatibility with Record<string, unknown>
53+
// See https://github.com/Microsoft/TypeScript/issues/15300#issuecomment-702872440
54+
'@typescript-eslint/consistent-type-definitions': 'off',
55+
56+
// TODO: auto-fix breaks stuff
57+
'@typescript-eslint/promise-function-async': 'off',
58+
59+
// TODO: re-enble most of these rules
60+
'@typescript-eslint/await-thenable': 'warn',
61+
'@typescript-eslint/naming-convention': 'off',
62+
'@typescript-eslint/no-floating-promises': 'warn',
63+
'@typescript-eslint/no-for-in-array': 'warn',
64+
'@typescript-eslint/no-loss-of-precision': 'warn',
65+
'@typescript-eslint/no-misused-promises': 'warn',
66+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
67+
'@typescript-eslint/unbound-method': 'off',
68+
'@typescript-eslint/prefer-enum-initializers': 'off',
69+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
70+
'@typescript-eslint/prefer-optional-chain': 'off',
71+
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
72+
'@typescript-eslint/restrict-plus-operands': 'warn',
73+
'@typescript-eslint/restrict-template-expressions': 'warn',
74+
'no-restricted-syntax': 'off',
75+
'no-restricted-globals': 'off',
76+
},
77+
},
78+
{
79+
files: ['tests/setupAfterEnv/matchers.ts'],
80+
parserOptions: {
81+
sourceType: 'script',
82+
},
83+
},
84+
{
85+
files: ['*.d.ts'],
86+
rules: {
87+
'@typescript-eslint/naming-convention': 'warn',
88+
'import/unambiguous': 'off',
89+
},
90+
},
91+
{
92+
files: ['scripts/*.ts'],
93+
rules: {
94+
// All scripts will have shebangs.
95+
'n/shebang': 'off',
96+
},
97+
},
98+
],
99+
rules: {
100+
// Left disabled because various properties throughough this repo are snake_case because the
101+
// names come from external sources or must comply with standards
102+
// e.g. `txreceipt_status`, `signTypedData_v4`, `token_id`
103+
camelcase: 'off',
104+
'id-length': 'off',
105+
106+
// TODO: re-enble most of these rules
107+
'@typescript-eslint/naming-convention': 'off',
108+
'function-paren-newline': 'off',
109+
'guard-for-in': 'off',
110+
'id-denylist': 'off',
111+
'implicit-arrow-linebreak': 'off',
112+
'import/no-anonymous-default-export': 'off',
113+
'import/no-unassigned-import': 'off',
114+
'lines-around-comment': 'off',
115+
'n/no-sync': 'off',
116+
'no-async-promise-executor': 'off',
117+
'no-case-declarations': 'off',
118+
'no-invalid-this': 'off',
119+
'no-negated-condition': 'off',
120+
'no-new': 'off',
121+
'no-param-reassign': 'off',
122+
'no-restricted-syntax': 'off',
123+
radix: 'off',
124+
'require-atomic-updates': 'off',
125+
'jsdoc/match-description': [
126+
'off',
127+
{ matchDescription: '^[A-Z`\\d_][\\s\\S]*[.?!`>)}]$' },
128+
],
129+
},
130+
settings: {
131+
'import/resolver': {
132+
typescript: {},
133+
},
134+
},
135+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* text=auto
2+
3+
yarn.lock linguist-generated=false
4+
5+
# yarn v3
6+
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
7+
/.yarn/releases/** binary
8+
/.yarn/plugins/** binary
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Lines starting with '#' are comments.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
* @MetaMask/devs
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: 'npm'
7+
directory: '/'
8+
schedule:
9+
interval: 'daily'
10+
time: '06:00'
11+
allow:
12+
- dependency-name: '@metamask/*'
13+
target-branch: 'main'
14+
versioning-strategy: 'increase-if-necessary'
15+
open-pull-requests-limit: 10
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes:
3+
4+
* What is the current state of things and why does it need to change?
5+
* What is the solution your changes offer and how does it work?
6+
7+
Are there any issues or other links reviewers should consult to understand this pull request better? For instance:
8+
9+
* Fixes #12345
10+
* See: #67890
11+
-->
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build, Lint, and Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
prepare:
8+
name: Prepare
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Use Node.js
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version-file: '.nvmrc'
16+
cache: 'yarn'
17+
- name: Install Yarn dependencies
18+
run: yarn --immutable
19+
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
needs:
24+
- prepare
25+
strategy:
26+
matrix:
27+
node-version: [16.x, 18.x, 20.x]
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
cache: 'yarn'
35+
- run: yarn --immutable --immutable-cache
36+
- run: yarn build
37+
- name: Require clean working directory
38+
shell: bash
39+
run: |
40+
if ! git diff --exit-code; then
41+
echo "Working tree dirty at end of job"
42+
exit 1
43+
fi
44+
45+
lint:
46+
name: Lint
47+
runs-on: ubuntu-latest
48+
needs:
49+
- prepare
50+
strategy:
51+
matrix:
52+
node-version: [16.x, 18.x, 20.x]
53+
steps:
54+
- uses: actions/checkout@v3
55+
- name: Use Node.js ${{ matrix.node-version }}
56+
uses: actions/setup-node@v3
57+
with:
58+
node-version: ${{ matrix.node-version }}
59+
cache: 'yarn'
60+
- run: yarn --immutable --immutable-cache
61+
- run: yarn lint
62+
- name: Validate RC changelog
63+
if: ${{ startsWith(github.head_ref, 'release/') }}
64+
run: yarn auto-changelog validate --rc
65+
- name: Validate changelog
66+
if: ${{ !startsWith(github.head_ref, 'release/') }}
67+
run: yarn auto-changelog validate
68+
- name: Require clean working directory
69+
shell: bash
70+
run: |
71+
if ! git diff --exit-code; then
72+
echo "Working tree dirty at end of job"
73+
exit 1
74+
fi
75+
76+
test:
77+
name: Test
78+
runs-on: ubuntu-latest
79+
needs:
80+
- prepare
81+
strategy:
82+
matrix:
83+
node-version: [16.x, 18.x, 20.x]
84+
steps:
85+
- uses: actions/checkout@v3
86+
- name: Use Node.js ${{ matrix.node-version }}
87+
uses: actions/setup-node@v3
88+
with:
89+
node-version: ${{ matrix.node-version }}
90+
cache: 'yarn'
91+
- run: yarn --immutable --immutable-cache
92+
- run: yarn test
93+
- name: Require clean working directory
94+
shell: bash
95+
run: |
96+
if ! git diff --exit-code; then
97+
echo "Working tree dirty at end of job"
98+
exit 1
99+
fi
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Create Release Pull Request
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
base-branch:
7+
description: 'The base branch for git operations and the pull request.'
8+
default: 'main'
9+
required: true
10+
release-type:
11+
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
12+
required: false
13+
release-version:
14+
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
15+
required: false
16+
17+
jobs:
18+
create-release-pr:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
# This is to guarantee that the most recent tag is fetched.
27+
# This can be configured to a more reasonable value by consumers.
28+
fetch-depth: 0
29+
# We check out the specified branch, which will be used as the base
30+
# branch for all git operations and the release PR.
31+
ref: ${{ github.event.inputs.base-branch }}
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version-file: '.nvmrc'
36+
- uses: MetaMask/action-create-release-pr@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
release-type: ${{ github.event.inputs.release-type }}
41+
release-version: ${{ github.event.inputs.release-version }}

0 commit comments

Comments
 (0)