@metamask/eslint-config-browser 13.0.0 → 15.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 CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,32 +7,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [15.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Bump peer dependency on `@metamask/eslint-config` from `^14.0.0` to `^15.0.0` ([#431](https://github.com/MetaMask/eslint-config/pull/431))
15
+
16
+ ## [14.0.0]
17
+
18
+ ### Changed
19
+
20
+ - **BREAKING:** Bump minimum Node.js version from 16 to 18.18 ([#371](https://github.com/MetaMask/eslint-config/pull/371))
21
+ - **BREAKING:** Bump peer dependency on ESLint from `^8.57.0` to `^9.11.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
22
+ - ESLint 9 requires flat configs, so this change also rewrites the configs to
23
+ use flat configs. The legacy config format is no longer supported.
24
+ - **BREAKING:** Bump peer dependency on `@metamask/eslint-config` from `^13.0.0` to `^14.0.0` ([#377](https://github.com/MetaMask/eslint-config/pull/377))
25
+ - **BREAKING:** Change package to be pure ESM ([#370](https://github.com/MetaMask/eslint-config/pull/370))
26
+ - ESLint 9 supports ESM out-of-the-box, so this change updates the package to
27
+ be pure ESM. This means that the package can no longer be used with CommonJS
28
+ `require` syntax.
29
+
9
30
  ## [13.0.0]
31
+
10
32
  ### Changed
33
+
11
34
  - **BREAKING**: Replace `eslint-plugin-import` with `eslint-plugin-import-x` ([#366](https://github.com/MetaMask/eslint-config/pull/366))
12
35
  - **BREAKING**: Bump all ESLint dependencies ([#351](https://github.com/MetaMask/eslint-config/pull/351))
13
36
  - Bumps all ESLint dependencies to the latest version compatible with Node.js 16.
14
37
  - **BREAKING**: Bump minimum Node.js version from 14 to 16 ([#332](https://github.com/MetaMask/eslint-config/pull/332), [#339](https://github.com/MetaMask/eslint-config/pull/339))
15
38
 
16
39
  ## [12.1.0]
40
+
17
41
  ### Changed
42
+
18
43
  - Add support for typescript 5.0.x, 5.1.x ([#288](https://github.com/MetaMask/eslint-config/pull/288))
19
44
 
20
45
  ## [12.0.0]
46
+
21
47
  ### Changed
48
+
22
49
  - **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
23
50
 
24
51
  ## [11.1.0]
52
+
25
53
  ### Changed
54
+
26
55
  - Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
27
56
 
28
57
  ## [11.0.0]
58
+
29
59
  ### Added
60
+
30
61
  - Initial release of this package.
31
62
 
32
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v13.0.0...HEAD
33
- [13.0.0]: https://github.com/MetaMask/eslint-config/compare/v12.1.0...v13.0.0
34
- [12.1.0]: https://github.com/MetaMask/eslint-config/compare/v12.0.0...v12.1.0
35
- [12.0.0]: https://github.com/MetaMask/eslint-config/compare/v11.1.0...v12.0.0
36
- [11.1.0]: https://github.com/MetaMask/eslint-config/compare/v11.0.0...v11.1.0
37
- [11.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/v11.0.0
63
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@15.0.0...HEAD
64
+ [15.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@14.0.0...@metamask/eslint-config-browser@15.0.0
65
+ [14.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@13.0.0...@metamask/eslint-config-browser@14.0.0
66
+ [13.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@12.1.0...@metamask/eslint-config-browser@13.0.0
67
+ [12.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@12.0.0...@metamask/eslint-config-browser@12.1.0
68
+ [12.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@11.1.0...@metamask/eslint-config-browser@12.0.0
69
+ [11.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@11.0.0...@metamask/eslint-config-browser@11.1.0
70
+ [11.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/@metamask/eslint-config-browser@11.0.0
package/README.md CHANGED
@@ -8,30 +8,36 @@ Our default export contains a base set of ESLint rules for ES6+:
8
8
 
9
9
  ```bash
10
10
  yarn add --dev \
11
- @metamask/eslint-config@^12.2.0 \
12
- @metamask/eslint-config-browser@^12.1.0 \
13
- eslint@^8.57.0 \
14
- eslint-config-prettier@^8.5.0 \
15
- eslint-plugin-import-x@^0.5.1 \
16
- eslint-plugin-jsdoc@^47.0.2 \
17
- eslint-plugin-prettier@^4.2.1 \
18
- eslint-plugin-promise@^6.1.1 \
19
- prettier@^2.7.1
11
+ @metamask/eslint-config@^14.0.0 \
12
+ @metamask/eslint-config-browser@^14.0.0 \
13
+ eslint@^9.11.0 \
14
+ eslint-config-prettier@^9.1.0 \
15
+ eslint-plugin-import-x@^4.3.0 \
16
+ eslint-plugin-jsdoc@^50.2.4 \
17
+ eslint-plugin-prettier@^5.2.1 \
18
+ eslint-plugin-promise@^7.1.0 \
19
+ prettier@^3.3.3
20
20
  ```
21
21
 
22
22
  The order in which you extend ESLint rules matters.
23
- The `@metamask/*` eslint configs should be added to the `extends` array _last_,
23
+ The `@metamask/*` eslint configs should be added to the config array _last_,
24
24
  with `@metamask/eslint-config` first, and `@metamask/eslint-config-*` in any
25
25
  order thereafter.
26
26
 
27
27
  ```js
28
- module.exports = {
29
- root: true,
30
-
31
- extends: [
32
- // These should be added last unless you know what you're doing.
33
- '@metamask/eslint-config',
34
- '@metamask/eslint-config-browser',
35
- ],
36
- };
28
+ import base, { createConfig } from '@metamask/eslint-config';
29
+ import browser from '@metamask/eslint-config-browser';
30
+
31
+ const config = createConfig({
32
+ {
33
+ extends: [
34
+ // Any custom shared config should be added here.
35
+ // ...
36
+
37
+ // This should be added last unless you know what you're doing.
38
+ base,
39
+ browser,
40
+ ],
41
+ }
42
+ });
37
43
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eslint-config-browser",
3
- "version": "13.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "Shareable MetaMask ESLint plugin for browser environments.",
5
5
  "homepage": "https://github.com/MetaMask/eslint-config#readme",
6
6
  "bugs": {
@@ -11,31 +11,48 @@
11
11
  "url": "https://github.com/MetaMask/eslint-config.git"
12
12
  },
13
13
  "license": "MIT",
14
- "main": "src/index.js",
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./src/index.d.mts",
19
+ "default": "./src/index.mjs"
20
+ }
21
+ }
22
+ },
23
+ "main": "./src/index.mjs",
24
+ "types": "./src/index.d.mts",
15
25
  "files": [
16
26
  "src/",
17
- "!src/**/*.test.js"
27
+ "!src/**/*.test.mjs"
18
28
  ],
19
29
  "scripts": {
20
- "lint:changelog": "auto-changelog validate",
30
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/eslint-config-browser",
31
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/eslint-config-browser",
21
32
  "publish": "npm publish",
22
33
  "test": "eslint ."
23
34
  },
35
+ "dependencies": {
36
+ "@eslint/js": "^9.11.0",
37
+ "globals": "^15.9.0"
38
+ },
24
39
  "devDependencies": {
40
+ "@jest/globals": "^29.7.0",
25
41
  "@metamask/auto-changelog": "^3.4.4",
26
- "eslint": "^8.57.0",
27
- "eslint-config-prettier": "^8.5.0",
28
- "eslint-plugin-import-x": "^0.5.1",
29
- "eslint-plugin-jsdoc": "^47.0.2",
30
- "eslint-plugin-prettier": "^4.2.1",
31
- "prettier": "^2.7.1"
42
+ "eslint": "^9.11.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-plugin-import-x": "^4.3.0",
45
+ "eslint-plugin-jsdoc": "^50.2.4",
46
+ "eslint-plugin-prettier": "^5.2.1",
47
+ "prettier": "^3.3.3",
48
+ "vitest": "^2.1.9"
32
49
  },
33
50
  "peerDependencies": {
34
- "@metamask/eslint-config": "^13.0.0",
35
- "eslint": "^8.57.0"
51
+ "@metamask/eslint-config": "^15.0.0",
52
+ "eslint": "^9.11.0"
36
53
  },
37
54
  "engines": {
38
- "node": "^16.20 || ^18.18 || >=20"
55
+ "node": "^18.18 || >=20"
39
56
  },
40
57
  "publishConfig": {
41
58
  "access": "public",
@@ -0,0 +1,6 @@
1
+ declare module '@metamask/eslint-config-browser' {
2
+ import type { Linter } from 'eslint';
3
+
4
+ const config: Linter.Config[];
5
+ export default config;
6
+ }
package/src/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ import { createConfig } from '@metamask/eslint-config';
2
+ import globals from 'globals';
3
+ import { createRequire } from 'module';
4
+
5
+ // TODO: Use import attributes when ESLint supports them.
6
+ const customRequire = createRequire(import.meta.url);
7
+ const environmentRules = customRequire('./environment.json');
8
+
9
+ /**
10
+ * @type {import('eslint').Linter.Config[]}
11
+ */
12
+ const config = createConfig({
13
+ name: '@metamask/eslint-config-browser',
14
+
15
+ languageOptions: {
16
+ globals: {
17
+ ...globals.browser,
18
+ },
19
+ },
20
+
21
+ rules: {
22
+ ...environmentRules,
23
+ },
24
+ });
25
+
26
+ export default config;
package/src/index.js DELETED
@@ -1,11 +0,0 @@
1
- const environmentRules = require('./environment.json');
2
-
3
- module.exports = {
4
- env: {
5
- browser: true,
6
- },
7
-
8
- rules: {
9
- ...environmentRules,
10
- },
11
- };