Skip to content

[valid-title] Use type information to determine titles #1940

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

I noticed that the valid-title rule doesn't use typed linting to determine whether a title is a string. That means dynamic nodes such as Identifiers will always be detected as non-strings:

for (const {name, input, expected} of cases) {
  it(name, () => expect(process(input)).toEqual(expected));
  // ~~~~ Title must be a string 
    
}
let nameBase = "My name: ";

const makeName = (suffix: string) => `first ${suffix}`;

describe(makeName("second"), () => { /* ... */ }
// ~~~~~ Title must be a string 

ACK that this has been brought up before (see next list). But it's really quite inconvenient to have to eslint-disable for every dynamic test name. Could an option similar to the Vitest ESLint plugin to allow using type checking on test names be marked as accepting PRs, please?

Relevant other issues:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions