Skip to content

Commit

Permalink
fix(eslint-plugin): [comma-dangle] fixed crash from undefined predica…
Browse files Browse the repository at this point in the history
…te.ignore (#7223)
  • Loading branch information
JoshuaKGoldberg committed Jul 15, 2023
1 parent 7e456dc commit d368164
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/eslint-plugin/src/rules/comma-dangle.ts
Expand Up @@ -98,7 +98,9 @@ export default util.createRule<Options, MessageIds>({
'always-multiline': forceCommaIfMultiline,
'only-multiline': allowCommaIfMultiline,
never: forbidComma,
ignore: undefined,
// https://github.com/typescript-eslint/typescript-eslint/issues/7220
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function
ignore: () => {},
};

function last(nodes: TSESTree.Node[]): TSESTree.Node | null {
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-plugin/tests/rules/comma-dangle.test.ts
Expand Up @@ -76,6 +76,9 @@ ruleTester.run('comma-dangle', rule, {
{ code: 'type Foo = [string\n]', options: [{ tuples: 'only-multiline' }] },
{ code: 'type Foo = [string,\n]', options: [{ tuples: 'only-multiline' }] },

// ignore
{ code: 'const a = <TYPE,>() => {}', options: [{ generics: 'ignore' }] },

// each options
{
code: `
Expand Down

0 comments on commit d368164

Please sign in to comment.