Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Bug Report
description: Using MetaMask 7715 Permissions Snaps, but it's not working as you expect?
title: '[Bug]: '
labels: ['type-bug']
type: 'Bug'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!

## **Before Submitting:**

* Please search to make sure this issue has not been opened already.
* If this is a question about how to integrate MetaMask 7715 Permissions Snaps with your project, please ask in our [Community forum](https://community.metamask.io/c/developer-discussion/) instead. This will get your question answered more quickly and make it easier for other devs to find the answer in the future.
- type: textarea
id: what-happened
attributes:
label: Describe the bug
description: What happened?
placeholder: A clear and concise description of what the bug is
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What did you expect to happen?
- type: textarea
id: screenshot-recording
attributes:
label: Screenshots/Recordings
description: Please include screenshots/recordings if applicable!
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: 'List all steps needed to reproduce the problem:'
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
id: error
attributes:
label: Error messages or log output
description: Please copy and paste any relevant error messages or log output. This will be automatically formatted, so there is no need for backticks.
render: shell
- type: input
id: version
attributes:
label: Version
description: What version of MetaMask are you running? You can find the version in "Settings" > "About"
placeholder: '7.1.0'
validations:
required: true
- type: dropdown
id: build
attributes:
label: Build type
description: Are you using a testing or development build of MetaMask? If so, please select the type of build you are using.
options:
- Flask
- MetaMask
- type: dropdown
id: browsers
attributes:
label: Browser
description: Which browsers have you seen the problem on?
multiple: true
options:
- Chrome
- Firefox
- Microsoft Edge
- Brave
- Other (please elaborate in the "Additional Context" section)
validations:
required: true
- type: dropdown
id: os
attributes:
label: Operating system
description: Which operating systems have you seen the problem on?
multiple: true
options:
- Windows
- MacOS
- Linux
- Other (please elaborate in the "Additional Context" section)
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional context
description: Add any other context about the problem here, e.g. related issues, additional error messages or logs, or any potentially relevant details about the environment or situation the bug occurred in.
- type: textarea
id: severity
attributes:
label: Severity
description: |
To be added after bug submission by internal support / PM:
placeholder: |
- How critical is the impact of this bug on a user?
- Add stats if available on % of customers impacted
- Is this visible to all users?
- Is this tech debt?
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: "Feature Request"
description: "Use this template for proposing new features"
title: "[Feature]: "
labels: [feature]

body:
- type: markdown
attributes:
value: |
### **Description**
Describe the task. What does this aim to implement?

- type: textarea
id: technical-details
attributes:
label: Technical Details
description: |
- Implementation details
- Insight to what needs to be done
- Etc.
validations:
required: false

- type: textarea
id: acceptance-criteria
attributes:
label: Acceptance Criteria
description: |
- Are metrics required?
- Are translations required?
- Cases to satisfy
- XYZ should work
- Etc.

**Scenario: xxxx**
- GIVEN a user is in x state
- WHEN a user does x
- AND a user does x
- THEN x should occur
validations:
required: false

- type: textarea
id: references
attributes:
label: References
description: |
- References go here.
- Issue numbers. Links.
- Slack threads.
- Etc.
validations:
required: false
46 changes: 46 additions & 0 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask 7715 Permissions Snaps Contributor Docs](https://github.com/MetaMask/snap-7715-permissions/blob/main/CONTRIBUTING.md) and [MetaMask 7715 Permissions Snaps Coding Standards](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/styleGuide.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contributing

Thank you for your interest in contributing to the `snap-7715-permissions`! Your contributions help make this project better for everyone. Below are guidelines to help you get started.


## How Can I Contribute?

You can [open an issue](https://github.com/MetaMask/snap-7715-permissions/issues/new/choose) to suggest a feature. Please follow the new feature template. To report a bug, please follow our [security policy](https://github.com/MetaMask/snap-7715-permissions/security/policy).

Before creating a new issue, check the current open and closed issues to see if your concern has already been addressed. Adding a comment to an existing issue can often be more effective.

When suggesting a new feature, provide comprehensive details, particularly about the motivating use cases. Clearly illustrating the feature’s potential impact on the ecosystem can help prioritize its development. High-impact features are given priority, so detailed explanations are highly valued.

### Submitting Pull Requests

All Pull Requests must be paired with an open issue. When creating a Pull Request, you will be presented with a PR template; please be as detailed and thorough as possible to increase the likelihood of your PR being merged.

Create your PR against `main` as the base branch.

Please ensure your pull request adheres to the [style guide](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/styleGuide.md) and includes unit tests for new functionality.

## Releasing changes

[Read more on "Release" ->](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/release.md)
100 changes: 100 additions & 0 deletions docs/styleGuide.md
Comment thread
V00D00-child marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Style Guide

This document outlines the coding style and conventions used in the snap-7715-permissions project.

## General

- Use UTF-8 encoding for all files
- Use 2 spaces for indentation

## TypeScript/JavaScript

### Naming Conventions

- Use camelCase for variables, functions, and method names
- Use camelCase for file names

### Documentation

- Use JSDoc comments for public APIs
- Include descriptions for parameters and return values
- Document thrown exceptions

Example:
```typescript
/**
* Description of the function.
*
* @param options - The options object.
* @param options.param1 - Description of param1.
* @returns Description of the return value.
* @throws When something goes wrong.
*/
```

### Error Handling

- Use descriptive error messages
- Prefer custom error classes for specific error types
- Handle errors appropriately

## Testing

- Use Jest for unit and integration tests
- Name test files with `.test.ts` suffix
- Group related tests with `describe` blocks
- Use clear and descriptive test names with `it` statements
- Use mocks for external dependencies

Example:
```typescript
describe('MyFunction', () => {
it('returns the expected result when given valid input', () => {
// Arrange
const input = 'valid input';

// Act
const result = myFunction(input);

// Assert
expect(result).toBe('expected output');
});
});
```

## Code Organization

- Organize code by feature or domain
- Keep files focused on a single responsibility
- Use barrel exports (index.ts files) sparingly, and with named exports, to simplify imports
- Separate interfaces/types into their own files when they become large

## Git Workflow

- Create feature branches from `main`
- Use descriptive commit messages
- All pull requests must be linked to an open issue
- Pull requests should target the `main` branch

## Project Structure

- `/packages`: Contains all the project packages
- `/scripts`: Contains build and utility scripts
- `/docs`: Project documentation
- `/external`: External dependencies

## Dependencies

- Use Yarn as the package manager
- Pin dependency versions where appropriate

## Best Practices

1. Follow the Single Responsibility Principle
2. Write pure functions when possible
3. Use async/await for asynchronous code
4. Use descriptive variable names
5. Keep functions small and focused
6. Use TypeScript's type system to prevent bugs
7. Document complex logic with comments
8. Write tests for all new functionality
Loading