Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add name field to shared configs and flat config types #8863

Merged
merged 2 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of me thinks we should do this as @ but given they're from the non-namespaced package it's probably better to be consistent and name it without the @.

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