Skip to content

Commit

Permalink
Merge branch 'main' into eslint-v9-eslint-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Apr 7, 2024
2 parents 84abbfc + 566b29a commit e6f03b6
Show file tree
Hide file tree
Showing 19 changed files with 354 additions and 319 deletions.
21 changes: 7 additions & 14 deletions packages/eslint-plugin/docs/rules/prefer-optional-chain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkAny: false`
<TabItem value="✅ Correct for `checkAny: false`">

```ts option='{ "checkAny": false }'
declare const thing: any;
Expand All @@ -129,8 +128,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkUnknown: false`
<TabItem value="✅ Correct for `checkUnknown: false`">

```ts option='{ "checkUnknown": false }'
declare const thing: unknown;
Expand All @@ -156,8 +154,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkString: false`
<TabItem value="✅ Correct for `checkString: false`">

```ts option='{ "checkString": false }'
declare const thing: string;
Expand All @@ -183,8 +180,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkNumber: false`
<TabItem value="✅ Correct for `checkNumber: false`">

```ts option='{ "checkNumber": false }'
declare const thing: number;
Expand Down Expand Up @@ -224,8 +220,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkBoolean: false`
<TabItem value="✅ Correct for `checkBoolean: false`">

```ts option='{ "checkBoolean": false }'
declare const thing: true;
Expand All @@ -251,8 +246,7 @@ thing && thing.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `checkBigInt: false`
<TabItem value="✅ Correct for `checkBigInt: false`">

```ts option='{ "checkBigInt": false }'
declare const thing: bigint;
Expand All @@ -277,8 +271,7 @@ thing1 && thing1.toString();
```

</TabItem>
<TabItem value="✅ Correct">
for `requireNullish: true`
<TabItem value="✅ Correct for `requireNullish: true`">

```ts option='{ "requireNullish": true }'
declare const thing1: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,7 @@ function _otherCases() {
}
",
"suppressedMessages": [],
"usedDeprecatedRules": [
{
"replacedBy": [],
"ruleId": "no-extra-semi",
},
{
"replacedBy": [],
"ruleId": "no-mixed-spaces-and-tabs",
},
],
"usedDeprecatedRules": [],
"warningCount": 0,
},
]
Expand Down
1 change: 1 addition & 0 deletions packages/repo-tools/src/generate-configs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ async function main(): Promise<void> {
];
const flatExtends: string[] = [];
const flatConfig: FlatConfig.Config = {
name: `typescript-eslint/${name}`,
rules: config.rules,
};
if (config.extends) {
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-eslint/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/all',
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-eslint/src/configs/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default (
plugin: FlatConfig.Plugin,
parser: FlatConfig.Parser,
): FlatConfig.Config => ({
name: 'typescript-eslint/base',
languageOptions: {
parser,
sourceType: 'module',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default (
_plugin: FlatConfig.Plugin,
_parser: FlatConfig.Parser,
): FlatConfig.Config => ({
name: 'typescript-eslint/disable-type-checked',
rules: {
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/consistent-return': 'off',
Expand Down
5 changes: 4 additions & 1 deletion packages/typescript-eslint/src/configs/eslint-recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
export default (
_plugin: FlatConfig.Plugin,
_parser: FlatConfig.Parser,
): FlatConfig.Config => config('minimatch');
): FlatConfig.Config => ({
...config('minimatch'),
name: 'typescript-eslint/eslint-recommended',
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/recommended-type-checked-only',
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-base-to-string': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/recommended-type-checked',
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-eslint/src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/recommended',
rules: {
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/strict-type-checked-only',
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-array-delete': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/strict-type-checked',
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': [
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-eslint/src/configs/strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/strict',
rules: {
'@typescript-eslint/ban-ts-comment': [
'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/stylistic-type-checked-only',
rules: {
'dot-notation': 'off',
'@typescript-eslint/dot-notation': 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/stylistic-type-checked',
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'error',
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-eslint/src/configs/stylistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default (
baseConfig(plugin, parser),
eslintRecommendedConfig(plugin, parser),
{
name: 'typescript-eslint/stylistic',
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': 'error',
Expand Down
4 changes: 4 additions & 0 deletions packages/utils/src/ts-eslint/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ export namespace FlatConfig {
// it's not a json schema so it's nowhere near as nice to read and convert...
// https://github.com/eslint/eslint/blob/v8.45.0/lib/config/flat-config-schema.js
export interface Config {
/**
* An string to identify the configuration object. Used in error messages and inspection tools.
*/
name?: string;
/**
* An array of glob patterns indicating the files that the configuration object should apply to.
* If not specified, the configuration object applies to all files matched by any other configuration object.
Expand Down
2 changes: 1 addition & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@typescript-eslint/eslint-plugin": "7.5.0",
"@typescript-eslint/rule-schema-to-typescript-types": "7.5.0",
"@typescript-eslint/types": "7.5.0",
"copy-webpack-plugin": "^11.0.0",
"copy-webpack-plugin": "^12.0.0",
"cross-fetch": "*",
"globby": "^11.1.0",
"make-dir": "*",
Expand Down

0 comments on commit e6f03b6

Please sign in to comment.