Skip to content

Add rule for Intl Locale Info API #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-firstdayofweek.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-firstdayofweek` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-getcalendars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-getcalendars` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-getcollations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-getcollations` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-gethourcycles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-gethourcycles` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-getnumberingsystems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-getnumberingsystems` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-gettextinfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-gettextinfo` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-gettimezones.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-gettimezones` rule
5 changes: 5 additions & 0 deletions .changeset/no-intl-locale-prototype-getweekinfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-es-x": minor
---

Add `es-x/no-intl-locale-prototype-getweekinfo` rule
50 changes: 50 additions & 0 deletions docs/configs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ export default [

</details>

## no-new-in-esnext-intl-api

disallow the new stuff to be planned for the next yearly ECMAScript Intl API (ECMA-402) snapshot.\
⚠️ This config will be changed in the minor versions of this plugin.

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/no-new-in-esnext-intl-api']
]
```

<details><summary> Legacy Config </summary>

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/no-new-in-esnext-intl-api"],
}
```

</details>

## no-new-in-es2025

disallow new stuff in ES2025.
Expand Down Expand Up @@ -1041,6 +1065,32 @@ export default [

</details>

## no-intl-locale-info

disallow proposal ES2026 Intl API [Intl Locale Info API](https://github.com/tc39/proposal-intl-locale-info)\
⚠️ This config will be changed in the minor versions of this plugin.

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).

```js
import pluginESx from "eslint-plugin-es-x"
export default [
pluginESx.configs['flat/no-intl-locale-info']
]
```

<details><summary> Legacy Config </summary>

.eslintrc.*:

```json
{
"extends": ["plugin:es-x/no-intl-locale-info"],
}
```

</details>

## no-float16array

disallow proposal ES2025 [Float16Array](https://github.com/tc39/proposal-float16array)
Expand Down
16 changes: 16 additions & 0 deletions docs/rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ There is a config that enables the rules in this category: [`no-new-in-esnext`]
| [es-x/no-symbol-dispose](./no-symbol-dispose.md) | disallow the `Symbol.dispose` property. | |
| [es-x/no-using-declarations](./no-using-declarations.md) | disallow `using` and `await using` declarations. | |

## ES2026 Intl API

There is a config that enables the rules in this category: [`no-new-in-esnext-intl-api`]

| Rule ID | Description | |
|:--------|:------------|:--:|
| [es-x/no-intl-locale-prototype-firstdayofweek](./no-intl-locale-prototype-firstdayofweek.md) | disallow the `Intl.Locale.prototype.firstDayOfWeek` property. | |
| [es-x/no-intl-locale-prototype-getcalendars](./no-intl-locale-prototype-getcalendars.md) | disallow the `Intl.Locale.prototype.getCalendars` method. | |
| [es-x/no-intl-locale-prototype-getcollations](./no-intl-locale-prototype-getcollations.md) | disallow the `Intl.Locale.prototype.getCollations` method. | |
| [es-x/no-intl-locale-prototype-gethourcycles](./no-intl-locale-prototype-gethourcycles.md) | disallow the `Intl.Locale.prototype.getHourCycles` method. | |
| [es-x/no-intl-locale-prototype-getnumberingsystems](./no-intl-locale-prototype-getnumberingsystems.md) | disallow the `Intl.Locale.prototype.getNumberingSystems` method. | |
| [es-x/no-intl-locale-prototype-gettextinfo](./no-intl-locale-prototype-gettextinfo.md) | disallow the `Intl.Locale.prototype.getTextInfo` method. | |
| [es-x/no-intl-locale-prototype-gettimezones](./no-intl-locale-prototype-gettimezones.md) | disallow the `Intl.Locale.prototype.getTimeZones` method. | |
| [es-x/no-intl-locale-prototype-getweekinfo](./no-intl-locale-prototype-getweekinfo.md) | disallow the `Intl.Locale.prototype.getWeekInfo` method. | |

## ES2025

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`]
Expand Down Expand Up @@ -498,6 +513,7 @@ Rules in this category are not included in any preset.
| [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) |

[`no-new-in-esnext`]: ../configs/index.md#no-new-in-esnext
[`no-new-in-esnext-intl-api`]: ../configs/index.md#no-new-in-esnext-intl-api
[`no-new-in-es2025`]: ../configs/index.md#no-new-in-es2025
[`restrict-to-es2024`]: ../configs/index.md#restrict-to-es2024
[`no-new-in-es2025-intl-api`]: ../configs/index.md#no-new-in-es2025-intl-api
Expand Down
62 changes: 62 additions & 0 deletions docs/rules/no-intl-locale-prototype-firstdayofweek.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "es-x/no-intl-locale-prototype-firstdayofweek"
description: "disallow the `Intl.Locale.prototype.firstDayOfWeek` property"
---

# es-x/no-intl-locale-prototype-firstdayofweek
> disallow the `Intl.Locale.prototype.firstDayOfWeek` property

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-intl-locale-info] and [no-new-in-esnext-intl-api]

This rule reports ES2026 Intl API [`Intl.Locale.prototype.firstDayOfWeek` property](https://github.com/tc39/proposal-intl-locale-info) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-intl-locale-prototype-firstdayofweek: error */
const foo = new Intl.Locale();
foo.firstDayOfWeek;
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-intl-locale-prototype-firstdayofweek": [
"error",
{
"aggressive": false,
"allowTestedProperty": false
}
]
}
}
```

### aggressive: boolean

Configure the aggressive mode for only this rule.
This is prior to the `settings['es-x'].aggressive` setting.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-intl-locale-prototype-firstdayofweek.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-intl-locale-prototype-firstdayofweek.js)

[no-intl-locale-info]: ../configs/index.md#no-intl-locale-info
[no-new-in-esnext-intl-api]: ../configs/index.md#no-new-in-esnext-intl-api
62 changes: 62 additions & 0 deletions docs/rules/no-intl-locale-prototype-getcalendars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "es-x/no-intl-locale-prototype-getcalendars"
description: "disallow the `Intl.Locale.prototype.getCalendars` method"
---

# es-x/no-intl-locale-prototype-getcalendars
> disallow the `Intl.Locale.prototype.getCalendars` method

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-intl-locale-info] and [no-new-in-esnext-intl-api]

