Skip to content

Commit

Permalink
Add @lavamoat/allow-scripts, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks committed Jun 25, 2021
1 parent e3d1ff0 commit 4e511c5
Show file tree
Hide file tree
Showing 10 changed files with 1,531 additions and 671 deletions.
41 changes: 20 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
module.exports = {
root: true,

env: {
'browser': true,
},
parserOptions: {
'ecmaVersion': 2018,
browser: true,
},

globals: {
'ethereum': 'readonly',
ethereum: 'readonly',
},
plugins: [
'json',
],
extends: [
'@metamask/eslint-config',
'@metamask/eslint-config/config/nodejs',
],
overrides: [{
'files': ['src/*.js'],
'parserOptions': {
'sourceType': 'module',

extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],

overrides: [
{
files: ['src/*.js'],
parserOptions: {
sourceType: 'module',
},
rules: {
camelcase: ['error'],
},
},
}],
ignorePatterns: [
'!.eslintrc.js',
'dist',
],
}

ignorePatterns: ['!.eslintrc.js', 'dist'],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ package-lock.json
node_modules
.vscode
dist
.eslintcache
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// All of these are defaults except singleQuote, but we specify them
// for explicitness
module.exports = {
quoteProps: 'as-needed',
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-scripts true
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,42 @@ If you wish to use this dapp in your e2e tests, install this package and set up
static-server node_modules/@metamask/test-dapp/dist --port 9011
```

## Development
## Contributing

### Requires Manual Deployment
### Setup

- Install [Node.js](https://nodejs.org) version 12
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
- Install [Yarn v1](https://yarnpkg.com/en/docs/install)
- Run `yarn setup` to install dependencies and run any requried post-install scripts
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

### Testing and Linting

Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.

This package has no tests.

### Deploying

After merging or pushing to `main`, please run `yarn deploy` in the package root directory if the contents of the `dist/` directory have changed.

### Elements Must Be Selectable by XPath
### Development

Consider that elements must be selectable by XPath. This means that appearances can be misleading.
#### Elements Must Be Selectable by XPath

All HTML elements should be easily selectable by XPath.
This means that appearances can be misleading.
For example, consider this old bug:

```html
<button class="btn btn-primary btn-lg btn-block mb-3" id="approveTokensWithoutGas" disabled>Approve Tokens
Without Gas</button>
<button
class="btn btn-primary btn-lg btn-block mb-3"
id="approveTokensWithoutGas"
disabled
>
Approve Tokens Without Gas
</button>
```

This appears on the page as `Approve Tokens Without Gas`. In reality, the value included the whitespace on the second line, and caused XPath queries for the intended value to fail:

```html
Approve Tokens Without Gas
```
This appears on the page as `Approve Tokens Without Gas`. In reality, the value included the whitespace on the second line, and caused XPath queries for the intended value to fail.
29 changes: 22 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"node": ">= 12.0.0"
},
"scripts": {
"setup": "yarn install && yarn allow-scripts",
"deploy": "./deploy.sh",
"lint": "eslint . --ext js,json && prettier ./src -c",
"lint:fix": "eslint . --fix --ext js,json && prettier ./src -c --write",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"start": "webpack-dev-server",
"build": "webpack --mode production",
"test": "yarn lint",
Expand All @@ -32,21 +35,33 @@
"homepage": "https://metamask.github.io/test-dapp",
"dependencies": {},
"devDependencies": {
"@metamask/eslint-config": "^4.0.0",
"@lavamoat/allow-scripts": "^1.0.6",
"@metamask/eslint-config": "^6.0.0",
"@metamask/eslint-config-nodejs": "^6.0.0",
"@metamask/onboarding": "^1.0.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.0.2",
"eslint": "^7.7.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-json": "^2.0.1",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eth-sig-util": "^2.5.3",
"ethereumjs-util": "^5.1.1",
"ethers": "^5.0.32",
"gh-pages": "^3.1.0",
"prettier": "^2.0.5",
"prettier": "^2.3.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"
},
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"sha3": true,
"secp256k1": true,
"keccak": true,
"fsevents": true
}
}
}
Loading

0 comments on commit 4e511c5

Please sign in to comment.