Skip to content

Commit

Permalink
fix: ignore MIME type-like object members
Browse files Browse the repository at this point in the history
fixes: #8383
see: typescript-eslint/typescript-eslint#4582

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
  • Loading branch information
achrinza committed Mar 14, 2022
1 parent 9c6c674 commit f282dca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/eslint-config/eslintrc.js
Expand Up @@ -184,14 +184,14 @@ module.exports = {
leadingUnderscore: 'allow',
},

// For members such as `Content-Type`
// For members such as `Content-Type` or `application/json`
{
selector: 'memberLike',
format: null,
filter: {
// you can expand this regex as you find more cases that require
// quoting that you want to allow
regex: '[- ]',
regex: '[-/ ]',
match: true,
},
},
Expand Down

2 comments on commit f282dca

@fidgi
Copy link

@fidgi fidgi commented on f282dca Mar 14, 2022

Choose a reason for hiding this comment

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

Hi @achrinza ,
This solution doesn't seems to work for the following :

 @post('/accounts', {
    responses: {
      '200': {
        description: 'Account model instance',
        content: {'application/json': {schema: {'x-ts-type': Account}}},
      },
    },
  })

May I suggest :

      {
        selector: 'objectLiteralProperty',
        format: null,
        filter: {
          // you can expand this regex as you find more cases that require
          // quoting that you want to allow
          regex: '[0-9-/ ]',
          match: true,
        },
      },

@achrinza
Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @fidgi, thanks for raising the issue. I'll open a PR to include HTTP codes as well, though I believe we should keep selector: 'memberLike' as it is more "open" whilst selector: 'objectLiteralProperty' would not select functions.

Please sign in to comment.