├── .codecov.yml ├── .gitattributes ├── tests ├── fixtures │ ├── test.ts │ ├── test-module.ts │ ├── tsconfig.json │ └── types.d.ts └── lib │ └── rules │ ├── no-regexp-escape.js │ ├── no-promise-withresolvers.js │ ├── no-math-f16round.js │ ├── no-math-sumprecise.js │ ├── no-symbol-dispose.js │ ├── no-symbol-matchall.js │ ├── no-iterator-concat.js │ ├── no-atomics-waitasync.js │ ├── no-symbol-asyncdispose.js │ ├── no-promise-try.js │ ├── no-intl-locale.js │ ├── no-dynamic-import-options.js │ ├── no-map-groupby.js │ ├── no-date-now.js │ ├── no-intl-segmenter.js │ ├── no-object-create.js │ ├── no-array-of.js │ ├── no-intl-listformat.js │ ├── no-intl-pluralrules.js │ ├── no-object-groupby.js │ ├── no-object-is.js │ ├── no-math-cbrt.js │ ├── no-math-cosh.js │ ├── no-math-imul.js │ ├── no-math-log2.js │ ├── no-math-sign.js │ ├── no-math-sinh.js │ ├── no-math-tanh.js │ ├── no-object-seal.js │ ├── no-math-acosh.js │ ├── no-math-asinh.js │ ├── no-math-atanh.js │ ├── no-math-clz32.js │ ├── no-math-expm1.js │ ├── no-math-hypot.js │ ├── no-math-log10.js │ ├── no-math-log1p.js │ ├── no-math-trunc.js │ ├── no-new-target.js │ ├── no-object-keys.js │ ├── no-promise-all-settled.js │ ├── no-math-fround.js │ ├── no-number-isnan.js │ ├── no-object-hasown.js │ ├── no-string-raw.js │ ├── no-object-assign.js │ ├── no-object-freeze.js │ ├── no-optional-catch-binding.js │ ├── no-object-values.js │ ├── no-object-entries.js │ ├── no-object-isfrozen.js │ ├── no-object-issealed.js │ ├── no-float16array.js │ ├── no-number-isfinite.js │ ├── no-number-parseint.js │ ├── no-intl-displaynames.js │ ├── no-number-isinteger.js │ ├── no-number-parsefloat.js │ ├── no-initializers-in-for-in.js │ ├── no-intl-durationformat.js │ ├── no-labelled-function-declarations.js │ ├── no-object-fromentries.js │ ├── no-object-isextensible.js │ ├── no-disposablestack.js │ ├── no-suppressederror.js │ ├── no-import-meta.js │ ├── no-number-issafeinteger.js │ ├── no-object-defineproperty.js │ ├── no-object-getprototypeof.js │ ├── no-string-fromcodepoint.js │ ├── no-intl-relativetimeformat.js │ ├── no-intl-supportedvaluesof.js │ ├── no-object-setprototypeof.js │ ├── no-number-maxsafeinteger.js │ ├── no-number-minsafeinteger.js │ ├── no-object-defineproperties.js │ ├── no-intl-getcanonicallocales.js │ ├── no-object-preventextensions.js │ ├── no-map.js │ ├── no-set.js │ ├── no-proxy.js │ ├── no-symbol.js │ ├── no-iterator.js │ ├── no-atomics.js │ ├── no-classes.js │ ├── no-exponential-operators.js │ ├── no-promise.js │ ├── no-reflect.js │ ├── no-weak-map.js │ ├── no-weak-set.js │ ├── no-object-map-groupby.js │ ├── no-dynamic-import.js │ ├── no-object-getownpropertynames.js │ ├── no-asyncdisposablestack.js │ ├── no-binary-numeric-literals.js │ ├── no-octal-numeric-literals.js │ ├── no-class-static-block.js │ ├── no-json.js │ ├── no-object-getownpropertysymbols.js │ ├── no-object-getownpropertydescriptor.js │ ├── no-shared-array-buffer.js │ ├── no-object-getownpropertydescriptors.js │ ├── no-global-this.js │ ├── no-trailing-dynamic-import-commas.js │ ├── no-promise-any.js │ ├── no-array-isarray.js │ ├── no-uint8array-fromhex.js │ ├── no-uint8array-frombase64.js │ ├── no-export-ns-from.js │ ├── no-nonstandard-map-properties.js │ ├── no-nonstandard-set-properties.js │ ├── no-nonstandard-date-properties.js │ ├── no-nonstandard-json-properties.js │ └── no-nonstandard-math-properties.js ├── .npmrc ├── .nycrc ├── .env-cmdrc ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── cron.yml ├── .gitignore ├── docs ├── .vitepress │ └── theme │ │ ├── components │ │ └── monaco │ │ │ └── index.mjs │ │ ├── Layout.vue │ │ ├── style.css │ │ └── index.mjs └── rules │ └── no-escape-unescape.md ├── .vscode └── settings.json ├── scripts ├── fetch-lines.js ├── get-latest-unicode-script-values.js └── get-latest-unicode-general-category-values.js ├── jsconfig.json ├── lib ├── configs │ ├── no-new-in-es2015-intl-api.js │ ├── no-new-in-es2019-intl-api.js │ ├── no-new-in-es2024-intl-api.js │ ├── restrict-to-es2024.js │ ├── restrict-to-es2024-intl-api.js │ ├── no-new-in-es2025-intl-api.js │ ├── no-new-in-es2016-intl-api.js │ ├── no-new-in-es2017-intl-api.js │ ├── restrict-to-es2023.js │ ├── no-array-grouping.js │ ├── flat │ │ ├── no-new-in-es2015-intl-api.js │ │ ├── no-new-in-es2019-intl-api.js │ │ ├── no-new-in-es2024-intl-api.js │ │ ├── restrict-to-es2024.js │ │ ├── no-new-in-es2025-intl-api.js │ │ ├── no-new-in-es2016-intl-api.js │ │ ├── restrict-to-es2024-intl-api.js │ │ ├── no-new-in-es2017-intl-api.js │ │ ├── no-array-grouping.js │ │ ├── no-new-in-es2020-intl-api.js │ │ ├── no-string-matchall.js │ │ ├── restrict-to-es2023.js │ │ ├── no-new-in-es2016.js │ │ ├── no-new-in-es2022-intl-api.js │ │ ├── no-relative-indexing-method.js │ │ ├── no-is-usv-string.js │ │ ├── no-new-in-es2018-intl-api.js │ │ ├── restrict-to-es2023-intl-api.js │ │ ├── restrict-to-es2022.js │ │ ├── no-float16array.js │ │ ├── no-import-attributes.js │ │ ├── no-json-parse-with-source.js │ │ ├── no-new-in-es2021-intl-api.js │ │ ├── restrict-to-es2022-intl-api.js │ │ ├── no-class-fields.js │ │ ├── restrict-to-es2021.js │ │ ├── no-intl-numberformat-v3.js │ │ ├── no-new-in-es2023-intl-api.js │ │ ├── no-change-array-by-copy.js │ │ ├── restrict-to-es2021-intl-api.js │ │ ├── restrict-to-es2020.js │ │ ├── no-explicit-resource-management.js │ │ ├── restrict-to-es2019.js │ │ ├── restrict-to-es2020-intl-api.js │ │ ├── no-new-in-es2021.js │ │ ├── no-arraybuffer-base64.js │ │ ├── restrict-to-es2018.js │ │ ├── restrict-to-es2019-intl-api.js │ │ ├── no-new-in-es2019.js │ │ ├── no-new-in-es2023.js │ │ ├── no-set-methods.js │ │ ├── restrict-to-es2017.js │ │ ├── no-new-in-es2017.js │ │ ├── restrict-to-es2018-intl-api.js │ │ ├── no-new-in-es2018.js │ │ ├── restrict-to-es2016.js │ │ ├── no-new-in-es2024.js │ │ ├── restrict-to-es2017-intl-api.js │ │ ├── restrict-to-es2015.js │ │ ├── no-intl-locale-info.js │ │ ├── no-new-in-esnext-intl-api.js │ │ ├── no-new-in-es2020.js │ │ ├── restrict-to-es2016-intl-api.js │ │ ├── restrict-to-es5.js │ │ ├── restrict-to-es2015-intl-api.js │ │ └── restrict-to-es3.js │ ├── no-string-matchall.js │ ├── restrict-to-es2023-intl-api.js │ ├── no-new-in-es2016.js │ ├── no-new-in-es2020-intl-api.js │ ├── no-new-in-es2022-intl-api.js │ ├── no-relative-indexing-method.js │ ├── no-is-usv-string.js │ ├── no-new-in-es2018-intl-api.js │ ├── restrict-to-es2022.js │ ├── no-float16array.js │ ├── restrict-to-es2022-intl-api.js │ ├── no-import-attributes.js │ ├── no-json-parse-with-source.js │ ├── no-new-in-es2021-intl-api.js │ ├── restrict-to-es2021.js │ ├── no-class-fields.js │ ├── restrict-to-es2021-intl-api.js │ ├── no-intl-numberformat-v3.js │ ├── no-new-in-es2023-intl-api.js │ ├── no-change-array-by-copy.js │ ├── restrict-to-es2020.js │ ├── restrict-to-es2019.js │ ├── restrict-to-es2020-intl-api.js │ ├── no-explicit-resource-management.js │ ├── no-new-in-es2021.js │ ├── restrict-to-es2018.js │ ├── restrict-to-es2019-intl-api.js │ ├── no-arraybuffer-base64.js │ ├── restrict-to-es2017.js │ ├── no-new-in-es2019.js │ ├── no-new-in-es2023.js │ ├── restrict-to-es2018-intl-api.js │ ├── no-set-methods.js │ ├── no-new-in-es2017.js │ ├── restrict-to-es2016.js │ ├── no-new-in-es2018.js │ ├── restrict-to-es2017-intl-api.js │ ├── restrict-to-es2015.js │ ├── no-new-in-es2024.js │ ├── restrict-to-es2016-intl-api.js │ ├── restrict-to-es5.js │ ├── no-intl-locale-info.js │ ├── no-new-in-esnext-intl-api.js │ ├── no-new-in-es2020.js │ ├── restrict-to-es2015-intl-api.js │ ├── restrict-to-es3.js │ ├── restrict-to-es-intl-api-1st-edition.js │ ├── no-iterator-helpers.js │ └── no-new-in-es2022.js ├── util │ ├── optional-require.js │ └── merge-visitors.js └── rules │ ├── no-escape-unescape.js │ ├── no-iterator.js │ ├── no-float16array.js │ ├── no-disposablestack.js │ ├── no-suppressederror.js │ ├── no-asyncdisposablestack.js │ ├── no-json.js │ ├── no-map.js │ ├── no-set.js │ ├── no-proxy.js │ ├── no-symbol.js │ ├── no-atomics.js │ ├── no-promise.js │ ├── no-reflect.js │ ├── no-weak-map.js │ ├── no-weak-set.js │ ├── no-global-this.js │ ├── no-labelled-function-declarations.js │ ├── no-class-static-block.js │ ├── no-dynamic-import.js │ ├── no-for-of-loops.js │ ├── no-classes.js │ ├── no-rest-parameters.js │ ├── no-shared-array-buffer.js │ ├── no-export-ns-from.js │ ├── no-async-functions.js │ ├── no-default-parameters.js │ ├── no-generators.js │ ├── no-optional-catch-binding.js │ ├── no-initializers-in-for-in.js │ ├── no-import-meta.js │ ├── no-new-target.js │ ├── no-computed-properties.js │ ├── no-weakrefs.js │ └── no-block-scoped-functions.js ├── eslint-internal ├── config │ ├── _override-2016.js │ ├── _override-2019.js │ ├── _override-2020.js │ ├── +browser.js │ ├── _override-2018.js │ ├── _override-special.js │ ├── es2020.js │ ├── _override-2017.js │ └── _override-mocha.js └── my-plugin.js ├── .changeset ├── config.json └── README.md └── renovate.json /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /tests/fixtures/test.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock = false 2 | force = true 3 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["lib/**/*.js"] 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/test-module.ts: -------------------------------------------------------------------------------- 1 | export function fn() {} -------------------------------------------------------------------------------- /.env-cmdrc: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | "IN_VERSION_SCRIPT": "true" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: 2 | - eslint 3 | - ota-meshi 4 | open_collective: eslint 5 | tidelift: "npm/eslint" 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.nyc_output 2 | /coverage 3 | /docs/.vitepress/dist 4 | /docs/.vitepress/cache 5 | /node_modules 6 | /test.* 7 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/monaco/index.mjs: -------------------------------------------------------------------------------- 1 | export { setupMonacoEditor } from "./monaco-setup.mjs" 2 | export { loadMonacoEditor } from "./monaco-loader.mjs" 3 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.validate": [ 3 | "javascript", 4 | "vue" 5 | ], 6 | "typescript.tsdk": "node_modules/typescript/lib", 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "lib": ["ESNext"] 5 | }, 6 | "include": ["test.ts", "types.d.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /scripts/fetch-lines.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | module.exports = { fetchLines } 4 | 5 | async function* fetchLines(url) { 6 | const response = await fetch(url) 7 | yield* (await response.text()).split("\n") 8 | } 9 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "moduleResolution": "node", 5 | "module": "CommonJS", 6 | "strict": true, 7 | "strictNullChecks": true 8 | }, 9 | } -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2015-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { plugins: ["es-x"], rules: {} } 8 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2019-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { plugins: ["es-x"], rules: {} } 8 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2024-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { plugins: ["es-x"], rules: {} } 8 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2024.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { extends: [require.resolve("./no-new-in-es2025")] } 8 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2024-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { extends: [require.resolve("./no-new-in-es2025-intl-api")] } 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: daily 7 | 8 | - package-ecosystem: npm 9 | directory: / 10 | schedule: 11 | interval: daily 12 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2025-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { "es-x/no-intl-durationformat": "error" }, 10 | } 11 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2016-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { "es-x/no-intl-getcanonicallocales": "error" }, 10 | } 11 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2017-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { "es-x/no-intl-datetimeformat-prototype-formattoparts": "error" }, 10 | } 11 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2023.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | ], 12 | } 13 | -------------------------------------------------------------------------------- /lib/configs/no-array-grouping.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-map-groupby": "error", 11 | "es-x/no-object-groupby": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-2016.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | { 9 | name: "eslint-internal/config/_override-2016.js", 10 | languageOptions: { 11 | ecmaVersion: 2016, 12 | }, 13 | }, 14 | ] 15 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-2019.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | { 9 | name: "eslint-internal/config/_override-2019.js", 10 | languageOptions: { 11 | ecmaVersion: 2019, 12 | }, 13 | }, 14 | ] 15 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | { 9 | name: "eslint-internal/config/_override-2020.js", 10 | languageOptions: { 11 | ecmaVersion: 2020, 12 | }, 13 | }, 14 | ] 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2015-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: {}, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2019-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: {}, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2024-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: {}, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/no-string-matchall.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-string-prototype-matchall": "error", 11 | "es-x/no-symbol-matchall": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2023-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | ], 12 | } 13 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2016.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-array-prototype-includes": "error", 11 | "es-x/no-exponential-operators": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2020-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-locale": "error", 11 | "es-x/no-intl-relativetimeformat": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2022-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-segmenter": "error", 11 | "es-x/no-intl-supportedvaluesof": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/no-relative-indexing-method.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-array-prototype-at": "error", 11 | "es-x/no-string-prototype-at": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/no-is-usv-string.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-string-prototype-iswellformed": "error", 11 | "es-x/no-string-prototype-towellformed": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2018-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-numberformat-prototype-formattoparts": "error", 11 | "es-x/no-intl-pluralrules": "error", 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2022.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2024.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { ...require("./no-new-in-es2025").rules }, 14 | } 15 | -------------------------------------------------------------------------------- /eslint-internal/config/+browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const globals = require("./_browser-globals") 8 | 9 | module.exports = [ 10 | { 11 | name: "eslint-internal/config/+browser.js", 12 | languageOptions: { 13 | globals, 14 | }, 15 | }, 16 | ] 17 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2025-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { "es-x/no-intl-durationformat": "error" }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2016-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { "es-x/no-intl-getcanonicallocales": "error" }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2024-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { ...require("./no-new-in-es2025-intl-api").rules }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/no-float16array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-dataview-prototype-getfloat16-setfloat16": "error", 11 | "es-x/no-float16array": "error", 12 | "es-x/no-math-f16round": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2022-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2017-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { "es-x/no-intl-datetimeformat-prototype-formattoparts": "error" }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/no-import-attributes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-dynamic-import-options": "error", 11 | "es-x/no-import-attributes": "error", 12 | "es-x/no-trailing-dynamic-import-commas": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/no-json-parse-with-source.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-json-israwjson": "error", 11 | "es-x/no-json-parse-reviver-context-parameter": "error", 12 | "es-x/no-json-rawjson": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /tests/lib/rules/no-regexp-escape.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-regexp-escape.js") 5 | 6 | new RuleTester().run("no-regexp-escape", rule, { 7 | valid: ["RegExp.$1"], 8 | invalid: [ 9 | { 10 | code: "RegExp.escape", 11 | errors: ["ES2025 'RegExp.escape' is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config/schema.json", 3 | "changelog": [ 4 | "@svitejs/changesets-changelog-github-compact", 5 | { 6 | "repo": "eslint-community/eslint-plugin-es-x" 7 | } 8 | ], 9 | "commit": false, 10 | "linked": [], 11 | "access": "public", 12 | "baseBranch": "master", 13 | "bumpVersionsWithWorkspaceProtocolOnly": true, 14 | "ignore": [] 15 | } 16 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2021-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-datetimeformat-prototype-formatrange": "error", 11 | "es-x/no-intl-displaynames": "error", 12 | "es-x/no-intl-listformat": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2021.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | ], 14 | } 15 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-2018.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | { 9 | name: "eslint-internal/config/_override-2018.js", 10 | languageOptions: { 11 | ecmaVersion: 2018, 12 | }, 13 | rules: { 14 | "prefer-object-spread": "error", 15 | }, 16 | }, 17 | ] 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-array-grouping.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-map-groupby": "error", 15 | "es-x/no-object-groupby": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2020-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-locale": "error", 15 | "es-x/no-intl-relativetimeformat": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-string-matchall.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-string-prototype-matchall": "error", 15 | "es-x/no-symbol-matchall": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2023.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/no-class-fields.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-class-instance-fields": "error", 11 | "es-x/no-class-private-fields": "error", 12 | "es-x/no-class-private-methods": "error", 13 | "es-x/no-class-static-fields": "error", 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /tests/lib/rules/no-promise-withresolvers.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-promise-withresolvers.js") 5 | 6 | new RuleTester().run("no-promise-withresolvers", rule, { 7 | valid: ["Promise.all"], 8 | invalid: [ 9 | { 10 | code: "Promise.withResolvers", 11 | errors: ["ES2024 'Promise.withResolvers' is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2016.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-array-prototype-includes": "error", 15 | "es-x/no-exponential-operators": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2022-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-segmenter": "error", 15 | "es-x/no-intl-supportedvaluesof": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-relative-indexing-method.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-array-prototype-at": "error", 15 | "es-x/no-string-prototype-at": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2021-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | ], 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-is-usv-string.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-string-prototype-iswellformed": "error", 15 | "es-x/no-string-prototype-towellformed": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/no-intl-numberformat-v3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-numberformat-prototype-formatrange": "error", 11 | "es-x/no-intl-numberformat-prototype-formatrangetoparts": "error", 12 | "es-x/no-intl-pluralrules-prototype-selectrange": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2023-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-numberformat-prototype-formatrange": "error", 11 | "es-x/no-intl-numberformat-prototype-formatrangetoparts": "error", 12 | "es-x/no-intl-pluralrules-prototype-selectrange": "error", 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-f16round.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-math-f16round.js") 5 | 6 | new RuleTester().run("no-math-f16round", rule, { 7 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.f16round"], 8 | invalid: [ 9 | { 10 | code: "Math.f16round", 11 | errors: ["ES2025 'Math.f16round' method is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-sumprecise.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-math-sumprecise.js") 5 | 6 | new RuleTester().run("no-math-sumprecise", rule, { 7 | valid: ["Math", "Math.abs", "let Math = 0; Math.sumPrecise"], 8 | invalid: [ 9 | { 10 | code: "Math.sumPrecise", 11 | errors: ["ES2026 'Math.sumPrecise' method is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /lib/configs/no-change-array-by-copy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-array-prototype-toreversed": "error", 11 | "es-x/no-array-prototype-tosorted": "error", 12 | "es-x/no-array-prototype-tospliced": "error", 13 | "es-x/no-array-prototype-with": "error", 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /tests/lib/rules/no-symbol-dispose.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-symbol-dispose.js") 5 | 6 | new RuleTester().run("no-symbol-dispose", rule, { 7 | valid: ["Symbol", "Symbol.length", "let Symbol = 0; Symbol.dispose"], 8 | invalid: [ 9 | { 10 | code: "Symbol.dispose", 11 | errors: ["ES2026 'Symbol.dispose' property is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2018-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-numberformat-prototype-formattoparts": "error", 15 | "es-x/no-intl-pluralrules": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2023-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-symbol-matchall.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-symbol-matchall.js") 5 | 6 | new RuleTester().run("no-symbol-matchall", rule, { 7 | valid: ["Symbol", "Symbol.length", "let Symbol = 0; Symbol.matchAll"], 8 | invalid: [ 9 | { 10 | code: "Symbol.matchAll", 11 | errors: ["ES2020 'Symbol.matchAll' property is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /tests/lib/rules/no-iterator-concat.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-iterator-concat.js") 5 | 6 | new RuleTester().run("no-iterator-concat", rule, { 7 | valid: ["Iterator", "Iterator.length", "let Iterator = 0; Iterator.concat"], 8 | invalid: [ 9 | { 10 | code: "Iterator.concat", 11 | errors: ["ES2026 'Iterator.concat' method is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /scripts/get-latest-unicode-script-values.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { 4 | getLatestUnicodePropertyValues, 5 | } = require("./get-latest-unicode-property-values") 6 | 7 | module.exports = { getLatestUnicodeScriptValues } 8 | 9 | async function* getLatestUnicodeScriptValues() { 10 | for await (const value of getLatestUnicodePropertyValues()) { 11 | if (value.propertyAlias !== "sc") { 12 | continue 13 | } 14 | 15 | yield* value.aliases 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-atomics-waitasync.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-atomics-waitasync.js") 5 | 6 | new RuleTester().run("no-atomics-waitasync", rule, { 7 | valid: ["Atomics", "Atomics.wait", "let Atomics = 0; Atomics.watiAsync"], 8 | invalid: [ 9 | { 10 | code: "Atomics.waitAsync", 11 | errors: ["ES2024 'Atomics.waitAsync' method is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2022.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-symbol-asyncdispose.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-symbol-asyncdispose.js") 5 | 6 | new RuleTester().run("no-symbol-asyncdispose", rule, { 7 | valid: ["Symbol", "Symbol.length", "let Symbol = 0; Symbol.asyncDispose"], 8 | invalid: [ 9 | { 10 | code: "Symbol.asyncDispose", 11 | errors: ["ES2026 'Symbol.asyncDispose' property is forbidden."], 12 | }, 13 | ], 14 | }) 15 | -------------------------------------------------------------------------------- /lib/configs/flat/no-float16array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-dataview-prototype-getfloat16-setfloat16": "error", 15 | "es-x/no-float16array": "error", 16 | "es-x/no-math-f16round": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-promise-try.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-promise-try.js") 9 | 10 | new RuleTester().run("no-promise-try", rule, { 11 | valid: ["Promise.all"], 12 | invalid: [ 13 | { 14 | code: "Promise.try", 15 | errors: ["ES2025 'Promise.try' is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /scripts/get-latest-unicode-general-category-values.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { 4 | getLatestUnicodePropertyValues, 5 | } = require("./get-latest-unicode-property-values") 6 | 7 | module.exports = { getLatestUnicodeGeneralCategoryValues } 8 | 9 | async function* getLatestUnicodeGeneralCategoryValues() { 10 | for await (const value of getLatestUnicodePropertyValues()) { 11 | if (value.propertyAlias !== "gc") { 12 | continue 13 | } 14 | 15 | yield* value.aliases 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/configs/flat/no-import-attributes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-dynamic-import-options": "error", 15 | "es-x/no-import-attributes": "error", 16 | "es-x/no-trailing-dynamic-import-commas": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lib/configs/flat/no-json-parse-with-source.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-json-israwjson": "error", 15 | "es-x/no-json-parse-reviver-context-parameter": "error", 16 | "es-x/no-json-rawjson": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/fixtures/types.d.ts: -------------------------------------------------------------------------------- 1 | /* Since typescript doesn't define the types yet, we'll work around the issue by defining the types ourselves. */ 2 | declare namespace Intl { 3 | interface DurationFormat { 4 | format(duration: any): any; 5 | formatToParts(duration: any): any; 6 | resolvedOptions(): any; 7 | } 8 | 9 | const DurationFormat: { 10 | prototype: DurationFormat; 11 | new (...args:any[]): DurationFormat; 12 | supportedLocalesOf(...args:any[]): any; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2019.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2020-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2021-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-datetimeformat-prototype-formatrange": "error", 15 | "es-x/no-intl-displaynames": "error", 16 | "es-x/no-intl-listformat": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lib/util/optional-require.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | /** 4 | * Load a module optionally. 5 | * @param {Function} originalRequire The original `require` function. 6 | * @param {string} id The module specifier. 7 | */ 8 | function optionalRequire(originalRequire, id) { 9 | try { 10 | return originalRequire(id) 11 | } catch (error) { 12 | if (error && error.code === "MODULE_NOT_FOUND") { 13 | return undefined 14 | } 15 | throw error 16 | } 17 | } 18 | 19 | module.exports = { optionalRequire } 20 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2022-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-special.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const files = ["**/scripts/**/*", "eslint.config.js"] 8 | 9 | module.exports = [ 10 | ...require("./+node.js").map((config) => ({ ...config, files })), 11 | { 12 | name: "eslint-internal/config/_override-special.js", 13 | files, 14 | rules: { 15 | "no-console": "off", 16 | "no-process-env": "off", 17 | }, 18 | }, 19 | ] 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-locale.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-locale") 5 | 6 | new RuleTester().run("no-intl-locale", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.Locale", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.Locale", 16 | errors: ["ES2020 Intl API 'Intl.Locale' object is forbidden."], 17 | }, 18 | ], 19 | }) 20 | -------------------------------------------------------------------------------- /lib/configs/no-explicit-resource-management.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-asyncdisposablestack": "error", 11 | "es-x/no-disposablestack": "error", 12 | "es-x/no-suppressederror": "error", 13 | "es-x/no-symbol-asyncdispose": "error", 14 | "es-x/no-symbol-dispose": "error", 15 | "es-x/no-using-declarations": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-dynamic-import-options.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-dynamic-import-options.js") 5 | 6 | new RuleTester({ 7 | languageOptions: { sourceType: "module" }, 8 | }).run("no-dynamic-import-options", rule, { 9 | valid: ["import(source)"], 10 | invalid: [ 11 | { 12 | code: "const module = await import(source, options)", 13 | errors: ["ES2025 the second parameter to 'import()' is forbidden."], 14 | }, 15 | ], 16 | }) 17 | -------------------------------------------------------------------------------- /lib/configs/flat/no-class-fields.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-class-instance-fields": "error", 15 | "es-x/no-class-private-fields": "error", 16 | "es-x/no-class-private-methods": "error", 17 | "es-x/no-class-static-fields": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2021.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-map-groupby.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-map-groupby.js") 5 | 6 | new RuleTester().run("no-map-groupby", rule, { 7 | valid: [ 8 | "Object", 9 | "Map", 10 | "Object.assign", 11 | "let Object = 0; Object.groupBy", 12 | "let Map = 0; Map.groupBy", 13 | ], 14 | invalid: [ 15 | { 16 | code: "Map.groupBy", 17 | errors: ["ES2024 'Map.groupBy' is forbidden."], 18 | }, 19 | ], 20 | }) 21 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2021.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-logical-assignment-operators": "error", 11 | "es-x/no-numeric-separators": "error", 12 | "es-x/no-promise-any": "error", 13 | "es-x/no-regexp-unicode-property-escapes-2021": "error", 14 | "es-x/no-string-prototype-replaceall": "error", 15 | "es-x/no-weakrefs": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-date-now.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-date-now.js") 9 | 10 | new RuleTester().run("no-date-now", rule, { 11 | valid: ["Date", "Date.parse", "let Date = 0; Date.now"], 12 | invalid: [ 13 | { 14 | code: "Date.now", 15 | errors: ["ES5 'Date.now' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-segmenter.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-segmenter.js") 5 | 6 | new RuleTester().run("no-intl-segmenter", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.Segmenter", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.Segmenter", 16 | errors: ["ES2022 Intl API 'Intl.Segmenter' object is forbidden."], 17 | }, 18 | ], 19 | }) 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-create.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-create.js") 9 | 10 | new RuleTester().run("no-object-create", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.create"], 12 | invalid: [ 13 | { 14 | code: "Object.create", 15 | errors: ["ES5 'Object.create' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/flat/no-intl-numberformat-v3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-numberformat-prototype-formatrange": "error", 15 | "es-x/no-intl-numberformat-prototype-formatrangetoparts": "error", 16 | "es-x/no-intl-pluralrules-prototype-selectrange": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2018.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-array-of.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-array-of.js") 9 | 10 | new RuleTester().run("no-array-of", rule, { 11 | valid: ["Array", "Array.from", "let Array = 0; Array.of"], 12 | invalid: [ 13 | { 14 | code: "Array.of", 15 | errors: ["ES2015 'Array.of' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-listformat.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-listformat") 5 | 6 | new RuleTester().run("no-intl-listformat", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.ListFormat", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.ListFormat", 16 | errors: ["ES2021 Intl API 'Intl.ListFormat' object is forbidden."], 17 | }, 18 | ], 19 | }) 20 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2023-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-numberformat-prototype-formatrange": "error", 15 | "es-x/no-intl-numberformat-prototype-formatrangetoparts": "error", 16 | "es-x/no-intl-pluralrules-prototype-selectrange": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-pluralrules.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-pluralrules") 5 | 6 | new RuleTester().run("no-intl-pluralrules", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.PluralRules", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.PluralRules", 16 | errors: ["ES2018 Intl API 'Intl.PluralRules' object is forbidden."], 17 | }, 18 | ], 19 | }) 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-groupby.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-object-groupby.js") 5 | 6 | new RuleTester().run("no-object-groupby", rule, { 7 | valid: [ 8 | "Object", 9 | "Map", 10 | "Object.assign", 11 | "let Object = 0; Object.groupBy", 12 | "let Map = 0; Map.groupBy", 13 | ], 14 | invalid: [ 15 | { 16 | code: "Object.groupBy", 17 | errors: ["ES2024 'Object.groupBy' is forbidden."], 18 | }, 19 | ], 20 | }) 21 | -------------------------------------------------------------------------------- /lib/configs/flat/no-change-array-by-copy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-array-prototype-toreversed": "error", 15 | "es-x/no-array-prototype-tosorted": "error", 16 | "es-x/no-array-prototype-tospliced": "error", 17 | "es-x/no-array-prototype-with": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-is.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-is.js") 9 | 10 | new RuleTester().run("no-object-is", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.is"], 12 | invalid: [ 13 | { 14 | code: "Object.is", 15 | errors: ["ES2015 'Object.is' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2019-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-cbrt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-cbrt.js") 9 | 10 | new RuleTester().run("no-math-cbrt", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.cbrt"], 12 | invalid: [ 13 | { 14 | code: "Math.cbrt", 15 | errors: ["ES2015 'Math.cbrt' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-cosh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-cosh.js") 9 | 10 | new RuleTester().run("no-math-cosh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.cosh"], 12 | invalid: [ 13 | { 14 | code: "Math.cosh", 15 | errors: ["ES2015 'Math.cosh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-imul.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-imul.js") 9 | 10 | new RuleTester().run("no-math-imul", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.imul"], 12 | invalid: [ 13 | { 14 | code: "Math.imul", 15 | errors: ["ES2015 'Math.imul' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-log2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-log2.js") 9 | 10 | new RuleTester().run("no-math-log2", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.log2"], 12 | invalid: [ 13 | { 14 | code: "Math.log2", 15 | errors: ["ES2015 'Math.log2' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-sign.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-sign.js") 9 | 10 | new RuleTester().run("no-math-sign", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.sign"], 12 | invalid: [ 13 | { 14 | code: "Math.sign", 15 | errors: ["ES2015 'Math.sign' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-sinh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-sinh.js") 9 | 10 | new RuleTester().run("no-math-sinh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.sinh"], 12 | invalid: [ 13 | { 14 | code: "Math.sinh", 15 | errors: ["ES2015 'Math.sinh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-tanh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-tanh.js") 9 | 10 | new RuleTester().run("no-math-tanh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.tanh"], 12 | invalid: [ 13 | { 14 | code: "Math.tanh", 15 | errors: ["ES2015 'Math.tanh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-seal.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-seal.js") 9 | 10 | new RuleTester().run("no-object-seal", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.seal"], 12 | invalid: [ 13 | { 14 | code: "Object.seal", 15 | errors: ["ES5 'Object.seal' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-acosh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-acosh.js") 9 | 10 | new RuleTester().run("no-math-acosh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.acosh"], 12 | invalid: [ 13 | { 14 | code: "Math.acosh", 15 | errors: ["ES2015 'Math.acosh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-asinh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-asinh.js") 9 | 10 | new RuleTester().run("no-math-asinh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.asinh"], 12 | invalid: [ 13 | { 14 | code: "Math.asinh", 15 | errors: ["ES2015 'Math.asinh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-atanh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-atanh.js") 9 | 10 | new RuleTester().run("no-math-atanh", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.atanh"], 12 | invalid: [ 13 | { 14 | code: "Math.atanh", 15 | errors: ["ES2015 'Math.atanh' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-clz32.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-clz32.js") 9 | 10 | new RuleTester().run("no-math-clz32", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.clz32"], 12 | invalid: [ 13 | { 14 | code: "Math.clz32", 15 | errors: ["ES2015 'Math.clz32' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-expm1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-expm1.js") 9 | 10 | new RuleTester().run("no-math-expm1", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.expm1"], 12 | invalid: [ 13 | { 14 | code: "Math.expm1", 15 | errors: ["ES2015 'Math.expm1' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-hypot.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-hypot.js") 9 | 10 | new RuleTester().run("no-math-hypot", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.hypot"], 12 | invalid: [ 13 | { 14 | code: "Math.hypot", 15 | errors: ["ES2015 'Math.hypot' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-log10.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-log10.js") 9 | 10 | new RuleTester().run("no-math-log10", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.log10"], 12 | invalid: [ 13 | { 14 | code: "Math.log10", 15 | errors: ["ES2015 'Math.log10' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-log1p.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-log1p.js") 9 | 10 | new RuleTester().run("no-math-log1p", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.log1p"], 12 | invalid: [ 13 | { 14 | code: "Math.log1p", 15 | errors: ["ES2015 'Math.log1p' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-trunc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-trunc.js") 9 | 10 | new RuleTester().run("no-math-trunc", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.trunc"], 12 | invalid: [ 13 | { 14 | code: "Math.trunc", 15 | errors: ["ES2015 'Math.trunc' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-new-target.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-new-target.js") 9 | 10 | new RuleTester().run("no-new-target", rule, { 11 | valid: ["new F()", "target = 1"], 12 | invalid: [ 13 | { 14 | code: "class A { constructor() { new.target } }", 15 | errors: ["ES2015 'new.target' meta property is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-keys.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-keys.js") 9 | 10 | new RuleTester().run("no-object-keys", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.keys"], 12 | invalid: [ 13 | { 14 | code: "Object.keys", 15 | errors: ["ES5 'Object.keys' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-promise-all-settled.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-promise-all-settled.js") 9 | 10 | new RuleTester().run("no-promise-all-settled", rule, { 11 | valid: ["Promise.all"], 12 | invalid: [ 13 | { 14 | code: "Promise.allSettled", 15 | errors: ["ES2020 'Promise.allSettled' function is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /eslint-internal/config/es2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | ...require("./_base.js"), 9 | ...require("./_override-2015.js"), 10 | ...require("./_override-2016.js"), 11 | ...require("./_override-2017.js"), 12 | ...require("./_override-2018.js"), 13 | ...require("./_override-2019.js"), 14 | ...require("./_override-2020.js"), 15 | ...require("./_override-vue.js"), 16 | ...require("./_override-mocha.js"), 17 | ...require("./_override-special.js"), 18 | ] 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-math-fround.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-math-fround.js") 9 | 10 | new RuleTester().run("no-math-fround", rule, { 11 | valid: ["Math", "Math.min", "Math.max", "let Math = 0; Math.fround"], 12 | invalid: [ 13 | { 14 | code: "Math.fround", 15 | errors: ["ES2015 'Math.fround' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-isnan.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-isnan.js") 9 | 10 | new RuleTester().run("no-number-isnan", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.isNaN"], 12 | invalid: [ 13 | { 14 | code: "Number.isNaN", 15 | errors: ["ES2015 'Number.isNaN' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-hasown.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-hasown.js") 9 | 10 | new RuleTester().run("no-object-hasown", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.is"], 12 | invalid: [ 13 | { 14 | code: "Object.hasOwn", 15 | errors: ["ES2022 'Object.hasOwn' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-string-raw.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-string-raw.js") 9 | 10 | new RuleTester().run("no-string-raw", rule, { 11 | valid: ["String", "String.fromCodePoint", "let String = 0; String.raw"], 12 | invalid: [ 13 | { 14 | code: "String.raw", 15 | errors: ["ES2015 'String.raw' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/Layout.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | 16 | 22 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2021-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lib/configs/no-arraybuffer-base64.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-uint8array-frombase64": "error", 11 | "es-x/no-uint8array-fromhex": "error", 12 | "es-x/no-uint8array-prototype-setfrombase64": "error", 13 | "es-x/no-uint8array-prototype-setfromhex": "error", 14 | "es-x/no-uint8array-prototype-tobase64": "error", 15 | "es-x/no-uint8array-prototype-tohex": "error", 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-assign.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-assign.js") 9 | 10 | new RuleTester().run("no-object-assign", rule, { 11 | valid: ["Object", "Object.is", "let Object = 0; Object.assign"], 12 | invalid: [ 13 | { 14 | code: "Object.assign", 15 | errors: ["ES2015 'Object.assign' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-freeze.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-freeze.js") 9 | 10 | new RuleTester().run("no-object-freeze", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.freeze"], 12 | invalid: [ 13 | { 14 | code: "Object.freeze", 15 | errors: ["ES5 'Object.freeze' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-optional-catch-binding.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-optional-catch-binding.js") 9 | 10 | new RuleTester().run("no-optional-catch-binding", rule, { 11 | valid: ["try {} catch (err) {}"], 12 | invalid: [ 13 | { 14 | code: "try {} catch {}", 15 | errors: ["ES2019 optional 'catch' binding is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-values.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-values.js") 9 | 10 | new RuleTester().run("no-object-values", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.values"], 12 | invalid: [ 13 | { 14 | code: "Object.values", 15 | errors: ["ES2017 'Object.values' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-entries.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-entries.js") 9 | 10 | new RuleTester().run("no-object-entries", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.entries"], 12 | invalid: [ 13 | { 14 | code: "Object.entries", 15 | errors: ["ES2017 'Object.entries' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-isfrozen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-isfrozen.js") 9 | 10 | new RuleTester().run("no-object-isfrozen", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.isFrozen"], 12 | invalid: [ 13 | { 14 | code: "Object.isFrozen", 15 | errors: ["ES5 'Object.isFrozen' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-issealed.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-issealed.js") 9 | 10 | new RuleTester().run("no-object-issealed", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.isSealed"], 12 | invalid: [ 13 | { 14 | code: "Object.isSealed", 15 | errors: ["ES5 'Object.isSealed' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/util/merge-visitors.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | function mergeVisitors(...visitors) { 4 | return visitors.reduce((acc, visitor) => { 5 | for (const [key, callback] of Object.entries(visitor)) { 6 | const oldCallback = acc[key] 7 | if (oldCallback) { 8 | acc[key] = (...args) => { 9 | oldCallback(...args) 10 | callback(...args) 11 | } 12 | } else { 13 | acc[key] = callback 14 | } 15 | } 16 | return acc 17 | }, {}) 18 | } 19 | 20 | module.exports = { mergeVisitors } 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-float16array.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-float16array.js") 5 | 6 | new RuleTester().run("no-float16array", rule, { 7 | valid: ["Array", "Object", "let Float16Array = 0; Float16Array"], 8 | invalid: [ 9 | { 10 | code: "Float16Array", 11 | errors: ["ES2025 'Float16Array' class is forbidden."], 12 | }, 13 | { 14 | code: "function f() { Float16Array }", 15 | errors: ["ES2025 'Float16Array' class is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-isfinite.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-isfinite.js") 9 | 10 | new RuleTester().run("no-number-isfinite", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.isFinite"], 12 | invalid: [ 13 | { 14 | code: "Number.isFinite", 15 | errors: ["ES2015 'Number.isFinite' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-parseint.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-parseint.js") 9 | 10 | new RuleTester().run("no-number-parseint", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.parseInt"], 12 | invalid: [ 13 | { 14 | code: "Number.parseInt", 15 | errors: ["ES2015 'Number.parseInt' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-displaynames.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-displaynames") 5 | 6 | new RuleTester().run("no-intl-displaynames", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.DisplayNames", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.DisplayNames", 16 | errors: [ 17 | "ES2021 Intl API 'Intl.DisplayNames' object is forbidden.", 18 | ], 19 | }, 20 | ], 21 | }) 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-isinteger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-isinteger.js") 9 | 10 | new RuleTester().run("no-number-isinteger", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.isInteger"], 12 | invalid: [ 13 | { 14 | code: "Number.isInteger", 15 | errors: ["ES2015 'Number.isInteger' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2017.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | require.resolve("./no-new-in-es2018"), 17 | ], 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-parsefloat.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-parsefloat.js") 9 | 10 | new RuleTester().run("no-number-parsefloat", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.parseFloat"], 12 | invalid: [ 13 | { 14 | code: "Number.parseFloat", 15 | errors: ["ES2015 'Number.parseFloat' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-initializers-in-for-in.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-initializers-in-for-in.js") 5 | 6 | new RuleTester().run("no-initializers-in-for-in", rule, { 7 | valid: [ 8 | "for (var x in obj) {}", 9 | "for (let x in obj) {}", 10 | "for (var {x=42} in obj) {}", 11 | ], 12 | invalid: [ 13 | { 14 | code: "for (var x=42 in obj) {}", 15 | errors: [ 16 | "Annex B feature the initializers in for-in heads are forbidden.", 17 | ], 18 | }, 19 | ], 20 | }) 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-durationformat.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-durationformat") 5 | 6 | new RuleTester().run("no-intl-durationformat", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.DurationFormat", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.DurationFormat", 16 | errors: [ 17 | "ES2025 Intl API 'Intl.DurationFormat' object is forbidden.", 18 | ], 19 | }, 20 | ], 21 | }) 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-labelled-function-declarations.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-labelled-function-declarations.js") 5 | 6 | new RuleTester({ 7 | languageOptions: { sourceType: "script" }, 8 | }).run("no-labelled-function-declarations", rule, { 9 | valid: ["function f() {}", "label: { function f() {} }"], 10 | invalid: [ 11 | { 12 | code: "label: function f() {}", 13 | errors: [ 14 | "Annex B feature the labelled function declarations are forbidden.", 15 | ], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-fromentries.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-fromentries.js") 9 | 10 | new RuleTester().run("no-object-fromentries", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.fromEntries"], 12 | invalid: [ 13 | { 14 | code: "Object.fromEntries", 15 | errors: ["ES2019 'Object.fromEntries' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-isextensible.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-isextensible.js") 9 | 10 | new RuleTester().run("no-object-isextensible", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.isExtensible"], 12 | invalid: [ 13 | { 14 | code: "Object.isExtensible", 15 | errors: ["ES5 'Object.isExtensible' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2019.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-array-prototype-flat": "error", 11 | "es-x/no-json-superset": "error", 12 | "es-x/no-object-fromentries": "error", 13 | "es-x/no-optional-catch-binding": "error", 14 | "es-x/no-regexp-unicode-property-escapes-2019": "error", 15 | "es-x/no-string-prototype-trimstart-trimend": "error", 16 | "es-x/no-symbol-prototype-description": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-disposablestack.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-disposablestack.js") 5 | 6 | new RuleTester().run("no-disposablestack", rule, { 7 | valid: ["Array", "Object", "let DisposableStack = 0; DisposableStack"], 8 | invalid: [ 9 | { 10 | code: "DisposableStack", 11 | errors: ["ES2026 'DisposableStack' class is forbidden."], 12 | }, 13 | { 14 | code: "function f() { DisposableStack }", 15 | errors: ["ES2026 'DisposableStack' class is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-suppressederror.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-suppressederror.js") 5 | 6 | new RuleTester().run("no-suppressederror", rule, { 7 | valid: ["Array", "Object", "let SuppressedError = 0; SuppressedError"], 8 | invalid: [ 9 | { 10 | code: "SuppressedError", 11 | errors: ["ES2026 'SuppressedError' class is forbidden."], 12 | }, 13 | { 14 | code: "function f() { SuppressedError }", 15 | errors: ["ES2026 'SuppressedError' class is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2023.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-array-prototype-findlast-findlastindex": "error", 11 | "es-x/no-array-prototype-toreversed": "error", 12 | "es-x/no-array-prototype-tosorted": "error", 13 | "es-x/no-array-prototype-tospliced": "error", 14 | "es-x/no-array-prototype-with": "error", 15 | "es-x/no-hashbang": "error", 16 | "es-x/no-regexp-unicode-property-escapes-2023": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2018-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | require.resolve("./no-new-in-es2019-intl-api"), 16 | ], 17 | } 18 | -------------------------------------------------------------------------------- /tests/lib/rules/no-import-meta.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-import-meta.js") 9 | 10 | new RuleTester({ 11 | languageOptions: { sourceType: "module" }, 12 | }).run("no-import-meta", rule, { 13 | valid: ["import * as Foo from 'foo'", "import('foo')"], 14 | invalid: [ 15 | { 16 | code: "import.meta", 17 | errors: ["ES2020 'import.meta' meta property is forbidden."], 18 | }, 19 | ], 20 | }) 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-issafeinteger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-issafeinteger.js") 9 | 10 | new RuleTester().run("no-number-issafeinteger", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.isSafeInteger"], 12 | invalid: [ 13 | { 14 | code: "Number.isSafeInteger", 15 | errors: ["ES2015 'Number.isSafeInteger' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-defineproperty.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-defineproperty.js") 9 | 10 | new RuleTester().run("no-object-defineproperty", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.defineProperty"], 12 | invalid: [ 13 | { 14 | code: "Object.defineProperty", 15 | errors: ["ES5 'Object.defineProperty' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-getprototypeof.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-getprototypeof.js") 9 | 10 | new RuleTester().run("no-object-getprototypeof", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.getPrototypeOf"], 12 | invalid: [ 13 | { 14 | code: "Object.getPrototypeOf", 15 | errors: ["ES5 'Object.getPrototypeOf' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-string-fromcodepoint.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-string-fromcodepoint.js") 9 | 10 | new RuleTester().run("no-string-fromcodepoint", rule, { 11 | valid: ["String", "String.raw", "let String = 0; String.fromCodePoint"], 12 | invalid: [ 13 | { 14 | code: "String.fromCodePoint", 15 | errors: ["ES2015 'String.fromCodePoint' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/no-set-methods.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-set-prototype-difference": "error", 11 | "es-x/no-set-prototype-intersection": "error", 12 | "es-x/no-set-prototype-isdisjointfrom": "error", 13 | "es-x/no-set-prototype-issubsetof": "error", 14 | "es-x/no-set-prototype-issupersetof": "error", 15 | "es-x/no-set-prototype-symmetricdifference": "error", 16 | "es-x/no-set-prototype-union": "error", 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-relativetimeformat.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-relativetimeformat") 5 | 6 | new RuleTester().run("no-intl-relativetimeformat", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.RelativeTimeFormat", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.RelativeTimeFormat", 16 | errors: [ 17 | "ES2020 Intl API 'Intl.RelativeTimeFormat' object is forbidden.", 18 | ], 19 | }, 20 | ], 21 | }) 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-supportedvaluesof.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-supportedvaluesof.js") 5 | 6 | new RuleTester().run("no-intl-supportedvaluesof", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.supportedValuesOf", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.supportedValuesOf", 16 | errors: [ 17 | "ES2022 Intl API 'Intl.supportedValuesOf' method is forbidden.", 18 | ], 19 | }, 20 | ], 21 | }) 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-setprototypeof.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-setprototypeof.js") 9 | 10 | new RuleTester().run("no-object-setprototypeof", rule, { 11 | valid: ["Object", "Object.assign", "let Object = 0; Object.setPrototypeOf"], 12 | invalid: [ 13 | { 14 | code: "Object.setPrototypeOf", 15 | errors: ["ES2015 'Object.setPrototypeOf' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/flat/no-explicit-resource-management.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-asyncdisposablestack": "error", 15 | "es-x/no-disposablestack": "error", 16 | "es-x/no-suppressederror": "error", 17 | "es-x/no-symbol-asyncdispose": "error", 18 | "es-x/no-symbol-dispose": "error", 19 | "es-x/no-using-declarations": "error", 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2019.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2020-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2017.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-async-functions": "error", 11 | "es-x/no-atomics": "error", 12 | "es-x/no-object-entries": "error", 13 | "es-x/no-object-getownpropertydescriptors": "error", 14 | "es-x/no-object-values": "error", 15 | "es-x/no-shared-array-buffer": "error", 16 | "es-x/no-string-prototype-padstart-padend": "error", 17 | "es-x/no-trailing-function-commas": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-maxsafeinteger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-maxsafeinteger.js") 9 | 10 | new RuleTester().run("no-number-maxsafeinteger", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.MAX_SAFE_INTEGER"], 12 | invalid: [ 13 | { 14 | code: "Number.MAX_SAFE_INTEGER", 15 | errors: ["ES2015 'Number.MAX_SAFE_INTEGER' property is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-number-minsafeinteger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-number-minsafeinteger.js") 9 | 10 | new RuleTester().run("no-number-minsafeinteger", rule, { 11 | valid: ["Number", "Number.xyz", "let Number = 0; Number.MIN_SAFE_INTEGER"], 12 | invalid: [ 13 | { 14 | code: "Number.MIN_SAFE_INTEGER", 15 | errors: ["ES2015 'Number.MIN_SAFE_INTEGER' property is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-defineproperties.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-defineproperties.js") 9 | 10 | new RuleTester().run("no-object-defineproperties", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.defineProperties"], 12 | invalid: [ 13 | { 14 | code: "Object.defineProperties", 15 | errors: ["ES5 'Object.defineProperties' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-intl-getcanonicallocales.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-intl-getcanonicallocales") 5 | 6 | new RuleTester().run("no-intl-getcanonicallocales", rule, { 7 | valid: [ 8 | "Intl", 9 | "Intl.DateTimeFormat", 10 | "Intl.NumberFormat", 11 | "let Intl = 0; Intl.getCanonicalLocales", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Intl.getCanonicalLocales", 16 | errors: [ 17 | "ES2016 Intl API 'Intl.getCanonicalLocales' method is forbidden.", 18 | ], 19 | }, 20 | ], 21 | }) 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-preventextensions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-preventextensions.js") 9 | 10 | new RuleTester().run("no-object-preventextensions", rule, { 11 | valid: ["Object", "Object.foo", "let Object = 0; Object.preventExtensions"], 12 | invalid: [ 13 | { 14 | code: "Object.preventExtensions", 15 | errors: ["ES5 'Object.preventExtensions' method is forbidden."], 16 | }, 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2021.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-logical-assignment-operators": "error", 15 | "es-x/no-numeric-separators": "error", 16 | "es-x/no-promise-any": "error", 17 | "es-x/no-regexp-unicode-property-escapes-2021": "error", 18 | "es-x/no-string-prototype-replaceall": "error", 19 | "es-x/no-weakrefs": "error", 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2016.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | require.resolve("./no-new-in-es2018"), 17 | require.resolve("./no-new-in-es2017"), 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-map.js") 9 | 10 | new RuleTester().run("no-map", rule, { 11 | valid: ["Array", "Object", "let Map = 0; Map"], 12 | invalid: [ 13 | { 14 | code: "Map", 15 | errors: ["ES2015 'Map' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Map }", 19 | errors: ["ES2015 'Map' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-set.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-set.js") 9 | 10 | new RuleTester().run("no-set", rule, { 11 | valid: ["Array", "Object", "let Set = 0; Set"], 12 | invalid: [ 13 | { 14 | code: "Set", 15 | errors: ["ES2015 'Set' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Set }", 19 | errors: ["ES2015 'Set' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2018.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-async-iteration": "error", 11 | "es-x/no-malformed-template-literals": "error", 12 | "es-x/no-promise-prototype-finally": "error", 13 | "es-x/no-regexp-lookbehind-assertions": "error", 14 | "es-x/no-regexp-named-capture-groups": "error", 15 | "es-x/no-regexp-s-flag": "error", 16 | "es-x/no-regexp-unicode-property-escapes": "error", 17 | "es-x/no-rest-spread-properties": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-proxy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-proxy.js") 9 | 10 | new RuleTester().run("no-proxy", rule, { 11 | valid: ["Array", "Object", "let Proxy = 0; Proxy"], 12 | invalid: [ 13 | { 14 | code: "Proxy", 15 | errors: ["ES2015 'Proxy' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Proxy }", 19 | errors: ["ES2015 'Proxy' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-symbol.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-symbol.js") 9 | 10 | new RuleTester().run("no-symbol", rule, { 11 | valid: ["Array", "Object", "let Symbol = 0; Symbol"], 12 | invalid: [ 13 | { 14 | code: "Symbol", 15 | errors: ["ES2015 'Symbol' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Symbol }", 19 | errors: ["ES2015 'Symbol' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /eslint-internal/my-plugin.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const fs = require("fs") 4 | const path = require("path") 5 | const rulesRoot = path.resolve(__dirname, "./rules") 6 | 7 | const rules = {} 8 | 9 | for (const entry of fs.readdirSync(rulesRoot, { 10 | withFileTypes: true, 11 | recursive: true, 12 | })) { 13 | if (!entry.isFile() || !entry.name.endsWith(".js")) { 14 | continue 15 | } 16 | const fullPath = path.join(entry.parentPath, entry.name) 17 | rules[ 18 | path 19 | .relative(rulesRoot, fullPath) 20 | .replace(/\\/gu, "/") 21 | .replace(/\.js$/u, "") 22 | ] = require(path.join(fullPath)) 23 | } 24 | 25 | module.exports = { rules } 26 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2017-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | require.resolve("./no-new-in-es2019-intl-api"), 16 | require.resolve("./no-new-in-es2018-intl-api"), 17 | ], 18 | } 19 | -------------------------------------------------------------------------------- /tests/lib/rules/no-iterator.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-iterator.js") 5 | 6 | new RuleTester({ 7 | languageOptions: { globals: { Iterator: "readonly" } }, 8 | }).run("no-iterator", rule, { 9 | valid: [ 10 | "Array.from(object)", 11 | "const Iterator = Array; Iterator.from(object)", 12 | ], 13 | invalid: [ 14 | { 15 | code: "Iterator.from(object)", 16 | errors: ["ES2025 'Iterator' class is forbidden."], 17 | }, 18 | { 19 | code: "Iterator", 20 | errors: ["ES2025 'Iterator' class is forbidden."], 21 | }, 22 | ], 23 | }) 24 | -------------------------------------------------------------------------------- /lib/configs/flat/no-arraybuffer-base64.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-uint8array-frombase64": "error", 15 | "es-x/no-uint8array-fromhex": "error", 16 | "es-x/no-uint8array-prototype-setfrombase64": "error", 17 | "es-x/no-uint8array-prototype-setfromhex": "error", 18 | "es-x/no-uint8array-prototype-tobase64": "error", 19 | "es-x/no-uint8array-prototype-tohex": "error", 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /tests/lib/rules/no-atomics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-atomics.js") 9 | 10 | new RuleTester().run("no-atomics", rule, { 11 | valid: ["Array", "Object", "let Atomics = 0; Atomics"], 12 | invalid: [ 13 | { 14 | code: "Atomics", 15 | errors: ["ES2017 'Atomics' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Atomics }", 19 | errors: ["ES2017 'Atomics' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-classes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-classes.js") 9 | 10 | new RuleTester().run("no-classes", rule, { 11 | valid: ["function A() {} A.prototype.foo = function() {}"], 12 | invalid: [ 13 | { 14 | code: "class A {}", 15 | errors: ["ES2015 class declarations are forbidden."], 16 | }, 17 | { 18 | code: "(class {})", 19 | errors: ["ES2015 class declarations are forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-exponential-operators.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-exponential-operators.js") 9 | 10 | new RuleTester().run("no-exponential-operators", rule, { 11 | valid: ["a*b", "a*=b"], 12 | invalid: [ 13 | { 14 | code: "a**b", 15 | errors: ["ES2016 exponential operators are forbidden."], 16 | }, 17 | { 18 | code: "a**=b", 19 | errors: ["ES2016 exponential operators are forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-promise.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-promise.js") 9 | 10 | new RuleTester().run("no-promise", rule, { 11 | valid: ["Array", "Object", "let Promise = 0; Promise"], 12 | invalid: [ 13 | { 14 | code: "Promise", 15 | errors: ["ES2015 'Promise' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Promise }", 19 | errors: ["ES2015 'Promise' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-reflect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-reflect.js") 9 | 10 | new RuleTester().run("no-reflect", rule, { 11 | valid: ["Array", "Object", "let Reflect = 0; Reflect"], 12 | invalid: [ 13 | { 14 | code: "Reflect", 15 | errors: ["ES2015 'Reflect' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { Reflect }", 19 | errors: ["ES2015 'Reflect' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2018.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-weak-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-weak-map.js") 9 | 10 | new RuleTester().run("no-weak-map", rule, { 11 | valid: ["Array", "Object", "let WeakMap = 0; WeakMap"], 12 | invalid: [ 13 | { 14 | code: "WeakMap", 15 | errors: ["ES2015 'WeakMap' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { WeakMap }", 19 | errors: ["ES2015 'WeakMap' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-weak-set.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-weak-set.js") 9 | 10 | new RuleTester().run("no-weak-set", rule, { 11 | valid: ["Array", "Object", "let WeakSet = 0; WeakSet"], 12 | invalid: [ 13 | { 14 | code: "WeakSet", 15 | errors: ["ES2015 'WeakSet' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { WeakSet }", 19 | errors: ["ES2015 'WeakSet' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-map-groupby.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-object-map-groupby.js") 5 | 6 | new RuleTester().run("no-object-map-groupby", rule, { 7 | valid: [ 8 | "Object", 9 | "Map", 10 | "Object.assign", 11 | "let Object = 0; Object.groupBy", 12 | "let Map = 0; Map.groupBy", 13 | ], 14 | invalid: [ 15 | { 16 | code: "Object.groupBy", 17 | errors: ["ES2024 'Object.groupBy' is forbidden."], 18 | }, 19 | { 20 | code: "Map.groupBy", 21 | errors: ["ES2024 'Map.groupBy' is forbidden."], 22 | }, 23 | ], 24 | }) 25 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2019-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | ...require("./no-new-in-es2020-intl-api").rules, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-2017.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = [ 8 | { 9 | name: "eslint-internal/config/_override-2017.js", 10 | languageOptions: { 11 | ecmaVersion: 2017, 12 | }, 13 | rules: { 14 | "prettier/prettier": [ 15 | "error", 16 | { 17 | tabWidth: 4, 18 | semi: false, 19 | trailingComma: "all", 20 | }, 21 | { 22 | usePrettierrc: false, 23 | }, 24 | ], 25 | }, 26 | }, 27 | ] 28 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2015.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | require.resolve("./no-new-in-es2018"), 17 | require.resolve("./no-new-in-es2017"), 18 | require.resolve("./no-new-in-es2016"), 19 | ], 20 | } 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-dynamic-import.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-dynamic-import.js") 9 | 10 | new RuleTester().run("no-dynamic-import", rule, { 11 | valid: [ 12 | { 13 | code: "import a from 'a'", 14 | languageOptions: { sourceType: "module" }, 15 | }, 16 | "obj.\nimport(source)", 17 | ], 18 | invalid: [ 19 | { 20 | code: "import(source)", 21 | errors: ["ES2020 'import()' syntax is forbidden."], 22 | }, 23 | ], 24 | }) 25 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-getownpropertynames.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-getownpropertynames.js") 9 | 10 | new RuleTester().run("no-object-getownpropertynames", rule, { 11 | valid: [ 12 | "Object", 13 | "Object.foo", 14 | "let Object = 0; Object.getOwnPropertyNames", 15 | ], 16 | invalid: [ 17 | { 18 | code: "Object.getOwnPropertyNames", 19 | errors: ["ES5 'Object.getOwnPropertyNames' method is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2024.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-arraybuffer-prototype-transfer": "error", 11 | "es-x/no-atomics-waitasync": "error", 12 | "es-x/no-map-groupby": "error", 13 | "es-x/no-object-groupby": "error", 14 | "es-x/no-promise-withresolvers": "error", 15 | "es-x/no-regexp-v-flag": "error", 16 | "es-x/no-resizable-and-growable-arraybuffers": "error", 17 | "es-x/no-string-prototype-iswellformed": "error", 18 | "es-x/no-string-prototype-towellformed": "error", 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /tests/lib/rules/no-asyncdisposablestack.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-asyncdisposablestack.js") 5 | 6 | new RuleTester().run("no-asyncdisposablestack", rule, { 7 | valid: [ 8 | "Array", 9 | "Object", 10 | "let AsyncDisposableStack = 0; AsyncDisposableStack", 11 | ], 12 | invalid: [ 13 | { 14 | code: "AsyncDisposableStack", 15 | errors: ["ES2026 'AsyncDisposableStack' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { AsyncDisposableStack }", 19 | errors: ["ES2026 'AsyncDisposableStack' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2019.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-array-prototype-flat": "error", 15 | "es-x/no-json-superset": "error", 16 | "es-x/no-object-fromentries": "error", 17 | "es-x/no-optional-catch-binding": "error", 18 | "es-x/no-regexp-unicode-property-escapes-2019": "error", 19 | "es-x/no-string-prototype-trimstart-trimend": "error", 20 | "es-x/no-symbol-prototype-description": "error", 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2023.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-array-prototype-findlast-findlastindex": "error", 15 | "es-x/no-array-prototype-toreversed": "error", 16 | "es-x/no-array-prototype-tosorted": "error", 17 | "es-x/no-array-prototype-tospliced": "error", 18 | "es-x/no-array-prototype-with": "error", 19 | "es-x/no-hashbang": "error", 20 | "es-x/no-regexp-unicode-property-escapes-2023": "error", 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /lib/configs/flat/no-set-methods.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-set-prototype-difference": "error", 15 | "es-x/no-set-prototype-intersection": "error", 16 | "es-x/no-set-prototype-isdisjointfrom": "error", 17 | "es-x/no-set-prototype-issubsetof": "error", 18 | "es-x/no-set-prototype-issupersetof": "error", 19 | "es-x/no-set-prototype-symmetricdifference": "error", 20 | "es-x/no-set-prototype-union": "error", 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /lib/rules/no-escape-unescape.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow `escape` and `unescape`", 9 | category: "legacy", 10 | recommended: false, 11 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-escape-unescape.html", 12 | }, 13 | fixable: null, 14 | messages: { 15 | forbidden: "Annex B feature '{{name}}' is forbidden.", 16 | }, 17 | schema: [], 18 | type: "problem", 19 | }, 20 | create(context) { 21 | return defineGlobalsHandler(context, ["escape", "unescape"]) 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2017.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | ...require("./no-new-in-es2018").rules, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2016-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | require.resolve("./no-new-in-es2019-intl-api"), 16 | require.resolve("./no-new-in-es2018-intl-api"), 17 | require.resolve("./no-new-in-es2017-intl-api"), 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /tests/lib/rules/no-binary-numeric-literals.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-binary-numeric-literals.js") 9 | 10 | new RuleTester().run("no-binary-numeric-literals", rule, { 11 | valid: ["1", "1e10", "01", "0x1", "0o1", "0O1", "'0b01'", "'0B01'"], 12 | invalid: [ 13 | { 14 | code: "0b01", 15 | errors: ["ES2015 binary numeric literals are forbidden."], 16 | }, 17 | { 18 | code: "0B01", 19 | errors: ["ES2015 binary numeric literals are forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-octal-numeric-literals.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-octal-numeric-literals.js") 9 | 10 | new RuleTester().run("no-octal-numeric-literals", rule, { 11 | valid: ["123", "0123", "0x123", "0X123", "0b10", "0B10", "/*0o123*/x"], 12 | invalid: [ 13 | { 14 | code: "0o123", 15 | errors: ["ES2015 octal numeric literals are forbidden."], 16 | }, 17 | { 18 | code: "0O123", 19 | errors: ["ES2015 octal numeric literals are forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2017.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-async-functions": "error", 15 | "es-x/no-atomics": "error", 16 | "es-x/no-object-entries": "error", 17 | "es-x/no-object-getownpropertydescriptors": "error", 18 | "es-x/no-object-values": "error", 19 | "es-x/no-shared-array-buffer": "error", 20 | "es-x/no-string-prototype-padstart-padend": "error", 21 | "es-x/no-trailing-function-commas": "error", 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /tests/lib/rules/no-class-static-block.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-class-static-block.js") 9 | 10 | new RuleTester().run("no-class-static-block", rule, { 11 | valid: ["class A { static f() {} }", "class A { static get f() {} }"], 12 | invalid: [ 13 | { 14 | code: "class A { static {}; }", 15 | errors: ["ES2022 class static block is forbidden."], 16 | }, 17 | { 18 | code: "(class { static {} })", 19 | errors: ["ES2022 class static block is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | require.resolve("./no-new-in-es2018"), 17 | require.resolve("./no-new-in-es2017"), 18 | require.resolve("./no-new-in-es2016"), 19 | require.resolve("./no-new-in-es2015"), 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /lib/rules/no-iterator.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow the `Iterator` class.", 9 | category: "ES2025", 10 | proposal: "iterator-helpers", 11 | recommended: false, 12 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-iterator.html", 13 | }, 14 | fixable: null, 15 | messages: { 16 | forbidden: "ES2025 '{{name}}' class is forbidden.", 17 | }, 18 | schema: [], 19 | type: "problem", 20 | }, 21 | create(context) { 22 | return defineGlobalsHandler(context, ["Iterator"]) 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /tests/lib/rules/no-json.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-json.js") 9 | 10 | new RuleTester().run("no-json", rule, { 11 | valid: ["let JSON = 0; JSON"], 12 | invalid: [ 13 | { 14 | code: "JSON", 15 | errors: ["ES5 'JSON' class is forbidden."], 16 | }, 17 | { 18 | code: "JSON.parse", 19 | errors: ["ES5 'JSON' class is forbidden."], 20 | }, 21 | { 22 | code: "JSON.stringify", 23 | errors: ["ES5 'JSON' class is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2018-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | ...require("./no-new-in-es2020-intl-api").rules, 20 | ...require("./no-new-in-es2019-intl-api").rules, 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-getownpropertysymbols.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-getownpropertysymbols.js") 9 | 10 | new RuleTester().run("no-object-getownpropertysymbols", rule, { 11 | valid: [ 12 | "Object", 13 | "Object.assign", 14 | "let Object = 0; Object.getOwnPropertySymbols", 15 | ], 16 | invalid: [ 17 | { 18 | code: "Object.getOwnPropertySymbols", 19 | errors: [ 20 | "ES2015 'Object.getOwnPropertySymbols' method is forbidden.", 21 | ], 22 | }, 23 | ], 24 | }) 25 | -------------------------------------------------------------------------------- /lib/configs/no-intl-locale-info.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-locale-prototype-firstdayofweek": "error", 11 | "es-x/no-intl-locale-prototype-getcalendars": "error", 12 | "es-x/no-intl-locale-prototype-getcollations": "error", 13 | "es-x/no-intl-locale-prototype-gethourcycles": "error", 14 | "es-x/no-intl-locale-prototype-getnumberingsystems": "error", 15 | "es-x/no-intl-locale-prototype-gettextinfo": "error", 16 | "es-x/no-intl-locale-prototype-gettimezones": "error", 17 | "es-x/no-intl-locale-prototype-getweekinfo": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lib/rules/no-float16array.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow the `Float16Array` class.", 9 | category: "ES2025", 10 | recommended: false, 11 | proposal: "float16array", 12 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-float16array.html", 13 | }, 14 | fixable: null, 15 | messages: { 16 | forbidden: "ES2025 '{{name}}' class is forbidden.", 17 | }, 18 | schema: [], 19 | type: "problem", 20 | }, 21 | create(context) { 22 | return defineGlobalsHandler(context, ["Float16Array"]) 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-esnext-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-intl-locale-prototype-firstdayofweek": "error", 11 | "es-x/no-intl-locale-prototype-getcalendars": "error", 12 | "es-x/no-intl-locale-prototype-getcollations": "error", 13 | "es-x/no-intl-locale-prototype-gethourcycles": "error", 14 | "es-x/no-intl-locale-prototype-getnumberingsystems": "error", 15 | "es-x/no-intl-locale-prototype-gettextinfo": "error", 16 | "es-x/no-intl-locale-prototype-gettimezones": "error", 17 | "es-x/no-intl-locale-prototype-getweekinfo": "error", 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2018.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-async-iteration": "error", 15 | "es-x/no-malformed-template-literals": "error", 16 | "es-x/no-promise-prototype-finally": "error", 17 | "es-x/no-regexp-lookbehind-assertions": "error", 18 | "es-x/no-regexp-named-capture-groups": "error", 19 | "es-x/no-regexp-s-flag": "error", 20 | "es-x/no-regexp-unicode-property-escapes": "error", 21 | "es-x/no-rest-spread-properties": "error", 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-bigint": "error", 11 | "es-x/no-dynamic-import": "error", 12 | "es-x/no-export-ns-from": "error", 13 | "es-x/no-global-this": "error", 14 | "es-x/no-import-meta": "error", 15 | "es-x/no-nullish-coalescing-operators": "error", 16 | "es-x/no-optional-chaining": "error", 17 | "es-x/no-promise-all-settled": "error", 18 | "es-x/no-regexp-unicode-property-escapes-2020": "error", 19 | "es-x/no-string-prototype-matchall": "error", 20 | "es-x/no-symbol-matchall": "error", 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-getownpropertydescriptor.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-getownpropertydescriptor.js") 9 | 10 | new RuleTester().run("no-object-getownpropertydescriptor", rule, { 11 | valid: [ 12 | "Object", 13 | "Object.foo", 14 | "let Object = 0; Object.getOwnPropertyDescriptor", 15 | ], 16 | invalid: [ 17 | { 18 | code: "Object.getOwnPropertyDescriptor", 19 | errors: [ 20 | "ES5 'Object.getOwnPropertyDescriptor' method is forbidden.", 21 | ], 22 | }, 23 | ], 24 | }) 25 | -------------------------------------------------------------------------------- /tests/lib/rules/no-shared-array-buffer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-shared-array-buffer.js") 9 | 10 | new RuleTester().run("no-shared-array-buffer", rule, { 11 | valid: ["Array", "Object", "let SharedArrayBuffer = 0; SharedArrayBuffer"], 12 | invalid: [ 13 | { 14 | code: "SharedArrayBuffer", 15 | errors: ["ES2017 'SharedArrayBuffer' class is forbidden."], 16 | }, 17 | { 18 | code: "function f() { SharedArrayBuffer }", 19 | errors: ["ES2017 'SharedArrayBuffer' class is forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-object-getownpropertydescriptors.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-object-getownpropertydescriptors.js") 9 | 10 | new RuleTester().run("no-object-getownpropertydescriptors", rule, { 11 | valid: [ 12 | "Object", 13 | "Object.assign", 14 | "let Object = 0; Object.getOwnPropertyDescriptors", 15 | ], 16 | invalid: [ 17 | { 18 | code: "Object.getOwnPropertyDescriptors", 19 | errors: [ 20 | "ES2017 'Object.getOwnPropertyDescriptors' method is forbidden.", 21 | ], 22 | }, 23 | ], 24 | }) 25 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2016.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | ...require("./no-new-in-es2018").rules, 22 | ...require("./no-new-in-es2017").rules, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/rules/no-disposablestack.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow the `DisposableStack` class.", 9 | category: "ES2026", 10 | proposal: "explicit-resource-management", 11 | recommended: false, 12 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-disposablestack.html", 13 | }, 14 | fixable: null, 15 | messages: { 16 | forbidden: "ES2026 '{{name}}' class is forbidden.", 17 | }, 18 | schema: [], 19 | type: "problem", 20 | }, 21 | create(context) { 22 | return defineGlobalsHandler(context, ["DisposableStack"]) 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/rules/no-suppressederror.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow the `SuppressedError` class.", 9 | category: "ES2026", 10 | proposal: "explicit-resource-management", 11 | recommended: false, 12 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-suppressederror.html", 13 | }, 14 | fixable: null, 15 | messages: { 16 | forbidden: "ES2026 '{{name}}' class is forbidden.", 17 | }, 18 | schema: [], 19 | type: "problem", 20 | }, 21 | create(context) { 22 | return defineGlobalsHandler(context, ["SuppressedError"]) 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /tests/lib/rules/no-global-this.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-global-this.js") 9 | 10 | new RuleTester().run("no-global-this", rule, { 11 | valid: ["window", "global", "self", "{ let globalThis = 0; globalThis }"], 12 | invalid: [ 13 | { 14 | code: "globalThis", 15 | errors: ["ES2020 'globalThis' variable is forbidden."], 16 | }, 17 | { 18 | code: "window.globalThis", 19 | errors: ["ES2020 'globalThis' variable is forbidden."], 20 | languageOptions: { globals: { window: "readonly" } }, 21 | }, 22 | ], 23 | }) 24 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es2015-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | require.resolve("./no-new-in-es2019-intl-api"), 16 | require.resolve("./no-new-in-es2018-intl-api"), 17 | require.resolve("./no-new-in-es2017-intl-api"), 18 | require.resolve("./no-new-in-es2016-intl-api"), 19 | ], 20 | } 21 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025"), 10 | require.resolve("./no-new-in-es2024"), 11 | require.resolve("./no-new-in-es2023"), 12 | require.resolve("./no-new-in-es2022"), 13 | require.resolve("./no-new-in-es2021"), 14 | require.resolve("./no-new-in-es2020"), 15 | require.resolve("./no-new-in-es2019"), 16 | require.resolve("./no-new-in-es2018"), 17 | require.resolve("./no-new-in-es2017"), 18 | require.resolve("./no-new-in-es2016"), 19 | require.resolve("./no-new-in-es2015"), 20 | require.resolve("./no-new-in-es5"), 21 | ], 22 | } 23 | -------------------------------------------------------------------------------- /tests/lib/rules/no-trailing-dynamic-import-commas.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-trailing-dynamic-import-commas.js") 5 | 6 | new RuleTester({ 7 | languageOptions: { sourceType: "module" }, 8 | }).run("no-trailing-dynamic-import-commas", rule, { 9 | valid: ["import(source)", "import(source, options)"], 10 | invalid: [ 11 | { 12 | code: "import(source,)", 13 | output: "import(source)", 14 | errors: ["ES2025 trailing commas in 'import()' are forbidden."], 15 | }, 16 | { 17 | code: "import(source, options,)", 18 | output: "import(source, options)", 19 | errors: ["ES2025 trailing commas in 'import()' are forbidden."], 20 | }, 21 | ], 22 | }) 23 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | ":preserveSemverRanges", 6 | ":disableDependencyDashboard" 7 | ], 8 | "packageRules": [ 9 | { 10 | "updateTypes": [ 11 | "minor", 12 | "patch", 13 | "pin", 14 | "digest" 15 | ], 16 | "automerge": true 17 | }, 18 | { 19 | "depTypeList": [ 20 | "devDependencies" 21 | ], 22 | "automerge": true 23 | }, 24 | { 25 | "matchManagers": [ 26 | "github-actions", 27 | "devcontainer" 28 | ], 29 | "automerge": true 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /tests/lib/rules/no-promise-any.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-promise-any.js") 9 | 10 | new RuleTester().run("no-promise-any", rule, { 11 | valid: ["Promise.all", "Error", "RangeError"], 12 | invalid: [ 13 | { 14 | code: "Promise.any", 15 | errors: ["ES2021 'Promise.any' is forbidden."], 16 | }, 17 | { 18 | code: "AggregateError", 19 | errors: ["ES2021 'AggregateError' is forbidden."], 20 | }, 21 | { 22 | code: "console.log(e instanceof AggregateError)", 23 | errors: ["ES2021 'AggregateError' is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /lib/rules/no-asyncdisposablestack.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 4 | 5 | module.exports = { 6 | meta: { 7 | docs: { 8 | description: "disallow the `AsyncDisposableStack` class.", 9 | category: "ES2026", 10 | proposal: "explicit-resource-management", 11 | recommended: false, 12 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-asyncdisposablestack.html", 13 | }, 14 | fixable: null, 15 | messages: { 16 | forbidden: "ES2026 '{{name}}' class is forbidden.", 17 | }, 18 | schema: [], 19 | type: "problem", 20 | }, 21 | create(context) { 22 | return defineGlobalsHandler(context, ["AsyncDisposableStack"]) 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2024.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-arraybuffer-prototype-transfer": "error", 15 | "es-x/no-atomics-waitasync": "error", 16 | "es-x/no-map-groupby": "error", 17 | "es-x/no-object-groupby": "error", 18 | "es-x/no-promise-withresolvers": "error", 19 | "es-x/no-regexp-v-flag": "error", 20 | "es-x/no-resizable-and-growable-arraybuffers": "error", 21 | "es-x/no-string-prototype-iswellformed": "error", 22 | "es-x/no-string-prototype-towellformed": "error", 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2017-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | ...require("./no-new-in-es2020-intl-api").rules, 20 | ...require("./no-new-in-es2019-intl-api").rules, 21 | ...require("./no-new-in-es2018-intl-api").rules, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/rules/no-json.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `JSON` class.", 13 | category: "ES5", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-json.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES5 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["JSON"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Map` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-map.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Map"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-set.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Set` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-set.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Set"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-proxy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Proxy` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-proxy.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Proxy"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-symbol.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Symbol` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-symbol.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Symbol"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2015.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | ...require("./no-new-in-es2018").rules, 22 | ...require("./no-new-in-es2017").rules, 23 | ...require("./no-new-in-es2016").rules, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lib/rules/no-atomics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Atomics` class.", 13 | category: "ES2017", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-atomics.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2017 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Atomics"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-promise.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Promise` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-promise.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Promise"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-reflect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `Reflect` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-reflect.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["Reflect"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-weak-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `WeakMap` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-weak-map.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["WeakMap"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-weak-set.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `WeakSet` class.", 13 | category: "ES2015", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-weak-set.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2015 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["WeakSet"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/rules/no-global-this.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `globalThis` variable", 13 | category: "ES2020", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-global-this.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2020 '{{name}}' variable is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["globalThis"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /lib/configs/flat/no-intl-locale-info.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-locale-prototype-firstdayofweek": "error", 15 | "es-x/no-intl-locale-prototype-getcalendars": "error", 16 | "es-x/no-intl-locale-prototype-getcollations": "error", 17 | "es-x/no-intl-locale-prototype-gethourcycles": "error", 18 | "es-x/no-intl-locale-prototype-getnumberingsystems": "error", 19 | "es-x/no-intl-locale-prototype-gettextinfo": "error", 20 | "es-x/no-intl-locale-prototype-gettimezones": "error", 21 | "es-x/no-intl-locale-prototype-getweekinfo": "error", 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/configs/restrict-to-es-intl-api-1st-edition.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | extends: [ 9 | require.resolve("./no-new-in-es2025-intl-api"), 10 | require.resolve("./no-new-in-es2024-intl-api"), 11 | require.resolve("./no-new-in-es2023-intl-api"), 12 | require.resolve("./no-new-in-es2022-intl-api"), 13 | require.resolve("./no-new-in-es2021-intl-api"), 14 | require.resolve("./no-new-in-es2020-intl-api"), 15 | require.resolve("./no-new-in-es2019-intl-api"), 16 | require.resolve("./no-new-in-es2018-intl-api"), 17 | require.resolve("./no-new-in-es2017-intl-api"), 18 | require.resolve("./no-new-in-es2016-intl-api"), 19 | require.resolve("./no-new-in-es2015-intl-api"), 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /lib/rules/no-labelled-function-declarations.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | module.exports = { 4 | meta: { 5 | docs: { 6 | description: "disallow labelled function declarations.", 7 | category: "legacy", 8 | recommended: false, 9 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-labelled-function-declarations.html", 10 | }, 11 | fixable: null, 12 | messages: { 13 | forbidden: 14 | "Annex B feature the labelled function declarations are forbidden.", 15 | }, 16 | schema: [], 17 | type: "problem", 18 | }, 19 | create(context) { 20 | return { 21 | "LabeledStatement > FunctionDeclaration.body"(node) { 22 | context.report({ node: node.parent, messageId: "forbidden" }) 23 | }, 24 | } 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-esnext-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-intl-locale-prototype-firstdayofweek": "error", 15 | "es-x/no-intl-locale-prototype-getcalendars": "error", 16 | "es-x/no-intl-locale-prototype-getcollations": "error", 17 | "es-x/no-intl-locale-prototype-gethourcycles": "error", 18 | "es-x/no-intl-locale-prototype-getnumberingsystems": "error", 19 | "es-x/no-intl-locale-prototype-gettextinfo": "error", 20 | "es-x/no-intl-locale-prototype-gettimezones": "error", 21 | "es-x/no-intl-locale-prototype-getweekinfo": "error", 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/rules/no-class-static-block.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow class static block.", 11 | category: "ES2022", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-class-static-block.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2022 class static block is forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | StaticBlock(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-dynamic-import.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow `import()` syntax", 11 | category: "ES2020", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-dynamic-import.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2020 'import()' syntax is forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ImportExpression(node) { 25 | context.report({ messageId: "forbidden", node }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-for-of-loops.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow `for-of` statements.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-for-of-loops.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 'for-of' statements are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ForOfStatement(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/configs/flat/no-new-in-es2020.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | "es-x/no-bigint": "error", 15 | "es-x/no-dynamic-import": "error", 16 | "es-x/no-export-ns-from": "error", 17 | "es-x/no-global-this": "error", 18 | "es-x/no-import-meta": "error", 19 | "es-x/no-nullish-coalescing-operators": "error", 20 | "es-x/no-optional-chaining": "error", 21 | "es-x/no-promise-all-settled": "error", 22 | "es-x/no-regexp-unicode-property-escapes-2020": "error", 23 | "es-x/no-string-prototype-matchall": "error", 24 | "es-x/no-symbol-matchall": "error", 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2016-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | ...require("./no-new-in-es2020-intl-api").rules, 20 | ...require("./no-new-in-es2019-intl-api").rules, 21 | ...require("./no-new-in-es2018-intl-api").rules, 22 | ...require("./no-new-in-es2017-intl-api").rules, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lib/rules/no-classes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow class declarations.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-classes.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 class declarations are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | "ClassDeclaration, ClassExpression"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-rest-parameters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow rest parameters.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-rest-parameters.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 rest parameters are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":function > RestElement"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /docs/rules/no-escape-unescape.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "es-x/no-escape-unescape" 3 | description: "disallow `escape` and `unescape`" 4 | since: "v5.1.0" 5 | --- 6 | 7 | # es-x/no-escape-unescape 8 | > disallow `escape` and `unescape` 9 | 10 | This rule reports Annex B feature `escape` and `unescape` as errors. 11 | 12 | ## 💡 Examples 13 | 14 | ⛔ Examples of **incorrect** code for this rule: 15 | 16 | 17 | 18 | ```js 19 | /*eslint es-x/no-escape-unescape: error */ 20 | escape('%&') 21 | unescape('%25%26') 22 | ``` 23 | 24 | 25 | 26 | ## 🚀 Version 27 | 28 | This rule was introduced in v5.1.0. 29 | 30 | ## 📚 References 31 | 32 | - [Rule source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/lib/rules/no-escape-unescape.js) 33 | - [Test source](https://github.com/eslint-community/eslint-plugin-es-x/blob/master/tests/lib/rules/no-escape-unescape.js) 34 | -------------------------------------------------------------------------------- /lib/configs/no-iterator-helpers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-iterator-prototype-drop": "error", 11 | "es-x/no-iterator-prototype-every": "error", 12 | "es-x/no-iterator-prototype-filter": "error", 13 | "es-x/no-iterator-prototype-find": "error", 14 | "es-x/no-iterator-prototype-flatmap": "error", 15 | "es-x/no-iterator-prototype-foreach": "error", 16 | "es-x/no-iterator-prototype-map": "error", 17 | "es-x/no-iterator-prototype-reduce": "error", 18 | "es-x/no-iterator-prototype-some": "error", 19 | "es-x/no-iterator-prototype-take": "error", 20 | "es-x/no-iterator-prototype-toarray": "error", 21 | "es-x/no-iterator": "error", 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lib/rules/no-shared-array-buffer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: "disallow the `SharedArrayBuffer` class.", 13 | category: "ES2017", 14 | recommended: false, 15 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-shared-array-buffer.html", 16 | }, 17 | fixable: null, 18 | messages: { 19 | forbidden: "ES2017 '{{name}}' class is forbidden.", 20 | }, 21 | schema: [], 22 | type: "problem", 23 | }, 24 | create(context) { 25 | return defineGlobalsHandler(context, ["SharedArrayBuffer"]) 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/style.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --color-primary-200: #dedeff; 3 | --color-primary-300: #ccccfa; 4 | --color-primary-400: #b7b7ff; 5 | --color-primary-500: #a0a0f5; 6 | --color-primary-600: #8080f2; 7 | --color-primary-700: #6358d4; 8 | --color-primary-800: #4b32c3; 9 | --color-primary-900: #341bab; 10 | --vp-c-brand: var(--color-primary-800); 11 | --vp-c-brand-light: var(--color-primary-600); 12 | --vp-c-brand-lighter: var(--color-primary-500); 13 | --vp-c-brand-dark: var(--color-primary-900); 14 | --vp-c-brand-darker: var(--color-primary-900); 15 | } 16 | 17 | .dark { 18 | --vp-c-brand: var(--color-primary-400); 19 | --vp-c-brand-light: var(--color-primary-300); 20 | --vp-c-brand-lighter: var(--color-primary-200); 21 | --vp-c-brand-dark: var(--color-primary-700); 22 | --vp-c-brand-darker: var(--color-primary-800); 23 | } 24 | 25 | a > img { 26 | display: inline-block; 27 | } 28 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | ...require("./no-new-in-es2018").rules, 22 | ...require("./no-new-in-es2017").rules, 23 | ...require("./no-new-in-es2016").rules, 24 | ...require("./no-new-in-es2015").rules, 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /lib/rules/no-export-ns-from.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow `export * as ns`.", 11 | category: "ES2020", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-export-ns-from.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2020 'export * as ns' are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | "ExportAllDeclaration[exported!=null]"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /tests/lib/rules/no-array-isarray.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-array-isarray.js") 9 | 10 | new RuleTester().run("no-array-isarray", rule, { 11 | valid: [ 12 | "Array", 13 | "Array.from", 14 | "let Array = 0; Array.isArray", 15 | { 16 | code: "if (Array.isArray) { Array.isArray }", 17 | options: [{ allowTestedProperty: true }], 18 | }, 19 | ], 20 | invalid: [ 21 | { 22 | code: "Array.isArray", 23 | errors: ["ES5 'Array.isArray' method is forbidden."], 24 | }, 25 | { 26 | code: "if (Array.isArray) { Array.isArray }", 27 | errors: 2, 28 | }, 29 | ], 30 | }) 31 | -------------------------------------------------------------------------------- /tests/lib/rules/no-uint8array-fromhex.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-uint8array-fromhex.js") 5 | const ruleId = "no-uint8array-fromhex" 6 | 7 | const method = "fromHex" 8 | 9 | new RuleTester().run(ruleId, rule, { 10 | valid: [ 11 | "Uint8Array", 12 | "Uint8Array.raw", 13 | `let Uint8Array = 0; Uint8Array.${method}`, 14 | { 15 | code: `if (Uint8Array.${method}) { Uint8Array.${method} }`, 16 | options: [{ allowTestedProperty: true }], 17 | }, 18 | ], 19 | invalid: [ 20 | { 21 | code: `Uint8Array.${method}`, 22 | errors: [`ES2026 'Uint8Array.${method}' method is forbidden.`], 23 | }, 24 | { 25 | code: `if (Uint8Array.${method}) { Uint8Array.${method} }`, 26 | errors: 2, 27 | }, 28 | ], 29 | }) 30 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.mjs: -------------------------------------------------------------------------------- 1 | if (typeof globalThis.require === "undefined") { 2 | globalThis.require = () => { 3 | const e = new Error("require is not defined") 4 | e.code = "MODULE_NOT_FOUND" 5 | throw e 6 | } 7 | } 8 | import DefaultTheme from "vitepress/theme" 9 | import { defineAsyncComponent } from "vue" 10 | // @ts-expect-error -- ignore 11 | import Layout from "./Layout.vue" 12 | import "./style.css" 13 | 14 | /** @type {import('vitepress').Theme} */ 15 | const theme = { 16 | ...DefaultTheme, 17 | Layout, 18 | enhanceApp(ctx) { 19 | DefaultTheme.enhanceApp(ctx) 20 | ctx.app.component( 21 | "eslint-playground", 22 | defineAsyncComponent({ 23 | // @ts-expect-error -- ignore 24 | loader: () => import("./components/eslint-playground.vue"), 25 | }), 26 | ) 27 | }, 28 | } 29 | export default theme 30 | -------------------------------------------------------------------------------- /lib/rules/no-async-functions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow async function declarations.", 11 | category: "ES2017", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-async-functions.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2017 async function declarations are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":function[async=true]"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-default-parameters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow default parameters.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-default-parameters.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 default parameters are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":function > AssignmentPattern"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-generators.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow generator function declarations.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-generators.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 generator function declarations are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":function[generator=true]"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /tests/lib/rules/no-uint8array-frombase64.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-uint8array-frombase64.js") 5 | const ruleId = "no-uint8array-frombase64" 6 | 7 | const method = "fromBase64" 8 | 9 | new RuleTester().run(ruleId, rule, { 10 | valid: [ 11 | "Uint8Array", 12 | "Uint8Array.raw", 13 | `let Uint8Array = 0; Uint8Array.${method}`, 14 | { 15 | code: `if (Uint8Array.${method}) { Uint8Array.${method} }`, 16 | options: [{ allowTestedProperty: true }], 17 | }, 18 | ], 19 | invalid: [ 20 | { 21 | code: `Uint8Array.${method}`, 22 | errors: [`ES2026 'Uint8Array.${method}' method is forbidden.`], 23 | }, 24 | { 25 | code: `if (Uint8Array.${method}) { Uint8Array.${method} }`, 26 | errors: 2, 27 | }, 28 | ], 29 | }) 30 | -------------------------------------------------------------------------------- /lib/rules/no-optional-catch-binding.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow optional `catch` binding.", 11 | category: "ES2019", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-optional-catch-binding.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2019 optional 'catch' binding is forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | "CatchClause[param=null]"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-initializers-in-for-in.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | module.exports = { 4 | meta: { 5 | docs: { 6 | description: "disallow initializers in for-in heads.", 7 | category: "legacy", 8 | recommended: false, 9 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-initializers-in-for-in.html", 10 | }, 11 | fixable: null, 12 | messages: { 13 | forbidden: 14 | "Annex B feature the initializers in for-in heads are forbidden.", 15 | }, 16 | schema: [], 17 | type: "problem", 18 | }, 19 | create(context) { 20 | return { 21 | "ForInStatement > VariableDeclaration.left > VariableDeclarator.declarations > *.init"( 22 | node, 23 | ) { 24 | context.report({ node, messageId: "forbidden" }) 25 | }, 26 | } 27 | }, 28 | } 29 | -------------------------------------------------------------------------------- /lib/rules/no-import-meta.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow `import.meta` meta property.", 11 | category: "ES2020", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-import-meta.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2020 'import.meta' meta property is forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | "MetaProperty[meta.name='import'][property.name='meta']"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-new-target.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow `new.target` meta property.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-new-target.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 'new.target' meta property is forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | "MetaProperty[meta.name='new'][property.name='target']"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /tests/lib/rules/no-export-ns-from.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const RuleTester = require("../../tester") 8 | const rule = require("../../../lib/rules/no-export-ns-from.js") 9 | 10 | new RuleTester({ 11 | languageOptions: { sourceType: "module" }, 12 | }).run("no-export-ns-from", rule, { 13 | valid: [ 14 | 'export * from "mod"', 15 | "export default foo", 16 | 'export {foo} from "mod"', 17 | 'export {foo as bar} from "mod"', 18 | 'import * as foo from "mod"', 19 | 'import foo from "mod"', 20 | 'import {foo} from "mod"', 21 | 'import {foo as bar} from "mod"', 22 | ], 23 | invalid: [ 24 | { 25 | code: 'export * as ns from "mod"', 26 | errors: ["ES2020 'export * as ns' are forbidden."], 27 | }, 28 | ], 29 | }) 30 | -------------------------------------------------------------------------------- /.github/workflows/cron.yml: -------------------------------------------------------------------------------- 1 | name: cron 2 | on: 3 | workflow_dispatch: null 4 | schedule: 5 | - cron: 0 0 * * 0 6 | 7 | permissions: 8 | contents: write 9 | pull-requests: write 10 | 11 | jobs: 12 | update-unicode-resource: 13 | name: update-unicode-resource 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v6 18 | - name: Install Node.js 19 | uses: actions/setup-node@v6 20 | with: 21 | node-version: 'lts/*' 22 | - name: Install Packages 23 | run: npm install 24 | - name: Update 25 | run: npm run resource-update:unicode-properties 26 | - uses: peter-evans/create-pull-request@v8 27 | with: 28 | commit-message: "fix: updates unicode resource with latest" 29 | branch: update-unicode-resource 30 | branch-suffix: timestamp 31 | title: "fix: updates unicode resource with latest" 32 | -------------------------------------------------------------------------------- /lib/rules/no-computed-properties.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow computed properties.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-computed-properties.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 computed properties are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":matches(Property, MethodDefinition)[computed=true]"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lib/rules/no-weakrefs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Yosuke Ota 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const { defineGlobalsHandler } = require("../util/define-globals-handler") 8 | 9 | module.exports = { 10 | meta: { 11 | docs: { 12 | description: 13 | "disallow the `WeakRef` and `FinalizationRegistry` class.", 14 | category: "ES2021", 15 | recommended: false, 16 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-weakrefs.html", 17 | }, 18 | fixable: null, 19 | messages: { 20 | forbidden: "ES2021 '{{name}}' class is forbidden.", 21 | }, 22 | schema: [], 23 | type: "problem", 24 | }, 25 | create(context) { 26 | return defineGlobalsHandler(context, [ 27 | "WeakRef", 28 | "FinalizationRegistry", 29 | ]) 30 | }, 31 | } 32 | -------------------------------------------------------------------------------- /eslint-internal/config/_override-mocha.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | const files = ["**/test/**", "**/tests/**"] 8 | 9 | module.exports = [ 10 | ...require("./+node.js").map((config) => ({ ...config, files })), 11 | { 12 | name: "eslint-internal/config/_override-mocha.js", 13 | files, 14 | languageOptions: { 15 | globals: { 16 | after: "readonly", 17 | afterEach: "readonly", 18 | before: "readonly", 19 | beforeEach: "readonly", 20 | describe: "readonly", 21 | it: "readonly", 22 | mocha: "readonly", 23 | xdescribe: "readonly", 24 | xit: "readonly", 25 | }, 26 | }, 27 | rules: { 28 | "max-nested-callbacks": "off", 29 | }, 30 | }, 31 | ] 32 | -------------------------------------------------------------------------------- /tests/lib/rules/no-nonstandard-map-properties.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-nonstandard-map-properties.js") 5 | const { mapProperties } = require("../../../lib/util/well-known-properties") 6 | 7 | new RuleTester().run("no-nonstandard-map-properties", rule, { 8 | valid: [ 9 | ...[...mapProperties].map((p) => `Map.${p}`), 10 | { code: "Map.unknown()", options: [{ allow: ["unknown"] }] }, 11 | ], 12 | invalid: [ 13 | { 14 | code: "Map.unknown()", 15 | errors: ["Non-standard 'Map.unknown' property is forbidden."], 16 | }, 17 | { 18 | code: "Map.foo", 19 | errors: ["Non-standard 'Map.foo' property is forbidden."], 20 | }, 21 | { 22 | code: "Map.bar", 23 | errors: ["Non-standard 'Map.bar' property is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /tests/lib/rules/no-nonstandard-set-properties.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-nonstandard-set-properties.js") 5 | const { setProperties } = require("../../../lib/util/well-known-properties") 6 | 7 | new RuleTester().run("no-nonstandard-set-properties", rule, { 8 | valid: [ 9 | ...[...setProperties].map((p) => `Set.${p}`), 10 | { code: "Set.unknown()", options: [{ allow: ["unknown"] }] }, 11 | ], 12 | invalid: [ 13 | { 14 | code: "Set.unknown()", 15 | errors: ["Non-standard 'Set.unknown' property is forbidden."], 16 | }, 17 | { 18 | code: "Set.foo", 19 | errors: ["Non-standard 'Set.foo' property is forbidden."], 20 | }, 21 | { 22 | code: "Set.bar", 23 | errors: ["Non-standard 'Set.bar' property is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es2015-intl-api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025-intl-api").rules, 15 | ...require("./no-new-in-es2024-intl-api").rules, 16 | ...require("./no-new-in-es2023-intl-api").rules, 17 | ...require("./no-new-in-es2022-intl-api").rules, 18 | ...require("./no-new-in-es2021-intl-api").rules, 19 | ...require("./no-new-in-es2020-intl-api").rules, 20 | ...require("./no-new-in-es2019-intl-api").rules, 21 | ...require("./no-new-in-es2018-intl-api").rules, 22 | ...require("./no-new-in-es2017-intl-api").rules, 23 | ...require("./no-new-in-es2016-intl-api").rules, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lib/configs/flat/restrict-to-es3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-flat-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: { 9 | get "es-x"() { 10 | return require("../../index.js") 11 | }, 12 | }, 13 | rules: { 14 | ...require("./no-new-in-es2025").rules, 15 | ...require("./no-new-in-es2024").rules, 16 | ...require("./no-new-in-es2023").rules, 17 | ...require("./no-new-in-es2022").rules, 18 | ...require("./no-new-in-es2021").rules, 19 | ...require("./no-new-in-es2020").rules, 20 | ...require("./no-new-in-es2019").rules, 21 | ...require("./no-new-in-es2018").rules, 22 | ...require("./no-new-in-es2017").rules, 23 | ...require("./no-new-in-es2016").rules, 24 | ...require("./no-new-in-es2015").rules, 25 | ...require("./no-new-in-es5").rules, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /tests/lib/rules/no-nonstandard-date-properties.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-nonstandard-date-properties.js") 5 | const { dateProperties } = require("../../../lib/util/well-known-properties") 6 | 7 | new RuleTester().run("no-nonstandard-date-properties", rule, { 8 | valid: [ 9 | ...[...dateProperties].map((p) => `Date.${p}`), 10 | { code: "Date.unknown()", options: [{ allow: ["unknown"] }] }, 11 | ], 12 | invalid: [ 13 | { 14 | code: "Date.unknown()", 15 | errors: ["Non-standard 'Date.unknown' property is forbidden."], 16 | }, 17 | { 18 | code: "Date.foo", 19 | errors: ["Non-standard 'Date.foo' property is forbidden."], 20 | }, 21 | { 22 | code: "Date.bar", 23 | errors: ["Non-standard 'Date.bar' property is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /tests/lib/rules/no-nonstandard-json-properties.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-nonstandard-json-properties.js") 5 | const { jsonProperties } = require("../../../lib/util/well-known-properties") 6 | 7 | new RuleTester().run("no-nonstandard-json-properties", rule, { 8 | valid: [ 9 | ...[...jsonProperties].map((p) => `JSON.${p}`), 10 | { code: "JSON.unknown()", options: [{ allow: ["unknown"] }] }, 11 | ], 12 | invalid: [ 13 | { 14 | code: "JSON.unknown()", 15 | errors: ["Non-standard 'JSON.unknown' property is forbidden."], 16 | }, 17 | { 18 | code: "JSON.foo", 19 | errors: ["Non-standard 'JSON.foo' property is forbidden."], 20 | }, 21 | { 22 | code: "JSON.bar", 23 | errors: ["Non-standard 'JSON.bar' property is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /tests/lib/rules/no-nonstandard-math-properties.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const RuleTester = require("../../tester") 4 | const rule = require("../../../lib/rules/no-nonstandard-math-properties.js") 5 | const { mathProperties } = require("../../../lib/util/well-known-properties") 6 | 7 | new RuleTester().run("no-nonstandard-math-properties", rule, { 8 | valid: [ 9 | ...[...mathProperties].map((p) => `Math.${p}`), 10 | { code: "Math.unknown()", options: [{ allow: ["unknown"] }] }, 11 | ], 12 | invalid: [ 13 | { 14 | code: "Math.unknown()", 15 | errors: ["Non-standard 'Math.unknown' property is forbidden."], 16 | }, 17 | { 18 | code: "Math.foo", 19 | errors: ["Non-standard 'Math.foo' property is forbidden."], 20 | }, 21 | { 22 | code: "Math.bar", 23 | errors: ["Non-standard 'Math.bar' property is forbidden."], 24 | }, 25 | ], 26 | }) 27 | -------------------------------------------------------------------------------- /lib/configs/no-new-in-es2022.js: -------------------------------------------------------------------------------- 1 | /** 2 | * DON'T EDIT THIS FILE. 3 | * This file was generated by "scripts/update-lib-configs.js" script. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | plugins: ["es-x"], 9 | rules: { 10 | "es-x/no-arbitrary-module-namespace-names": "error", 11 | "es-x/no-array-prototype-at": "error", 12 | "es-x/no-class-instance-fields": "error", 13 | "es-x/no-class-private-fields": "error", 14 | "es-x/no-class-private-methods": "error", 15 | "es-x/no-class-static-block": "error", 16 | "es-x/no-class-static-fields": "error", 17 | "es-x/no-error-cause": "error", 18 | "es-x/no-object-hasown": "error", 19 | "es-x/no-private-in": "error", 20 | "es-x/no-regexp-d-flag": "error", 21 | "es-x/no-regexp-unicode-property-escapes-2022": "error", 22 | "es-x/no-string-prototype-at": "error", 23 | "es-x/no-top-level-await": "error", 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lib/rules/no-block-scoped-functions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Toru Nagashima 3 | * See LICENSE file in root directory for full license. 4 | */ 5 | "use strict" 6 | 7 | module.exports = { 8 | meta: { 9 | docs: { 10 | description: "disallow block-scoped function declarations.", 11 | category: "ES2015", 12 | recommended: false, 13 | url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-block-scoped-functions.html", 14 | }, 15 | fixable: null, 16 | messages: { 17 | forbidden: "ES2015 block-scoped functions are forbidden.", 18 | }, 19 | schema: [], 20 | type: "problem", 21 | }, 22 | create(context) { 23 | return { 24 | ":not(:function) > BlockStatement > FunctionDeclaration"(node) { 25 | context.report({ node, messageId: "forbidden" }) 26 | }, 27 | } 28 | }, 29 | } 30 | --------------------------------------------------------------------------------