This rule reports ES2026 Intl API [`Intl.Locale.prototype.getCalendars` method](https://github.com/tc39/proposal-intl-locale-info) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-intl-locale-prototype-getcalendars: error */
const foo = new Intl.Locale();
foo.getCalendars();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-intl-locale-prototype-getcalendars": [
"error",
{
"aggressive": false,
"allowTestedProperty": false
}
]
}
}
```

### aggressive: boolean

Configure the aggressive mode for only this rule.
This is prior to the `settings['es-x'].aggressive` setting.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-intl-locale-prototype-getcalendars.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-intl-locale-prototype-getcalendars.js)

[no-intl-locale-info]: ../configs/index.md#no-intl-locale-info
[no-new-in-esnext-intl-api]: ../configs/index.md#no-new-in-esnext-intl-api
62 changes: 62 additions & 0 deletions docs/rules/no-intl-locale-prototype-getcollations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "es-x/no-intl-locale-prototype-getcollations"
description: "disallow the `Intl.Locale.prototype.getCollations` method"
---

# es-x/no-intl-locale-prototype-getcollations
> disallow the `Intl.Locale.prototype.getCollations` method

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-intl-locale-info] and [no-new-in-esnext-intl-api]

This rule reports ES2026 Intl API [`Intl.Locale.prototype.getCollations` method](https://github.com/tc39/proposal-intl-locale-info) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-intl-locale-prototype-getcollations: error */
const foo = new Intl.Locale();
foo.getCollations();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-intl-locale-prototype-getcollations": [
"error",
{
"aggressive": false,
"allowTestedProperty": false
}
]
}
}
```

### aggressive: boolean

Configure the aggressive mode for only this rule.
This is prior to the `settings['es-x'].aggressive` setting.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-intl-locale-prototype-getcollations.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-intl-locale-prototype-getcollations.js)

[no-intl-locale-info]: ../configs/index.md#no-intl-locale-info
[no-new-in-esnext-intl-api]: ../configs/index.md#no-new-in-esnext-intl-api
62 changes: 62 additions & 0 deletions docs/rules/no-intl-locale-prototype-gethourcycles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "es-x/no-intl-locale-prototype-gethourcycles"
description: "disallow the `Intl.Locale.prototype.getHourCycles` method"
---

# es-x/no-intl-locale-prototype-gethourcycles
> disallow the `Intl.Locale.prototype.getHourCycles` method

- ❗ <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- ✅ The following configurations enable this rule: [no-intl-locale-info] and [no-new-in-esnext-intl-api]

This rule reports ES2026 Intl API [`Intl.Locale.prototype.getHourCycles` method](https://github.com/tc39/proposal-intl-locale-info) as errors.

## 💡 Examples

⛔ Examples of **incorrect** code for this rule:

<eslint-playground type="bad">

```js
/*eslint es-x/no-intl-locale-prototype-gethourcycles: error */
const foo = new Intl.Locale();
foo.getHourCycles();
```

</eslint-playground>

## 🔧 Options

This rule has an option.

```jsonc
{
"rules": {
"es-x/no-intl-locale-prototype-gethourcycles": [
"error",
{
"aggressive": false,
"allowTestedProperty": false
}
]
}
}
```

### aggressive: boolean

Configure the aggressive mode for only this rule.
This is prior to the `settings['es-x'].aggressive` setting.

### allowTestedProperty: boolean

Configure the allowTestedProperty mode for only this rule.
This is prior to the `settings['es-x'].allowTestedProperty` setting.

## 📚 References

- [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-intl-locale-prototype-gethourcycles.js)
- [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-intl-locale-prototype-gethourcycles.js)

[no-intl-locale-info]: ../configs/index.md#no-intl-locale-info
[no-new-in-esnext-intl-api]: ../configs/index.md#no-new-in-esnext-intl-api
Loading
Loading