@metamask/eslint-config-browser 12.1.0 → 14.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,24 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [14.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Bump minimum Node.js version from 16 to 18.18 ([#371](https://github.com/MetaMask/eslint-config/pull/371))
15
+ - **BREAKING:** Bump peer dependency on ESLint from `^8.57.0` to `^9.11.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
16
+ - ESLint 9 requires flat configs, so this change also rewrites the configs to
17
+ use flat configs. The legacy config format is no longer supported.
18
+ - **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))
19
+ - **BREAKING:** Change package to be pure ESM ([#370](https://github.com/MetaMask/eslint-config/pull/370))
20
+ - ESLint 9 supports ESM out-of-the-box, so this change updates the package to
21
+ be pure ESM. This means that the package can no longer be used with CommonJS
22
+ `require` syntax.
23
+
24
+ ## [13.0.0]
25
+
26
+ ### Changed
27
+
28
+ - **BREAKING**: Replace `eslint-plugin-import` with `eslint-plugin-import-x` ([#366](https://github.com/MetaMask/eslint-config/pull/366))
29
+ - **BREAKING**: Bump all ESLint dependencies ([#351](https://github.com/MetaMask/eslint-config/pull/351))
30
+ - Bumps all ESLint dependencies to the latest version compatible with Node.js 16.
31
+ - **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))
32
+
9
33
  ## [12.1.0]
34
+
10
35
  ### Changed
36
+
11
37
  - Add support for typescript 5.0.x, 5.1.x ([#288](https://github.com/MetaMask/eslint-config/pull/288))
12
38
 
13
39
  ## [12.0.0]
40
+
14
41
  ### Changed
42
+
15
43
  - **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
16
44
 
17
45
  ## [11.1.0]
46
+
18
47
  ### Changed
48
+
19
49
  - Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
20
50
 
21
51
  ## [11.0.0]
52
+
22
53
  ### Added
54
+
23
55
  - Initial release of this package.
24
56
 
25
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v12.1.0...HEAD
26
- [12.1.0]: https://github.com/MetaMask/eslint-config/compare/v12.0.0...v12.1.0
27
- [12.0.0]: https://github.com/MetaMask/eslint-config/compare/v11.1.0...v12.0.0
28
- [11.1.0]: https://github.com/MetaMask/eslint-config/compare/v11.0.0...v11.1.0
29
- [11.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/v11.0.0
57
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@14.0.0...HEAD
58
+ [14.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@13.0.0...@metamask/eslint-config-browser@14.0.0
59
+ [13.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@12.1.0...@metamask/eslint-config-browser@13.0.0
60
+ [12.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@12.0.0...@metamask/eslint-config-browser@12.1.0
61
+ [12.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@11.1.0...@metamask/eslint-config-browser@12.0.0
62
+ [11.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-browser@11.0.0...@metamask/eslint-config-browser@11.1.0
63
+ [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.0.0 \
12
- @metamask/eslint-config-browser@^12.0.0 \
13
- eslint@^8.27.0 \
14
- eslint-config-prettier@^8.5.0 \
15
- eslint-plugin-import@^2.27.5 \
16
- eslint-plugin-jsdoc@^41.1.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": "12.1.0",
3
+ "version": "14.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": {
25
- "@metamask/auto-changelog": "^3.0.0",
26
- "eslint": "^8.27.0",
27
- "eslint-config-prettier": "^8.5.0",
28
- "eslint-plugin-import": "^2.27.5",
29
- "eslint-plugin-jsdoc": "^41.1.2",
30
- "eslint-plugin-prettier": "^4.2.1",
31
- "prettier": "^2.7.1"
40
+ "@jest/globals": "^29.7.0",
41
+ "@metamask/auto-changelog": "^3.4.4",
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.1"
32
49
  },
33
50
  "peerDependencies": {
34
- "@metamask/eslint-config": "^12.0.0",
35
- "eslint": "^8.27.0"
51
+ "@metamask/eslint-config": "^14.0.0",
52
+ "eslint": "^9.11.0"
36
53
  },
37
54
  "engines": {
38
- "node": ">=14.0.0"
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
- };