@automattic/eslint-config-target-es 1.0.6 → 2.1.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
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.1.0] - 2024-02-07
9
+ ### Added
10
+ - All versions indicated by browserslist are now checked, not just the lowest. Added `getAllBrowsers` function to support this. [#31658]
11
+ - Support for more complex MDN data:
12
+ * Multiple support statements are now all checked. Previously only the first (most recent) was, which may have missed cases where support was backported.
13
+ * `version_removed` is now checked.
14
+ * Ranged versions (≤) are now handled.
15
+ * `prefix`, `alternative_name`, and `flags` now indicate (possible) lack of support. [#31658]
16
+
17
+ ### Changed
18
+ - Updated package dependencies.
19
+
20
+ ### Deprecated
21
+ - Deprecated `getBrowsers` function in favor of the new `getAllBrowsers`. [#31658]
22
+
23
+ ### Fixed
24
+ - Apparently MDN data considers "preview" a version, but didn't think that worth documenting. Handle it. [#31816]
25
+
26
+ ## [2.0.0] - 2023-06-26
27
+ ### Changed
28
+ - As `eslint-plugin-es` appears to be abandoned, change to using `eslint-plugin-es-x`. [#31556]
29
+ - Updated package dependencies.
30
+
8
31
  ## [1.0.6] - 2023-04-07
9
32
  ### Changed
10
33
  - Update to React 18.
@@ -36,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
36
59
  ### Added
37
60
  - Initial release.
38
61
 
62
+ [2.1.0]: https://github.com/Automattic/eslint-config-target-es/compare/2.0.0...2.1.0
63
+ [2.0.0]: https://github.com/Automattic/eslint-config-target-es/compare/1.0.6...2.0.0
39
64
  [1.0.6]: https://github.com/Automattic/eslint-config-target-es/compare/1.0.5...1.0.6
40
65
  [1.0.5]: https://github.com/Automattic/eslint-config-target-es/compare/1.0.4...1.0.5
41
66
  [1.0.4]: https://github.com/Automattic/eslint-config-target-es/compare/1.0.3...1.0.4
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # eslint-config-target-es
2
2
 
3
- ESLint shareable config to activate [eslint-plugin-es] checks based on [browserslist] browser targets and [MDN browser compatibility data].
3
+ ESLint shareable config to activate [eslint-plugin-es-x] checks based on [browserslist] browser targets and [MDN browser compatibility data].
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Generally you'll install this via your package manager, e.g.
8
8
 
9
9
  ```
10
- npm install --save-dev eslint eslint-plugin-es @automattic/eslint-config-target-es
10
+ npm install --save-dev eslint eslint-plugin-es-x @automattic/eslint-config-target-es
11
11
  ```
12
12
 
13
13
  ## Usage
@@ -61,10 +61,14 @@ to avoid your standard eslintrc and eslintignore and to avoid errors from any in
61
61
 
62
62
  You can import or require `@automattic/eslint-config-target-es/functions` to gain access to some functions that can be used to build your own configuration.
63
63
 
64
- As browserslist and MDN use different browser codes, `getBrowsers( { query: } )` will take a browserslist query and return an object with the MDN browser codes and the minimum matched version for each.
64
+ As browserslist and MDN use different browser codes, `getAllBrowsers( { query: } )` will take a browserslist query and return an object with the MDN browser codes and the matched versions for each.
65
65
 
66
66
  `getRules( { query:, builtins: } )` will return the rules config. Set `builtins` true for "builtins", false for "language", or null/undefined for "all".
67
67
 
68
+ ### Caveats
69
+
70
+ Some browsers supported by browserslist are not availble in the MDN data (e.g. Opera Mini) or are no longer being updated (e.g. Internet Explorer). In cases like these where no data is available, features are assumed to be supported. Set the environment variable `DEBUG=@automattic/eslint-config-target-es:warn` to generate messages when this happens.
71
+
68
72
  ## Security
69
73
 
70
74
  Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).
@@ -75,6 +79,6 @@ eslint-config-target-es is licensed under [GNU General Public License v2 (or lat
75
79
 
76
80
  --
77
81
 
78
- [eslint-plugin-es]: https://www.npmjs.com/package/eslint-plugin-es
82
+ [eslint-plugin-es-x]: https://www.npmjs.com/package/eslint-plugin-es-x
79
83
  [browserslist]: https://www.npmjs.com/package/browserslist
80
84
  [MDN browser compatibility data]: https://www.npmjs.com/package/@mdn/browser-compat-data
package/SECURITY.md CHANGED
@@ -4,11 +4,20 @@ Full details of the Automattic Security Policy can be found on [automattic.com](
4
4
 
5
5
  ## Supported Versions
6
6
 
7
- Generally, only the latest version of Jetpack has continued support. If a critical vulnerability is found in the current version of Jetpack, we may opt to backport any patches to previous versions.
7
+ Generally, only the latest version of Jetpack and its associated plugins have continued support. If a critical vulnerability is found in the current version of a plugin, we may opt to backport any patches to previous versions.
8
8
 
9
9
  ## Reporting a Vulnerability
10
10
 
11
- [Jetpack](https://jetpack.com/) is an open-source plugin for WordPress. Our HackerOne program covers the plugin software, as well as a variety of related projects and infrastructure.
11
+ Our HackerOne program covers the below plugin software, as well as a variety of related projects and infrastructure:
12
+
13
+ * [Jetpack](https://jetpack.com/)
14
+ * Jetpack Backup
15
+ * Jetpack Boost
16
+ * Jetpack CRM
17
+ * Jetpack Protect
18
+ * Jetpack Search
19
+ * Jetpack Social
20
+ * Jetpack VideoPress
12
21
 
13
22
  **For responsible disclosure of security issues and to be eligible for our bug bounty program, please submit your report via the [HackerOne](https://hackerone.com/automattic) portal.**
14
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/eslint-config-target-es",
3
- "version": "1.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "ESLint sharable config to activate eslint-plugin-es checks based on browserslist targets.",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/eslint-config-target-es/README.md#readme",
6
6
  "bugs": {
@@ -17,20 +17,20 @@
17
17
  "test": "jest tests"
18
18
  },
19
19
  "dependencies": {
20
- "@mdn/browser-compat-data": "4.2.1",
20
+ "@mdn/browser-compat-data": "5.3.28",
21
21
  "browserslist": "^4.17.6",
22
22
  "debug": "^4.3.2",
23
23
  "semver": "^7.3.5"
24
24
  },
25
25
  "devDependencies": {
26
- "@wordpress/browserslist-config": "5.13.0",
27
- "eslint": "8.33.0",
28
- "eslint-plugin-es": "4.1.0",
29
- "jest": "29.4.3"
26
+ "@wordpress/browserslist-config": "5.33.0",
27
+ "eslint": "8.51.0",
28
+ "eslint-plugin-es-x": "7.2.0",
29
+ "jest": "29.7.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "eslint": ">=4.19.1",
33
- "eslint-plugin-es": "^4.1.0"
33
+ "eslint-plugin-es-x": "^7.1.0"
34
34
  },
35
35
  "exports": {
36
36
  ".": "./src/configs/all.js",
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  env: {
3
- es2021: true,
3
+ es2022: true,
4
4
  },
5
- plugins: [ 'es' ],
5
+ plugins: [ 'es-x' ],
6
6
  };
package/src/funcs.js CHANGED
@@ -1,22 +1,20 @@
1
- const mdn = require( '@mdn/browser-compat-data' );
2
1
  const browserslist = require( 'browserslist' );
3
2
  const debug = require( 'debug' );
4
- const { rules: esRules } = require( 'eslint-plugin-es' );
3
+ const { rules: esRules } = require( 'eslint-plugin-es-x' );
5
4
  const semver = require( 'semver' );
6
5
  const browsersMap = require( './browsersMap.js' );
7
- const rulesMap = require( './rulesMap.js' );
6
+ const { needsCheck } = require( './needsCheck.js' );
8
7
 
9
8
  const warn = debug( '@automattic/eslint-config-target-es:warn' );
10
- const debuglog = debug( '@automattic/eslint-config-target-es:debug' );
11
9
 
12
10
  /**
13
11
  * Get the list of supported browsers.
14
12
  *
15
13
  * @param {object} options - Options.
16
14
  * @param {string} options.query - Browserslist query.
17
- * @returns {object} Browsers mapped to versions.
15
+ * @returns {object} Browsers mapped to arrays of versions.
18
16
  */
19
- function getBrowsers( options = {} ) {
17
+ function getAllBrowsers( options = {} ) {
20
18
  const browsers = {};
21
19
  for ( const b of browserslist( options.query ) ) {
22
20
  const m = b.match( /^([a-z_]+) (all|[0-9.]+)(-.*)?$/ );
@@ -33,96 +31,33 @@ function getBrowsers( options = {} ) {
33
31
  continue;
34
32
  }
35
33
  const ver = m[ 2 ] === 'all' ? '0.0.0' : semver.coerce( m[ 2 ] ).version;
36
- if ( typeof browsers[ browser ] === 'undefined' || semver.lt( ver, browsers[ browser ] ) ) {
37
- browsers[ browser ] = ver;
38
- }
34
+ browsers[ browser ] ||= [];
35
+ browsers[ browser ].push( ver );
36
+ browsers[ browser ].sort( semver.compare );
39
37
  }
40
38
  return browsers;
41
39
  }
42
40
 
43
41
  /**
44
- * Test if a rule needs to be checked.
42
+ * Get the list of supported browsers.
45
43
  *
46
- * @param {string} rule - Rule.
47
- * @param {object} browsers - Browsers targeted.
44
+ * @deprecated since 2.1.0. Use getAllBrowsers instead.
48
45
  * @param {object} options - Options.
49
- * @param {boolean|null} options.builtins - If true, only rules with "javascript.builtins" paths are checked. If false, such rules are not checked. If null/undefined, all may be checked.
50
- * @returns {boolean} Whether the rule needs to be checked.
46
+ * @param {string} options.query - Browserslist query.
47
+ * @returns {object} Browsers mapped to minimum versions.
51
48
  */
52
- // eslint-disable-next-line no-unused-vars
53
- function needsCheck( rule, browsers, options = {} ) {
54
- let paths = rulesMap[ rule ];
55
- if ( paths === true || paths === false ) {
56
- return paths;
57
- }
58
- if ( ! Array.isArray( paths ) ) {
59
- paths = [ paths ];
60
- }
61
-
62
- if (
63
- options.builtins === false &&
64
- paths.some( path => path.startsWith( 'javascript.builtins.' ) )
65
- ) {
66
- return false;
67
- }
68
- if (
69
- options.builtins === true &&
70
- ! paths.some( path => path.startsWith( 'javascript.builtins.' ) )
71
- ) {
72
- return false;
73
- }
74
-
75
- path: for ( const path of paths ) {
76
- let data = mdn;
77
- for ( const k of path.split( '.' ) ) {
78
- data = data[ k ];
79
- if ( ! data ) {
80
- warn( `Invalid feature map for rule ${ rule }: ${ path } does not exist` );
81
- continue path;
82
- }
83
- }
84
- if ( ! data.__compat || ! data.__compat.support ) {
85
- warn( `Invalid feature map for rule ${ rule }: No data at ${ path }` );
86
- continue path;
87
- }
88
-
89
- browser: for ( const browser of Object.keys( browsers ) ) {
90
- if ( ! data.__compat.support[ browser ] ) {
91
- debuglog( `No support data for ${ browser } for rule ${ rule } (${ path }), skipping` );
92
- continue browser;
93
- }
94
- let support = data.__compat.support[ browser ];
95
- if ( Array.isArray( support ) ) {
96
- support = support[ 0 ];
97
- }
98
-
99
- if ( support.version_added === null ) {
100
- debuglog( `No support data for ${ browser } for rule ${ rule } (${ path }), skipping` );
101
- continue browser;
102
- } else if ( support.version_added === false ) {
103
- debuglog( `${ browser } needs check for ${ rule } (${ path })` );
104
- return true;
105
- } else if ( support.version_added === true ) {
106
- continue browser;
107
- } else if ( semver.gt( semver.coerce( support.version_added ), browsers[ browser ] ) ) {
108
- debuglog(
109
- `${ browser } < ${ support.version_added } needs check for ${ rule } (${ path }); we have ${ browsers[ browser ] }`
110
- );
111
- return true;
112
- } else if ( support.partial_implementation ) {
113
- debuglog(
114
- `${ browser } needs check for ${ rule } (${ path }) due to partial implementation`
115
- );
116
- return true;
117
- }
118
- }
49
+ function getBrowsers( options = {} ) {
50
+ warn( 'getBrowsers is deprecated. Use getAllBrowsers instead.' );
51
+ const browsers = getAllBrowsers( options );
52
+ const ret = {};
53
+ for ( const k of Object.keys( browsers ) ) {
54
+ ret[ k ] = browsers[ k ][ 0 ];
119
55
  }
120
-
121
- return false;
56
+ return ret;
122
57
  }
123
58
 
124
59
  /**
125
- * Get the es rule configurations.
60
+ * Get the es-x rule configurations.
126
61
  *
127
62
  * @param {object} options - Options.
128
63
  * @param {boolean|null} options.builtins - If true, only rules with "javascript.builtins" paths are checked. If false, such rules are not checked. If null/undefined, all may be checked.
@@ -130,15 +65,16 @@ function needsCheck( rule, browsers, options = {} ) {
130
65
  * @returns {object} Rules configuration.
131
66
  */
132
67
  function getRules( options = {} ) {
133
- const browsers = getBrowsers( options );
68
+ const browsers = getAllBrowsers( options );
134
69
  const ret = {};
135
70
  for ( const rule of Object.keys( esRules ) ) {
136
- ret[ `es/${ rule }` ] = needsCheck( rule, browsers, options ) ? 2 : 0;
71
+ ret[ `es-x/${ rule }` ] = needsCheck( rule, browsers, options ) ? 2 : 0;
137
72
  }
138
73
  return ret;
139
74
  }
140
75
 
141
76
  module.exports = {
77
+ getAllBrowsers,
142
78
  getBrowsers,
143
79
  getRules,
144
80
  };
@@ -0,0 +1,151 @@
1
+ const mdn = require( '@mdn/browser-compat-data' );
2
+ const debug = require( 'debug' );
3
+ const semver = require( 'semver' );
4
+ const rulesMap = require( './rulesMap.js' );
5
+
6
+ const warn = debug( '@automattic/eslint-config-target-es:warn' );
7
+ const debuglog = debug( '@automattic/eslint-config-target-es:debug' );
8
+
9
+ /**
10
+ * Test if a rule needs to be checked.
11
+ *
12
+ * @param {string} rule - Rule.
13
+ * @param {object} browsers - Browsers targeted.
14
+ * @param {object} options - Options.
15
+ * @param {boolean|null} options.builtins - If true, only rules with "javascript.builtins" paths are checked. If false, such rules are not checked. If null/undefined, all may be checked.
16
+ * @returns {boolean} Whether the rule needs to be checked.
17
+ */
18
+ function needsCheck( rule, browsers, options = {} ) {
19
+ let paths = rulesMap[ rule ];
20
+ if ( paths === true || paths === false ) {
21
+ return paths;
22
+ }
23
+ if ( paths === undefined ) {
24
+ warn( `No feature map for rule ${ rule }` );
25
+ return false;
26
+ }
27
+ if ( ! Array.isArray( paths ) ) {
28
+ paths = [ paths ];
29
+ }
30
+
31
+ if (
32
+ options.builtins === false &&
33
+ paths.some( path => path.startsWith( 'javascript.builtins.' ) )
34
+ ) {
35
+ return false;
36
+ }
37
+ if (
38
+ options.builtins === true &&
39
+ ! paths.some( path => path.startsWith( 'javascript.builtins.' ) )
40
+ ) {
41
+ return false;
42
+ }
43
+
44
+ const semver000 = semver.coerce( '0.0.0' );
45
+
46
+ path: for ( const path of paths ) {
47
+ let data = mdn;
48
+ for ( const k of path.split( '.' ) ) {
49
+ data = data[ k ];
50
+ if ( ! data ) {
51
+ warn( `Invalid feature map for rule ${ rule }: ${ path } does not exist` );
52
+ continue path;
53
+ }
54
+ }
55
+ if ( ! data.__compat || ! data.__compat.support ) {
56
+ warn( `Invalid feature map for rule ${ rule }: No data at ${ path }` );
57
+ continue path;
58
+ }
59
+
60
+ browser: for ( const browser of Object.keys( browsers ) ) {
61
+ if ( ! data.__compat.support[ browser ] ) {
62
+ warn( `No support data for ${ browser } for rule ${ rule } (${ path }), skipping` );
63
+ continue browser;
64
+ }
65
+
66
+ const supports = Array.isArray( data.__compat.support[ browser ] )
67
+ ? data.__compat.support[ browser ]
68
+ : [ data.__compat.support[ browser ] ];
69
+ const vers = Array.isArray( browsers[ browser ] )
70
+ ? browsers[ browser ]
71
+ : [ browsers[ browser ] ];
72
+
73
+ version: for ( const ver of vers ) {
74
+ const results = [];
75
+ support: for ( const support of supports ) {
76
+ if ( support.version_added === null ) {
77
+ continue support;
78
+ }
79
+
80
+ if ( support.version_added === false ) {
81
+ results.push( 'no support' );
82
+ continue support;
83
+ }
84
+ if ( support.version_added === 'preview' ) {
85
+ results.push( 'added version is "preview"' );
86
+ continue support;
87
+ }
88
+
89
+ let added, removed;
90
+ if ( support.version_added === true ) {
91
+ added = semver000;
92
+ } else {
93
+ added = support.version_added.startsWith( '≤' )
94
+ ? semver000
95
+ : semver.coerce( support.version_added );
96
+ }
97
+ if ( support.version_removed === true ) {
98
+ removed = semver000;
99
+ } else if (
100
+ typeof support.version_removed === 'string' &&
101
+ support.version_removed !== 'preview'
102
+ ) {
103
+ removed = support.version_removed.startsWith( '≤' )
104
+ ? semver000
105
+ : semver.coerce( support.version_removed );
106
+ }
107
+
108
+ const range = removed ? `${ added } – <${ removed }` : `>= ${ added }`;
109
+
110
+ if ( semver.gt( added, ver ) || ( removed && semver.lte( removed, ver ) ) ) {
111
+ results.push( `outside range ${ range }` );
112
+ } else if ( support.partial_implementation ) {
113
+ results.push( `partial implementation for ${ range }` );
114
+ } else if ( support.prefix ) {
115
+ results.push( `prefixed implementation for ${ range }` );
116
+ } else if ( support.alternative_name ) {
117
+ results.push( `alternatively named implementation for ${ range }` );
118
+ } else if ( support.flags ) {
119
+ results.push( `flagged implementation for ${ range }` );
120
+ } else {
121
+ // It's good! Check the next version.
122
+ continue version;
123
+ }
124
+ }
125
+
126
+ // If there was no support data at all...
127
+ if ( results.length === 0 ) {
128
+ warn( `No support data for ${ browser } for rule ${ rule } (${ path }), skipping` );
129
+ continue browser;
130
+ }
131
+
132
+ // If no support entry hit the "It's good" case, it's no good. Log the reasons.
133
+ // If there are reasons other than "outside range", skip any "outside range" as irrelevant.
134
+ let results2 = results.filter( v => ! v.startsWith( 'outside range' ) );
135
+ if ( results2.length === 0 ) {
136
+ results2 = results;
137
+ }
138
+ debuglog(
139
+ `${ browser } ${ ver } needs check for ${ rule } (${ path }); ${ results2.join( '; ' ) }`
140
+ );
141
+ return true;
142
+ }
143
+ }
144
+ }
145
+
146
+ return false;
147
+ }
148
+
149
+ module.exports = {
150
+ needsCheck,
151
+ };
package/src/rulesMap.js CHANGED
@@ -1,14 +1,70 @@
1
- // Map of eslint-plugin-es rules to MDN compat-data paths.
1
+ // Map of eslint-plugin-es-x rules to MDN compat-data paths.
2
2
  // Values are either a path, an array of paths, true to always enable the rule, or false to always disable it.
3
3
  module.exports = {
4
+ // ?
5
+ 'no-atomics-waitasync': 'javascript.builtins.Atomics.waitAsync',
6
+ 'no-regexp-v-flag': 'javascript.builtins.RegExp.unicodeSets',
7
+ 'no-string-prototype-iswellformed-towellformed': [
8
+ 'javascript.builtins.String.isWellFormed',
9
+ 'javascript.builtins.String.toWellFormed',
10
+ ],
11
+
12
+ // ES2023
13
+ 'no-array-prototype-findlast-findlastindex': [
14
+ 'javascript.builtins.Array.findLast',
15
+ 'javascript.builtins.Array.findLastIndex',
16
+ ],
17
+ 'no-array-prototype-toreversed': 'javascript.builtins.Array.toReversed',
18
+ 'no-array-prototype-tosorted': 'javascript.builtins.Array.toSorted',
19
+ 'no-array-prototype-tospliced': 'javascript.builtins.Array.toSpliced',
20
+ 'no-array-prototype-with': 'javascript.builtins.Array.with',
21
+ 'no-hashbang': 'javascript.grammar.hashbang_comments',
22
+ 'no-intl-numberformat-prototype-formatrange': 'javascript.builtins.Intl.NumberFormat.formatRange',
23
+ 'no-intl-numberformat-prototype-formatrangetoparts':
24
+ 'javascript.builtins.Intl.NumberFormat.formatRangeToParts',
25
+ 'no-intl-pluralrules-prototype-selectrange': 'javascript.builtins.Intl.PluralRules.selectRange',
26
+ 'no-regexp-unicode-property-escapes-2023': false, // No support data in MDN separate from no-regexp-unicode-property-escapes. https://github.com/mdn/browser-compat-data/issues/19631
27
+
28
+ // ES2022
29
+ 'no-arbitrary-module-namespace-names': false, // No support data. https://github.com/mdn/browser-compat-data/issues/18152
30
+ 'no-array-string-prototype-at': [
31
+ 'javascript.builtins.Array.at',
32
+ 'javascript.builtins.String.at',
33
+ 'javascript.builtins.TypedArray.at',
34
+ ],
35
+ 'no-class-fields': [
36
+ 'javascript.classes.private_class_fields',
37
+ 'javascript.classes.private_class_methods',
38
+ 'javascript.classes.public_class_fields',
39
+ 'javascript.classes.static_class_fields',
40
+ ],
41
+ 'no-class-static-block': 'javascript.classes.static_initialization_blocks',
42
+ 'no-error-cause': [
43
+ 'javascript.builtins.Error.Error.options_cause_parameter',
44
+ 'javascript.builtins.Error.cause',
45
+ ],
46
+ 'no-intl-segmenter': 'javascript.builtins.Intl.Segmenter',
47
+ 'no-intl-supportedvaluesof': 'javascript.builtins.Intl.supportedValuesOf',
48
+ 'no-object-hasown': 'javascript.builtins.Object.hasOwn',
49
+ 'no-private-in': 'javascript.classes.private_class_fields_in',
50
+ 'no-regexp-d-flag': 'javascript.builtins.RegExp.hasIndices',
51
+ 'no-regexp-unicode-property-escapes-2022': false, // No support data in MDN separate from no-regexp-unicode-property-escapes. https://github.com/mdn/browser-compat-data/issues/19631
52
+ 'no-top-level-await': 'javascript.operators.await.top_level',
53
+
4
54
  // ES2021
55
+ 'no-intl-datetimeformat-prototype-formatrange':
56
+ 'javascript.builtins.Intl.DateTimeFormat.formatRange',
57
+ 'no-intl-displaynames': 'javascript.builtins.Intl.DisplayNames',
58
+ 'no-intl-listformat': 'javascript.builtins.Intl.ListFormat',
5
59
  'no-logical-assignment-operators': [
6
60
  'javascript.operators.logical_and_assignment',
7
- 'javascript.operators.logical_nullish_assignment',
61
+ 'javascript.operators.nullish_coalescing_assignment',
8
62
  'javascript.operators.logical_or_assignment',
9
63
  ],
10
64
  'no-numeric-separators': 'javascript.grammar.numeric_separators',
11
65
  'no-promise-any': [ 'javascript.builtins.AggregateError', 'javascript.builtins.Promise.any' ],
66
+ 'no-regexp-unicode-property-escapes-2021': false, // No support data in MDN separate from no-regexp-unicode-property-escapes. https://github.com/mdn/browser-compat-data/issues/19631
67
+ 'no-string-prototype-replaceall': 'javascript.builtins.String.replaceAll',
12
68
  'no-weakrefs': [ 'javascript.builtins.WeakRef', 'javascript.builtins.FinalizationRegistry' ],
13
69
 
14
70
  // ES2020
@@ -17,31 +73,49 @@ module.exports = {
17
73
  'javascript.builtins.BigInt64Array',
18
74
  'javascript.builtins.BigUint64Array',
19
75
  ],
20
- 'no-dynamic-import': 'javascript.statements.import.dynamic_import',
76
+ 'no-dynamic-import': 'javascript.operators.import',
21
77
  'no-export-ns-from': 'javascript.statements.export.namespace',
22
78
  'no-global-this': 'javascript.builtins.globalThis',
23
- 'no-import-meta': 'javascript.statements.import_meta',
79
+ 'no-import-meta': 'javascript.operators.import_meta',
80
+ 'no-intl-locale': 'javascript.builtins.Intl.Locale',
81
+ 'no-intl-relativetimeformat': 'javascript.builtins.Intl.RelativeTimeFormat',
24
82
  'no-nullish-coalescing-operators': 'javascript.operators.nullish_coalescing',
25
83
  'no-optional-chaining': 'javascript.operators.optional_chaining',
26
84
  'no-promise-all-settled': 'javascript.builtins.Promise.allSettled',
85
+ 'no-regexp-unicode-property-escapes-2020': false, // No support data in MDN separate from no-regexp-unicode-property-escapes. https://github.com/mdn/browser-compat-data/issues/19631
86
+ 'no-string-prototype-matchall': 'javascript.builtins.String.matchAll',
27
87
 
28
88
  // ES2019
89
+ 'no-array-prototype-flat': [
90
+ 'javascript.builtins.Array.flat',
91
+ 'javascript.builtins.Array.flatMap',
92
+ ],
29
93
  'no-json-superset': 'javascript.builtins.JSON.json_superset',
30
94
  'no-object-fromentries': 'javascript.builtins.Object.fromEntries',
31
95
  'no-optional-catch-binding': 'javascript.statements.try_catch.optional_catch_binding',
32
- 'no-regexp-unicode-property-escapes-2019': false, // No support data in MDN separate from no-regexp-unicode-property-escapes?
96
+ 'no-regexp-unicode-property-escapes-2019': false, // No support data in MDN separate from no-regexp-unicode-property-escapes. https://github.com/mdn/browser-compat-data/issues/19631
97
+ 'no-string-prototype-trimstart-trimend': [
98
+ 'javascript.builtins.String.trimEnd',
99
+ 'javascript.builtins.String.trimStart',
100
+ ],
101
+ 'no-symbol-prototype-description': 'javascript.builtins.Symbol.description',
33
102
 
34
103
  // ES2018
35
104
  'no-async-iteration': [
36
105
  'javascript.operators.async_generator_function',
37
106
  'javascript.statements.async_generator_function',
38
107
  ],
108
+ 'no-intl-numberformat-prototype-formattoparts':
109
+ 'javascript.builtins.Intl.NumberFormat.formatToParts',
110
+ 'no-intl-pluralrules': 'javascript.builtins.Intl.PluralRules',
39
111
  'no-malformed-template-literals':
40
112
  'javascript.grammar.template_literals.template_literal_revision',
41
- 'no-regexp-lookbehind-assertions': 'javascript.builtins.RegExp.lookbehind_assertion',
42
- 'no-regexp-named-capture-groups': 'javascript.builtins.RegExp.named_capture_groups',
113
+ 'no-promise-prototype-finally': 'javascript.builtins.Promise.finally',
114
+ 'no-regexp-lookbehind-assertions': 'javascript.regular_expressions.lookahead_assertion',
115
+ 'no-regexp-named-capture-groups': 'javascript.regular_expressions.named_capturing_group',
43
116
  'no-regexp-s-flag': 'javascript.builtins.RegExp.dotAll',
44
- 'no-regexp-unicode-property-escapes': 'javascript.builtins.RegExp.property_escapes',
117
+ 'no-regexp-unicode-property-escapes':
118
+ 'javascript.regular_expressions.unicode_character_class_escape',
45
119
  'no-rest-spread-properties': [
46
120
  'javascript.operators.object_initializer.spread_properties',
47
121
  'javascript.operators.spread.spread_in_object_literals',
@@ -53,10 +127,16 @@ module.exports = {
53
127
  'javascript.statements.async_function',
54
128
  ],
55
129
  'no-atomics': 'javascript.builtins.Atomics',
130
+ 'no-intl-datetimeformat-prototype-formattoparts':
131
+ 'javascript.builtins.Intl.DateTimeFormat.formatRangeToParts',
56
132
  'no-object-entries': 'javascript.builtins.Object.entries',
57
133
  'no-object-getownpropertydescriptors': 'javascript.builtins.Object.getOwnPropertyDescriptors',
58
134
  'no-object-values': 'javascript.builtins.Object.values',
59
135
  'no-shared-array-buffer': 'javascript.builtins.SharedArrayBuffer',
136
+ 'no-string-prototype-padstart-padend': [
137
+ 'javascript.builtins.String.padEnd',
138
+ 'javascript.builtins.String.padStart',
139
+ ],
60
140
  'no-trailing-function-commas': [
61
141
  'javascript.grammar.trailing_commas.trailing_commas_in_functions',
62
142
  'javascript.functions.arrow_functions.trailing_comma',
@@ -67,11 +147,20 @@ module.exports = {
67
147
  ],
68
148
 
69
149
  // ES2016
150
+ 'no-array-prototype-includes': 'javascript.builtins.Array.includes',
70
151
  'no-exponential-operators': 'javascript.operators.exponentiation',
152
+ 'no-intl-getcanonicallocales': 'javascript.builtins.Intl.getCanonicalLocales',
71
153
 
72
154
  // ES2015
73
155
  'no-array-from': 'javascript.builtins.Array.from',
74
156
  'no-array-of': 'javascript.builtins.Array.of',
157
+ 'no-array-prototype-copywithin': 'javascript.builtins.Array.copyWithin',
158
+ 'no-array-prototype-entries': 'javascript.builtins.Array.entries',
159
+ 'no-array-prototype-fill': 'javascript.builtins.Array.fill',
160
+ 'no-array-prototype-find': 'javascript.builtins.Array.find',
161
+ 'no-array-prototype-findindex': 'javascript.builtins.Array.findIndex',
162
+ 'no-array-prototype-keys': 'javascript.builtins.Array.keys',
163
+ 'no-array-prototype-values': 'javascript.builtins.Array.values',
75
164
  'no-arrow-functions': 'javascript.functions.arrow_functions',
76
165
  'no-binary-numeric-literals': 'javascript.grammar.binary_numeric_literals',
77
166
  'no-block-scoped-functions': 'javascript.functions.block_level_functions',
@@ -133,6 +222,7 @@ module.exports = {
133
222
  ],
134
223
  'no-proxy': 'javascript.builtins.Proxy',
135
224
  'no-reflect': 'javascript.builtins.Reflect',
225
+ 'no-regexp-prototype-flags': 'javascript.builtins.RegExp.flags',
136
226
  'no-regexp-u-flag': 'javascript.builtins.RegExp.unicode',
137
227
  'no-regexp-y-flag': 'javascript.builtins.RegExp.sticky',
138
228
  'no-rest-parameters': 'javascript.functions.rest_parameters',
@@ -142,6 +232,12 @@ module.exports = {
142
232
  'javascript.operators.spread.spread_in_function_calls',
143
233
  ],
144
234
  'no-string-fromcodepoint': 'javascript.builtins.String.fromCodePoint',
235
+ 'no-string-prototype-codepointat': 'javascript.builtins.String.codePointAt',
236
+ 'no-string-prototype-endswith': 'javascript.builtins.String.endsWith',
237
+ 'no-string-prototype-includes': 'javascript.builtins.String.includes',
238
+ 'no-string-prototype-normalize': 'javascript.builtins.String.normalize',
239
+ 'no-string-prototype-repeat': 'javascript.builtins.String.repeat',
240
+ 'no-string-prototype-startswith': 'javascript.builtins.String.startsWith',
145
241
  'no-string-raw': 'javascript.builtins.String.raw',
146
242
  'no-subclassing-builtins': false, // No support data.
147
243
  'no-symbol': 'javascript.builtins.Symbol',
@@ -168,9 +264,20 @@ module.exports = {
168
264
  // ES5
169
265
  'no-accessor-properties': 'javascript.operators.property_accessors',
170
266
  'no-array-isarray': 'javascript.builtins.Array.isArray',
267
+ 'no-array-prototype-every': 'javascript.builtins.Array.every',
268
+ 'no-array-prototype-filter': 'javascript.builtins.Array.filter',
269
+ 'no-array-prototype-foreach': 'javascript.builtins.Array.forEach',
270
+ 'no-array-prototype-indexof': 'javascript.builtins.Array.indexOf',
271
+ 'no-array-prototype-lastindexof': 'javascript.builtins.Array.lastIndexOf',
272
+ 'no-array-prototype-map': 'javascript.builtins.Array.map',
273
+ 'no-array-prototype-reduce': 'javascript.builtins.Array.reduce',
274
+ 'no-array-prototype-reduceright': 'javascript.builtins.Array.reduceRight',
275
+ 'no-array-prototype-some': 'javascript.builtins.Array.some',
171
276
  'no-date-now': 'javascript.builtins.Date.now',
277
+ 'no-function-prototype-bind': 'javascript.builtins.Function.bind',
172
278
  'no-json': 'javascript.builtins.JSON',
173
279
  'no-keyword-properties': false, // No support data.
280
+ 'no-object-create': 'javascript.builtins.Object.create',
174
281
  'no-object-defineproperties': 'javascript.builtins.Object.defineProperties',
175
282
  'no-object-defineproperty': 'javascript.builtins.Object.defineProperty',
176
283
  'no-object-freeze': 'javascript.builtins.Object.freeze',
@@ -183,8 +290,47 @@ module.exports = {
183
290
  'no-object-keys': 'javascript.builtins.Object.keys',
184
291
  'no-object-preventextensions': 'javascript.builtins.Object.preventExtensions',
185
292
  'no-object-seal': 'javascript.builtins.Object.seal',
293
+ 'no-string-prototype-trim': 'javascript.builtins.String.trim',
186
294
  'no-trailing-commas': [
187
295
  'javascript.grammar.trailing_commas',
188
296
  'javascript.grammar.trailing_commas.trailing_commas_in_object_literals',
189
297
  ],
298
+
299
+ // Annex B
300
+ 'no-date-prototype-getyear-setyear': [
301
+ 'javascript.builtins.Date.getYear',
302
+ 'javascript.builtins.Date.setYear',
303
+ ],
304
+ 'no-date-prototype-togmtstring': 'javascript.builtins.Date.toGMTString',
305
+ 'no-escape-unescape': [ 'javascript.builtins.escape', 'javascript.builtins.unescape' ],
306
+ 'no-function-declarations-in-if-statement-clauses-without-block': false, // No support data.
307
+ 'no-initializers-in-for-in': false, // No support data.
308
+ 'no-labelled-function-declarations': false, // No support data.
309
+ 'no-regexp-prototype-compile': 'javascript.builtins.RegExp.compile',
310
+ 'no-shadow-catch-param': false, // No support data.
311
+ 'no-string-create-html-methods': [
312
+ 'javascript.builtins.String.anchor',
313
+ 'javascript.builtins.String.big',
314
+ 'javascript.builtins.String.blink',
315
+ 'javascript.builtins.String.bold',
316
+ 'javascript.builtins.String.fixed',
317
+ 'javascript.builtins.String.fontcolor',
318
+ 'javascript.builtins.String.fontsize',
319
+ 'javascript.builtins.String.italics',
320
+ 'javascript.builtins.String.link',
321
+ 'javascript.builtins.String.small',
322
+ 'javascript.builtins.String.strike',
323
+ 'javascript.builtins.String.sub',
324
+ 'javascript.builtins.String.sup',
325
+ ],
326
+ 'no-string-prototype-substr': 'javascript.builtins.String.substr',
327
+ 'no-string-prototype-trimleft-trimright': false, // No support data.
328
+
329
+ // Other legacy
330
+ 'no-legacy-object-prototype-accessor-methods': [
331
+ 'javascript.builtins.Object.defineGetter',
332
+ 'javascript.builtins.Object.defineSetter',
333
+ 'javascript.builtins.Object.lookupGetter',
334
+ 'javascript.builtins.Object.lookupSetter',
335
+ ],
190
336
  };