@metamask/eslint-config-browser 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/package.json +43 -0
- package/src/environment.json +45 -0
- package/src/index.js +11 -0
- package/src/index.test.js +18 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [11.0.0]
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of this package.
|
|
12
|
+
|
|
13
|
+
[Unreleased]: https://github.com/MetaMask/eslint-config/compare/v11.0.0...HEAD
|
|
14
|
+
[11.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/v11.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 MetaMask
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# `@metamask/eslint-config-browser`
|
|
2
|
+
|
|
3
|
+
MetaMask's ESLint configuration for browser environments.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Our default export contains a base set of ESLint rules for ES6+:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add --dev \
|
|
11
|
+
@metamask/eslint-config@^11.0.0 \
|
|
12
|
+
@metamask/eslint-config-browser@^11.0.0 \
|
|
13
|
+
eslint@^8.27.0 \
|
|
14
|
+
eslint-config-prettier@^8.5.0 \
|
|
15
|
+
eslint-plugin-import@^2.26.0 \
|
|
16
|
+
eslint-plugin-jsdoc@^39.6.2 \
|
|
17
|
+
eslint-plugin-prettier@^4.2.1 \
|
|
18
|
+
prettier@^2.7.1
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The order in which you extend ESLint rules matters.
|
|
22
|
+
The `@metamask/*` eslint configs should be added to the `extends` array _last_,
|
|
23
|
+
with `@metamask/eslint-config` first, and `@metamask/eslint-config-*` in any
|
|
24
|
+
order thereafter.
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
module.exports = {
|
|
28
|
+
root: true,
|
|
29
|
+
|
|
30
|
+
extends: [
|
|
31
|
+
// These should be added last unless you know what you're doing.
|
|
32
|
+
'@metamask/eslint-config',
|
|
33
|
+
'@metamask/eslint-config-browser',
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metamask/eslint-config-browser",
|
|
3
|
+
"version": "11.0.0",
|
|
4
|
+
"description": "Shareable MetaMask ESLint plugin for browser environments.",
|
|
5
|
+
"homepage": "https://github.com/MetaMask/eslint-config#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/MetaMask/eslint-config/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/MetaMask/eslint-config.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"main": "src/index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"src/"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"lint:changelog": "auto-changelog validate",
|
|
20
|
+
"publish": "npm publish",
|
|
21
|
+
"test": "eslint ."
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@metamask/auto-changelog": "^3.0.0",
|
|
25
|
+
"eslint": "^8.27.0",
|
|
26
|
+
"eslint-config-prettier": "^8.5.0",
|
|
27
|
+
"eslint-plugin-import": "^2.26.0",
|
|
28
|
+
"eslint-plugin-jsdoc": "^39.6.2",
|
|
29
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
30
|
+
"prettier": "^2.7.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@metamask/eslint-config": "^11.0.0",
|
|
34
|
+
"eslint": "^8.27.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=14.0.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org/"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"no-restricted-globals": [
|
|
3
|
+
"error",
|
|
4
|
+
{
|
|
5
|
+
"name": "__dirname",
|
|
6
|
+
"message": "This global is not available in the browser environment."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"name": "__filename",
|
|
10
|
+
"message": "This global is not available in the browser environment."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "Buffer",
|
|
14
|
+
"message": "This global is not available in the browser environment."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "clearImmediate",
|
|
18
|
+
"message": "This global is not available in the browser environment."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "exports",
|
|
22
|
+
"message": "This global is not available in the browser environment."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "global",
|
|
26
|
+
"message": "This global is not available in the browser environment."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "module",
|
|
30
|
+
"message": "This global is not available in the browser environment."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "process",
|
|
34
|
+
"message": "This global is not available in the browser environment."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "require",
|
|
38
|
+
"message": "This global is not available in the browser environment."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "setImmediate",
|
|
42
|
+
"message": "This global is not available in the browser environment."
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { ESLint } = require('eslint');
|
|
2
|
+
|
|
3
|
+
const config = require('.');
|
|
4
|
+
|
|
5
|
+
describe('index', () => {
|
|
6
|
+
it('is a valid ESLint config', async () => {
|
|
7
|
+
const api = new ESLint({
|
|
8
|
+
baseConfig: config,
|
|
9
|
+
useEslintrc: false,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const result = await api.lintText(`console.log('Hello, world!');\n`);
|
|
13
|
+
|
|
14
|
+
expect(result[0].messages).toStrictEqual([]);
|
|
15
|
+
expect(result[0].warningCount).toBe(0);
|
|
16
|
+
expect(result[0].errorCount).toBe(0);
|
|
17
|
+
});
|
|
18
|
+
});
|