Skip to content

Commit b13e399

Browse files
authored
Add rule for Intl Locale Info API (#278)
1 parent fb3b4c0 commit b13e399

File tree

43 files changed

+2245
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2245
-41
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-firstdayofweek` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-getcalendars` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-getcollations` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-gethourcycles` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-getnumberingsystems` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-gettextinfo` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-gettimezones` rule
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-es-x": minor
3+
---
4+
5+
Add `es-x/no-intl-locale-prototype-getweekinfo` rule

docs/configs/index.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ export default [
2626

2727
</details>
2828

29+
## no-new-in-esnext-intl-api
30+
31+
disallow the new stuff to be planned for the next yearly ECMAScript Intl API (ECMA-402) snapshot.\
32+
⚠️ This config will be changed in the minor versions of this plugin.
33+
34+
```js
35+
import pluginESx from "eslint-plugin-es-x"
36+
export default [
37+
pluginESx.configs['flat/no-new-in-esnext-intl-api']
38+
]
39+
```
40+
41+
<details><summary> Legacy Config </summary>
42+
43+
.eslintrc.*:
44+
45+
```json
46+
{
47+
"extends": ["plugin:es-x/no-new-in-esnext-intl-api"],
48+
}
49+
```
50+
51+
</details>
52+
2953
## no-new-in-es2025
3054

3155
disallow new stuff in ES2025.
@@ -1067,6 +1091,32 @@ export default [
10671091

10681092
</details>
10691093

1094+
## no-intl-locale-info
1095+
1096+
disallow proposal ES2026 Intl API [Intl Locale Info API](https://github.com/tc39/proposal-intl-locale-info)\
1097+
⚠️ This config will be changed in the minor versions of this plugin.
1098+
1099+
This configs includes rules for [es-x/no-intl-locale-prototype-firstdayofweek](../rules/no-intl-locale-prototype-firstdayofweek.md), [es-x/no-intl-locale-prototype-getcalendars](../rules/no-intl-locale-prototype-getcalendars.md), [es-x/no-intl-locale-prototype-getcollations](../rules/no-intl-locale-prototype-getcollations.md), [es-x/no-intl-locale-prototype-gethourcycles](../rules/no-intl-locale-prototype-gethourcycles.md), [es-x/no-intl-locale-prototype-getnumberingsystems](../rules/no-intl-locale-prototype-getnumberingsystems.md), [es-x/no-intl-locale-prototype-gettextinfo](../rules/no-intl-locale-prototype-gettextinfo.md), [es-x/no-intl-locale-prototype-gettimezones](../rules/no-intl-locale-prototype-gettimezones.md), and [es-x/no-intl-locale-prototype-getweekinfo](../rules/no-intl-locale-prototype-getweekinfo.md).
1100+
1101+
```js
1102+
import pluginESx from "eslint-plugin-es-x"
1103+
export default [
1104+
pluginESx.configs['flat/no-intl-locale-info']
1105+
]
1106+
```
1107+
1108+
<details><summary> Legacy Config </summary>
1109+
1110+
.eslintrc.*:
1111+
1112+
```json
1113+
{
1114+
"extends": ["plugin:es-x/no-intl-locale-info"],
1115+
}
1116+
```
1117+
1118+
</details>
1119+
10701120
## no-float16array
10711121

10721122
disallow proposal ES2025 [Float16Array](https://github.com/tc39/proposal-float16array)

docs/rules/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ There is a config that enables the rules in this category: [`no-new-in-esnext`]
2626
| [es-x/no-uint8array-prototype-tohex](./no-uint8array-prototype-tohex.md) | disallow the `Uint8Array.prototype.toHex` method. | |
2727
| [es-x/no-using-declarations](./no-using-declarations.md) | disallow `using` and `await using` declarations. | |
2828

29+
## ES2026 Intl API
30+
31+
There is a config that enables the rules in this category: [`no-new-in-esnext-intl-api`]
32+
33+
| Rule ID | Description | |
34+
|:--------|:------------|:--:|
35+
| [es-x/no-intl-locale-prototype-firstdayofweek](./no-intl-locale-prototype-firstdayofweek.md) | disallow the `Intl.Locale.prototype.firstDayOfWeek` property. | |
36+
| [es-x/no-intl-locale-prototype-getcalendars](./no-intl-locale-prototype-getcalendars.md) | disallow the `Intl.Locale.prototype.getCalendars` method. | |
37+
| [es-x/no-intl-locale-prototype-getcollations](./no-intl-locale-prototype-getcollations.md) | disallow the `Intl.Locale.prototype.getCollations` method. | |
38+
| [es-x/no-intl-locale-prototype-gethourcycles](./no-intl-locale-prototype-gethourcycles.md) | disallow the `Intl.Locale.prototype.getHourCycles` method. | |
39+
| [es-x/no-intl-locale-prototype-getnumberingsystems](./no-intl-locale-prototype-getnumberingsystems.md) | disallow the `Intl.Locale.prototype.getNumberingSystems` method. | |
40+
| [es-x/no-intl-locale-prototype-gettextinfo](./no-intl-locale-prototype-gettextinfo.md) | disallow the `Intl.Locale.prototype.getTextInfo` method. | |
41+
| [es-x/no-intl-locale-prototype-gettimezones](./no-intl-locale-prototype-gettimezones.md) | disallow the `Intl.Locale.prototype.getTimeZones` method. | |
42+
| [es-x/no-intl-locale-prototype-getweekinfo](./no-intl-locale-prototype-getweekinfo.md) | disallow the `Intl.Locale.prototype.getWeekInfo` method. | |
43+
2944
## ES2025
3045

3146
There are multiple configs that enable all rules in this category: [`no-new-in-es2025`], [`restrict-to-es3`], [`restrict-to-es5`], [`restrict-to-es2015`], [`restrict-to-es2016`], [`restrict-to-es2017`], [`restrict-to-es2018`], [`restrict-to-es2019`], [`restrict-to-es2020`], [`restrict-to-es2021`], [`restrict-to-es2022`], [`restrict-to-es2023`], and [`restrict-to-es2024`]
@@ -505,6 +520,7 @@ Rules in this category are not included in any preset.
505520
| [es-x/no-string-prototype-iswellformed-towellformed](./no-string-prototype-iswellformed-towellformed.md) | [es-x/no-string-prototype-iswellformed](./no-string-prototype-iswellformed.md), [es-x/no-string-prototype-towellformed](./no-string-prototype-towellformed.md) |
506521

507522
[`no-new-in-esnext`]: ../configs/index.md#no-new-in-esnext
523+
[`no-new-in-esnext-intl-api`]: ../configs/index.md#no-new-in-esnext-intl-api
508524
[`no-new-in-es2025`]: ../configs/index.md#no-new-in-es2025
509525
[`restrict-to-es2024`]: ../configs/index.md#restrict-to-es2024
510526
[`no-new-in-es2025-intl-api`]: ../configs/index.md#no-new-in-es2025-intl-api

0 commit comments

Comments
 (0)