From 3ecb96f2d2203b65ce0f2e2eb48c1ff5e875bdae Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Wed, 25 Jun 2025 03:30:31 +0530 Subject: [PATCH 1/6] docs: remove legacy note about __dirname (#11315) * docs: remove legacy notes about CJS extensions and __dirname * revert: add CJS notes back --- docs/getting-started/Typed_Linting.mdx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/getting-started/Typed_Linting.mdx b/docs/getting-started/Typed_Linting.mdx index 56d02afed96..95f225038dd 100644 --- a/docs/getting-started/Typed_Linting.mdx +++ b/docs/getting-started/Typed_Linting.mdx @@ -40,11 +40,6 @@ export default tseslint.config( ); ``` -:::note -[`import.meta.dirname`](https://nodejs.org/api/esm.html#importmetadirname) is only present for ESM files in Node.js >=20.11.0 / >= 21.2.0.
-For CommonJS modules and/or older versions of Node.js, [use `__dirname` or an alternative](https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules). -::: - In more detail: - `tseslint.configs.recommendedTypeChecked` is a [shared configuration](../users/Shared_Configurations.mdx). It contains recommended rules that additionally require type information. From 9dc91aaff7c55082a7a768788664d625f8283500 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Wed, 25 Jun 2025 03:39:18 +0530 Subject: [PATCH 2/6] chore(rule-tester): correct typo in test (#11338) test: correct null output test in RuleTester Co-authored-by: Kirk Waiblinger <53019676+kirkwaiblinger@users.noreply.github.com> --- packages/rule-tester/tests/RuleTester.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/rule-tester/tests/RuleTester.test.ts b/packages/rule-tester/tests/RuleTester.test.ts index 594dd3c7e5a..a2d4b83c44e 100644 --- a/packages/rule-tester/tests/RuleTester.test.ts +++ b/packages/rule-tester/tests/RuleTester.test.ts @@ -1327,6 +1327,7 @@ describe('RuleTester - multipass fixer', () => { { code: 'foo', errors: [{ messageId: 'error' }], + output: null, }, ], valid: [], From 3e545207f0e34611f528128fc699b25091bc40b3 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Wed, 25 Jun 2025 17:29:43 +0530 Subject: [PATCH 3/6] fix: remove prettier from eslint-plugin (#11339) --- packages/eslint-plugin/package.json | 1 - yarn.lock | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 7ac8d163062..8e118c44c18 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -84,7 +84,6 @@ "mdast-util-from-markdown": "^2.0.0", "mdast-util-mdx": "^3.0.0", "micromark-extension-mdxjs": "^3.0.0", - "prettier": "^3.5.3", "rimraf": "*", "title-case": "^4.0.0", "tsx": "*", diff --git a/yarn.lock b/yarn.lock index 084dcf16153..9db662cb2b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5813,7 +5813,6 @@ __metadata: mdast-util-mdx: ^3.0.0 micromark-extension-mdxjs: ^3.0.0 natural-compare: ^1.4.0 - prettier: ^3.5.3 rimraf: "*" title-case: ^4.0.0 ts-api-utils: ^2.1.0 From 20f8564b82b225c8d685f5f06284516f1f22b32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Thu, 26 Jun 2025 09:00:50 -0400 Subject: [PATCH 4/6] chore: replace custom CONTRIBUTORS.md with GitHub's graphs/contributors (#11341) --- .cspell.json | 1 - .prettierignore | 1 - CONTRIBUTORS.md | 99 ------------- README.md | 2 +- package.json | 2 - tools/scripts/generate-contributors.mts | 186 ------------------------ 6 files changed, 1 insertion(+), 290 deletions(-) delete mode 100644 CONTRIBUTORS.md delete mode 100644 tools/scripts/generate-contributors.mts diff --git a/.cspell.json b/.cspell.json index e064c26d4d5..265533fa045 100644 --- a/.cspell.json +++ b/.cspell.json @@ -15,7 +15,6 @@ ".vscode/*.json", "**/*.{json,snap}", "**/**/CHANGELOG.md", - "**/**/CONTRIBUTORS.md", "**/**/TSLINT_RULE_ALTERNATIVES.md", "**/coverage/**", "**/dist/**", diff --git a/.prettierignore b/.prettierignore index 500bc3eaf91..942cf2d47b6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,7 +3,6 @@ **/.vscode **/.nyc_output **/.vs -CONTRIBUTORS.md .yarn/plugins .yarn/releases diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md deleted file mode 100644 index 7c60ad27e4c..00000000000 --- a/CONTRIBUTORS.md +++ /dev/null @@ -1,99 +0,0 @@ - - -# Contributors - -Thanks goes to these wonderful people: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Josh Goldberg ✨

Brad Zacher

James Henry

Armano

YeonJuan

Kirk Waiblinger

auvred

Abraham Guo

Joshua Chen

Oleksandr T.

Michaël De Boey

SUZUKI Sosuke

Reyad Attiyat

Gareth Jones

Patricio Trevino

Yukihiro Hasegawa

Nicholas C. Zakas

Kim Sang Du

Jed Fox

Arya Emami

Rafael Santana

fisker Cheung

Mark de Dios

Yosuke Ota

Bryan Mishkin

Emma

Simen Bekkhus

Flo Edelmann

JounQin

Jake Bailey

Danny Fritz

Tiger Oakes

Lauren Yim

Zzzen

Kanitkorn Sujautra

mdm317

kmin-jeong

Susisu

ldrick

Cparros

Arka Pratim Chaudhuri

Sukka

Niles Salter

Yuri Pieters

Tim Kraut

Yuya Yoshioka

zz

Anthony Fu

fregante

Ray

Daniel Cassidy

Dimitri Mitropoulos

Edwin Kofler

Hao Cheng

Ricardo Fernández Serrata
- - - - -This list is auto-generated using `yarn generate-contributors`. It shows the top 100 contributors with > 3 contributions. diff --git a/README.md b/README.md index 1656a4bc2c6..56ec6bf32ea 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This project exists thanks to the awesome people who contribute code and documen Gallery of all contributors' profile photos -🙏 An extra special thanks goes out to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md) +🙏 An extra special thanks goes out to the wonderful people listed in . ## Financial Contributors diff --git a/package.json b/package.json index e82a1780f35..d1e3b4219aa 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/.prettierrc.json --write $INIT_CWD", "generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes", "generate-configs": "tsx tools/scripts/generate-configs.mts", - "generate-contributors": "tsx tools/scripts/generate-contributors.mts", "generate-lib": "tsx tools/scripts/generate-lib.mts", "generate-sponsors": "tsx tools/scripts/generate-sponsors.mts", "generate-website-dts": "nx run website:generate-website-dts", @@ -123,7 +122,6 @@ "name": "repo", "includedScripts": [ "generate-configs", - "generate-contributors", "generate-lib", "generate-sponsors" ], diff --git a/tools/scripts/generate-contributors.mts b/tools/scripts/generate-contributors.mts deleted file mode 100644 index c3c08d7a943..00000000000 --- a/tools/scripts/generate-contributors.mts +++ /dev/null @@ -1,186 +0,0 @@ -// this script uses the github api to fetch a list of contributors -// https://developer.github.com/v3/repos/#list-contributors -// this endpoint returns a list of contributors sorted by number of contributions - -import fetch from 'cross-fetch'; -import fs from 'node:fs'; -import path from 'node:path'; - -import { REPO_ROOT } from './paths.mts'; - -const IGNORED_USERS = new Set([ - 'dependabot[bot]', - 'eslint[bot]', - 'greenkeeper[bot]', - 'semantic-release-bot', -]); - -const COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT = 3; -const PAGE_LIMIT = 100; -// arbitrary limit -- this means we can only fetch 10*100=1000 contributors but it means we don't ever loop forever -const MATCH_PAGE_NUMBER = 10; -const contributorsApiUrl = `https://api.github.com/repos/typescript-eslint/typescript-eslint/contributors?per_page=${PAGE_LIMIT}`; - -interface Contributor { - avatar_url?: string; - contributions: number; - html_url?: string; - login?: string; - type: string; - url?: string; -} -interface User { - avatar_url: string; - html_url: string; - login: string; - name: string; -} - -// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- intentional 'unsafe' single generic in return type -async function getData( - url: string, -): Promise<{ body: T; linkHeader: string | null }>; -// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- intentional 'unsafe' single generic in return type -async function getData( - url: string | undefined, -): Promise<{ body: T; linkHeader: string | null } | null>; -async function getData( - url: string | undefined, -): Promise<{ body: T; linkHeader: string | null } | null> { - if (url == null) { - return null; - } - - const response = await fetch(url, { - headers: { - Accept: 'application/vnd.github.v3+json', - // Authorization: 'token ghp_xxxx', // if needed, replace this with your token - }, - method: 'GET', - }); - - const linkHeader = response.headers.get('link'); - - return { - body: (await response.json()) as T, - linkHeader, - }; -} - -async function* fetchUsers(page = 1): AsyncIterableIterator { - while (page <= MATCH_PAGE_NUMBER) { - console.log(`Fetching page ${page} of contributors...`); - const contributors = await getData( - `${contributorsApiUrl}&page=${page}`, - ); - - if (!Array.isArray(contributors.body)) { - throw new Error(contributors.body.message); - } - - const thresholdedContributors = contributors.body.filter( - user => user.contributions >= COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT, - ); - yield thresholdedContributors; - - if ( - // https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api?apiVersion=2022-11-28#using-link-headers - // > The URL for the next page is followed by rel="next". - // > the link to the last page won't be included if it can't be calculated. - // i.e. if there's no "next" link then there's no next page and we're at the end - !contributors.linkHeader?.includes('rel="next"') - ) { - break; - } - - page += 1; - } -} - -function writeTable(contributors: User[], perLine = 5): void { - const columns = contributors.length > perLine ? perLine : contributors.length; - - const lines = [ - '', - '', - '# Contributors', - '', - 'Thanks goes to these wonderful people:', - '', - '', - '', - '', - ]; - - let i = 0; - for (const usr of contributors) { - if (i % columns === 0) { - if (i !== 0) { - lines.push(' '); - } - lines.push(' '); - } - - const image = ``; - const name = `${usr.name || usr.login}`; - - lines.push( - ` `, - ); - ++i; - } - if (i % columns !== 0) { - lines.push(' '); - } - - lines.push(' '); - lines.push('
${image}
${name}
'); - lines.push(''); - lines.push(''); - lines.push(''); - lines.push(''); - lines.push( - `This list is auto-generated using \`yarn generate-contributors\`. It shows the top ${PAGE_LIMIT} contributors with > ${COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT} contributions.`, - ); - lines.push(''); - - fs.writeFileSync(path.join(REPO_ROOT, 'CONTRIBUTORS.md'), lines.join('\n')); -} - -const githubContributors: Contributor[] = []; - -// fetch all of the contributor info -for await (const lastUsers of fetchUsers()) { - githubContributors.push(...lastUsers); -} - -// fetch the user info -console.log(`Fetching user information...`); -const users = await Promise.allSettled( - githubContributors - // remove ignored users and bots - .filter( - usr => usr.login && usr.type !== 'Bot' && !IGNORED_USERS.has(usr.login), - ) - // fetch the in-depth information for each user - .map(c => getData(c.url)), -); - -writeTable( - users - .map(result => { - if (result.status === 'fulfilled') { - return result.value?.body; - } - return null; - }) - .filter((c): c is User => c?.login != null), - 5, -); From db32b8a82d58eddb29be207a5f4476644973abbf Mon Sep 17 00:00:00 2001 From: Mark de Dios <99303358+peanutenthusiast@users.noreply.github.com> Date: Thu, 26 Jun 2025 06:32:41 -0700 Subject: [PATCH 5/6] docs: update only-throw-error documentation allowRethrowing (#11346) --- packages/eslint-plugin/docs/rules/only-throw-error.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/only-throw-error.mdx b/packages/eslint-plugin/docs/rules/only-throw-error.mdx index e30f67a0869..fe7fbdb20e5 100644 --- a/packages/eslint-plugin/docs/rules/only-throw-error.mdx +++ b/packages/eslint-plugin/docs/rules/only-throw-error.mdx @@ -141,7 +141,7 @@ interface Options { const defaultOptions: Options = { allow: [], - allowRethrowing: false, + allowRethrowing: true, allowThrowingAny: true, allowThrowingUnknown: true, }; From 02ee81b32f50422c44563f0f8b37f6d55b0e863c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Sat, 28 Jun 2025 23:24:31 -0400 Subject: [PATCH 6/6] docs: mention ESLint's defineConfig() (#11335) --- docs/getting-started/Quickstart.mdx | 23 +++++++++++++++++------ docs/packages/TypeScript_ESLint.mdx | 13 +++++++++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/getting-started/Quickstart.mdx b/docs/getting-started/Quickstart.mdx index 79e65c2b991..232fe15966d 100644 --- a/docs/getting-started/Quickstart.mdx +++ b/docs/getting-started/Quickstart.mdx @@ -45,18 +45,29 @@ export default tseslint.config( This code will enable our [recommended configuration](../users/Shared_Configurations.mdx) for linting. +#### Details + +- `tseslint.config(...)` is an **_optional_** helper function — see [`typescript-eslint`'s `config(...)`](../packages/TypeScript_ESLint.mdx#config). +- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js). +- `tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended). +
-Aside on file extensions +Aside on ESLint's `defineConfig()` -The `.mjs` extension makes the file use the [ES modules (ESM)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) format. Node interprets `.js` files in the [CommonJS (CJS)](https://nodejs.org/api/modules.html) format by default, but if you have `"type": "module"` in your `package.json`, you can also use `eslint.config.js`. +ESLint also provides a `defineConfig()` helper similar to `tseslint.config()`. +However, there is a types incompatibility issue that causes type errors to incorrectly be reported when mixing typescript-eslint's configs and `defineConfig()`. +For now we recommend using `tseslint.config()` for use with typescript-eslint's configs. + +See [typescript-eslint#10899](https://github.com/typescript-eslint/typescript-eslint/issues/10899) for more details.
-#### Details +
+Aside on file extensions -- `tseslint.config(...)` is an **_optional_** helper function — see [`typescript-eslint`'s `config(...)`](../packages/TypeScript_ESLint.mdx#config). -- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js). -- `tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended). +The `.mjs` extension makes the file use the [ES modules (ESM)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) format. Node interprets `.js` files in the [CommonJS (CJS)](https://nodejs.org/api/modules.html) format by default, but if you have `"type": "module"` in your `package.json`, you can also use `eslint.config.js`. + +
### Step 3: Running ESLint diff --git a/docs/packages/TypeScript_ESLint.mdx b/docs/packages/TypeScript_ESLint.mdx index f4e7106bf9a..9fc886d872b 100644 --- a/docs/packages/TypeScript_ESLint.mdx +++ b/docs/packages/TypeScript_ESLint.mdx @@ -31,7 +31,7 @@ npm i typescript-eslint ## Usage -We recommend getting started by using `tseslint.config` helper function in your ESLint config: +We recommend getting started by using the `tseslint.config()` helper function in your ESLint config: ```js title="eslint.config.mjs" // @ts-check @@ -47,6 +47,15 @@ export default tseslint.config( This config file exports a flat config that enables both the [core ESLint recommended config](https://www.npmjs.com/package/@eslint/js) and [our recommended config](../users/Shared_Configurations.mdx#recommended). +:::note +ESLint also provides a `defineConfig()` helper similar to `tseslint.config()`. +However, there is a types incompatibility issue that causes type errors to incorrectly be reported when mixing typescript-eslint's configs and `defineConfig()`. +For now we recommend using `tseslint.config()` for use with typescript-eslint configs. + +See [typescript-eslint#10899](https://github.com/typescript-eslint/typescript-eslint/issues/10899) for more details. + +::: + ### `config(...)` `tseslint.config(...)` takes in any number of ESLint config objects, each of which may additionally include an `extends` array of configs to extend. @@ -105,7 +114,7 @@ Otherwise it _will not_ impact your ability to use our tooling. #### Flat config `extends` -The `tseslint.config` utility function also adds handling for the `extends` property on flat config objects. +The `tseslint.config()` utility function also adds handling for the `extends` property on flat config objects. This allows you to more easily extend shared configs for specific file patterns whilst also overriding rules/options provided by those configs: ```js pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy