Skip to content

Commit e9576c3

Browse files
authored
Merge branch 'typescript-eslint:main' into main
2 parents d9604f3 + 0b5b08c commit e9576c3

40 files changed

+874
-207
lines changed

docs/contributing/Local_Development.mdx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,6 @@ You can run `yarn test` in any package to run its tests.
6161

6262
> [VS Code launch tasks](https://code.visualstudio.com/docs/editor/tasks) tasks are provided that allow [visual debugging](https://code.visualstudio.com/docs/editor/debugging) tests.
6363
64-
#### Code Coverage
65-
66-
We aim for 100% code coverage in all PRs when possible, except in the `website/` package.
67-
Coverage reports are generated locally whenever `yarn test` is run.
68-
69-
The `codecov` bot should also comment on your PR with the percentage, as well as links to the line-by-line coverage of each file touched by your PR.
70-
71-
#### Granular Unit Tests
72-
73-
Most tests in most packages are set up as small, self-contained unit tests.
74-
We generally prefer that to keep tests and their failure reports granular.
75-
76-
For rule tests we recommend, when reasonable:
77-
78-
- Including both `valid` and `invalid` code changes in most PRs that affect rule behavior
79-
- Limiting to one error per `invalid` case
80-
8164
### Type Checking
8265

8366
All code should pass TypeScript type checking.

docs/contributing/Pull_Requests.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,26 @@ Please don't:
2525
- Comment on a closed PR
2626
- Reasoning: It is much easier for maintainers to not lose track of things if they are posted as issues. If you think there's a bug in typescript-eslint, the right way to ask is to [file a new issue](https://github.com/typescript-eslint/typescript-eslint/issues/new/choose). The issue templates include helpful & necessary practices such as making sure you're on the latest version of all our packages. You can provide the link to the relevant PR to add more context.
2727

28-
### Raising a PR
28+
### Testing Changes
29+
30+
#### Code Coverage
31+
32+
We aim for 100% code coverage in all PRs when possible, except in the `website/` package.
33+
Coverage reports are generated locally whenever `yarn test` is run.
34+
35+
The `codecov` bot also comments on each PR with its percentage, as well as links to the line-by-line coverage of each file touched by the PR.
36+
37+
#### Granular Unit Tests
38+
39+
Most tests in most packages are set up as small, self-contained unit tests.
40+
We generally prefer that to keep tests and their failure reports granular.
41+
42+
For rule tests we recommend, when reasonable:
43+
44+
- Including both `valid` and `invalid` code changes in most PRs that affect rule behavior
45+
- Limiting to one error per `invalid` case
46+
47+
### Raising the PR
2948

3049
Once your changes are ready, you can raise a PR! 🙌
3150
The title of your PR should match the following format:
@@ -84,6 +103,14 @@ Once you've addressed all our feedback by making code changes and/or started a f
84103

85104
Once the feedback is addressed, and the PR is approved, we'll ensure the branch is up to date with `main`, and merge it for you.
86105

106+
#### Updating Over Time
107+
108+
You generally don't need to keep merging commits from `main` into your PR branch.
109+
If you see merge conflicts or other intersections that worry you, then you can preemptively - but that's optional.
110+
111+
If we think merge conflicts need to be resolved in order to merge and/or review a PR, we might do that for you as a courtesy _if_ we have time.
112+
If not, we may ask you to.
113+
87114
### Asking Questions
88115

89116
If you need help and/or have a question, posting a comment in the PR is a great way to do so.

docs/maintenance/Contributor_Tiers.mdx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ We treat both the creation and review of issues and PRs along the rough scale of
9595
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6976">
9696
#6976
9797
</a>
98-
, <a href="https://github.com/typescript-eslint/typescript-eslint/issues/6992">#6992</a>
98+
,{' '}
99+
<a href="https://github.com/typescript-eslint/typescript-eslint/issues/6992">
100+
#6992
101+
</a>
99102
</td>
100103
</tr>
101104
<tr>
@@ -106,7 +109,10 @@ We treat both the creation and review of issues and PRs along the rough scale of
106109
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6780">
107110
#6780
108111
</a>
109-
, <a href="https://github.com/typescript-eslint/typescript-eslint/pull/6910">#6910</a>
112+
,{' '}
113+
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6910">
114+
#6910
115+
</a>
110116
</td>
111117
</tr>
112118
<tr>
@@ -117,7 +123,10 @@ We treat both the creation and review of issues and PRs along the rough scale of
117123
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6107">
118124
#6107
119125
</a>
120-
, <a href="https://github.com/typescript-eslint/typescript-eslint/pull/6907">#6907</a>
126+
,{' '}
127+
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6907">
128+
#6907
129+
</a>
121130
</td>
122131
</tr>
123132
<tr>
@@ -128,7 +137,10 @@ We treat both the creation and review of issues and PRs along the rough scale of
128137
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6084">
129138
#6084
130139
</a>
131-
, <a href="https://github.com/typescript-eslint/typescript-eslint/pull/6777">#6777</a>
140+
,{' '}
141+
<a href="https://github.com/typescript-eslint/typescript-eslint/pull/6777">
142+
#6777
143+
</a>
132144
</td>
133145
</tr>
134146
</tbody>

docs/maintenance/Releases.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ In parallel to the general PR flow of the major version:
5050

5151
In parallel to the shared config changes work, make sure to test out the beta version on popular community projects willing to try it out.
5252

53-
1. Create a pinned issue offering to try out the new version's beta for consumers [example: [Try out v6 beta on various important community repos](https://github.com/typescript-eslint/typescript-eslint/issues/6760)]
53+
1. Create a pinned issue offering to try out the new version's beta for consumers [example: [Try out v8 beta on various influential community repos](https://github.com/typescript-eslint/typescript-eslint/issues/9141)]
5454
- Ask each community project if they'd be interested in trying out the new version, such as in their Discord or on their issue tracker.
5555
- Each community project that's indicated willingness to receive a PR should have one.
5656
1. Once the proposed _Shared Config Changes_ are merged into the `v${major}` branch, send a draft PR to each project with the new beta version.

docs/packages/Parser.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,31 @@ module.exports = {
402402

403403
</TabItem>
404404
</Tabs>
405+
406+
### `withoutProjectParserOptions(parserOptions)`
407+
408+
Removes options that prompt the parser to parse the project with type information.
409+
In other words, you can use this if you are invoking the parser directly, to ensure that one file will be parsed in isolation, which is much faster.
410+
411+
This is useful in cases where you invoke the parser directly, such as in an ESLint plugin context.
412+
413+
```ts
414+
declare function withoutProjectParserOptions(
415+
options: TSESTreeOptions,
416+
): TSESTreeOptions;
417+
```
418+
419+
Example usage:
420+
421+
```js title="somePlugin.js"
422+
const parser = require('@typescript-eslint/parser');
423+
424+
function parse(path, content, context) {
425+
const contextParserOptions = context.languageOptions?.parserOptions ?? {};
426+
const parserOptions =
427+
parser.withoutProjectParserOptions(contextParserOptions);
428+
429+
// Do something with the cleaned-up options eventually, such as invoking the parser
430+
parser.parseForESLint(content, parserOptions);
431+
}
432+
```

docs/troubleshooting/FAQ.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ These errors are caused by an ESLint config requesting type information be gener
115115
- If you **do** want to lint the file with [type-aware linting](../getting-started/Typed_Linting.mdx):
116116
- Check the `include` option of each of the TSConfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it.
117117
- If the file is a `.cjs`, `.js`, or `.mjs` file, make sure [`allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) is enabled.
118-
- If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo:
119-
- [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/main/tsconfig.eslint.json)
120-
- [`eslint.config.mjs`](https://github.com/typescript-eslint/typescript-eslint/blob/main/eslint.config.mjs)
118+
- If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we previously used in this repo:
119+
- [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/958fecaef10a26792dc00e936e98cb19fd26d05f/tsconfig.eslint.json)
120+
- [`eslint.config.mjs`](https://github.com/typescript-eslint/typescript-eslint/blob/958fecaef10a26792dc00e936e98cb19fd26d05f/.eslintrc.js)
121121

122122
<!-- prettier-ignore-end -->
123123

docs/troubleshooting/Formatting.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ Per [ESLint's 2020 Changes to Rule Policies blog post](https://eslint.org/blog/2
114114
We mirror the ESLint team's move away from _formatting_ and _stylistic_ rules.
115115
With the exception of bug fixes, no new formatting- or stylistic-related pull requests will be accepted into typescript-eslint.
116116

117+
:::note
118+
The [`stylistic` configurations](../users/Shared_Configurations.mdx#stylistic) are not deprecated or recommended-against.
119+
We'll continue to include those configs and their rules to help enforce TypeScript-related stylistic consistency for the foreseeable future.
120+
:::
121+
117122
## `eslint-stylistic`
118123

119124
The downside of using a comprehensive formatter for formatting is that it will strictly apply opinions to code.

docs/users/Shared_Configurations.mdx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,15 @@ module.exports = {
184184
Some rules also enabled in `recommended` default to more strict settings in this configuration.
185185
See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts) for the exact contents of this config.
186186

187-
:::caution
187+
:::tip
188188
We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript.
189189
:::
190190

191+
:::warning
192+
This configuration is not considered "stable" under Semantic Versioning (semver).
193+
Its enabled rules and/or their options may change outside of major version updates.
194+
:::
195+
191196
### `strict-type-checked`
192197

193198
Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information.
@@ -215,10 +220,15 @@ module.exports = {
215220
Some rules also enabled in `recommended-type-checked` default to more strict settings in this configuration.
216221
See [`configs/strict-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked.ts) for the exact contents of this config.
217222

218-
:::caution
223+
:::tip
219224
We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict-type-checked` only if a nontrivial percentage of its developers are highly proficient in TypeScript.
220225
:::
221226

227+
:::warning
228+
This configuration is not considered "stable" under Semantic Versioning (semver).
229+
Its enabled rules and/or their options may change outside of major version updates.
230+
:::
231+
222232
### `stylistic`
223233

224234
Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic.
@@ -293,6 +303,11 @@ We do not recommend TypeScript projects extend from `plugin:@typescript-eslint/a
293303
Many rules conflict with each other and/or are intended to be configured per-project.
294304
:::
295305

306+
:::warning
307+
This configuration is not considered "stable" under Semantic Versioning (semver).
308+
Its enabled rules and/or their options may change outside of major version updates.
309+
:::
310+
296311
### `base`
297312

298313
A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
@@ -366,6 +381,11 @@ module.exports = {
366381
</TabItem>
367382
</Tabs>
368383

384+
:::warning
385+
This configuration is not considered "stable" under Semantic Versioning (semver).
386+
Its enabled rules and/or their options may change outside of major version updates.
387+
:::
388+
369389
### `eslint-recommended`
370390

371391
This ruleset is meant to be used after extending `eslint:recommended`.
@@ -427,6 +447,11 @@ module.exports = {
427447

428448
See [`configs/strict-type-checked-only.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked-only.ts) for the exact contents of this config.
429449

450+
:::warning
451+
This configuration is not considered "stable" under Semantic Versioning (semver).
452+
Its enabled rules and/or their options may change outside of major version updates.
453+
:::
454+
430455
### `stylistic-type-checked-only`
431456

432457
A version of `stylistic` that _only_ contains type-checked rules and disables of any corresponding core ESLint rules.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"ncp": "^2.0.0",
113113
"netlify": "^13.1.14",
114114
"nx": "18.3.5",
115-
"prettier": "3.2.5",
115+
"prettier": "3.3.0",
116116
"pretty-format": "^29.7.0",
117117
"rimraf": "^5.0.5",
118118
"tmp": "^0.2.1",

packages/eslint-plugin/docs/rules/no-base-to-string.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem';
1010
> See **https://typescript-eslint.io/rules/no-base-to-string** for documentation.
1111
1212
JavaScript will call `toString()` on an object when it is converted to a string, such as when `+` adding to a string or in `${}` template literals.
13-
The default Object `.toString()` returns `"[object Object]"`, which is often not what was intended.
13+
The default Object `.toString()` uses the format `"[object Object]"`, which is often not what was intended.
1414
This rule reports on stringified values that aren't primitives and don't define a more useful `.toString()` method.
1515

1616
> Note that `Function` provides its own `.toString()` that returns the function's code.

0 commit comments

Comments
 (0)