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

Incorrect diff being generated with eslint v9 #111

Closed
Stono opened this issue Jan 15, 2025 · 2 comments
Closed

Incorrect diff being generated with eslint v9 #111

Stono opened this issue Jan 15, 2025 · 2 comments

Comments

@Stono
Copy link

Stono commented Jan 15, 2025

I won't repeat all the context; it can be found here prettier/eslint-plugin-prettier#697 (comment) - I've been advised to raise this here instead.

@fisker
Copy link
Member

fisker commented Mar 6, 2025

The arguments passed to generateDifferences is

"// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { CancelablePromise } from './core/CancelablePromise';\nimport type { BaseHttpRequest } from './core/BaseHttpRequest';\nimport type { HelloControllerHelloResponse } from './types.gen';\n\nexport class HelloService {\n    constructor(public readonly httpRequest: BaseHttpRequest) { }\n    \n    /**\n     * Say hello\n     * @returns string\n     * @throws ApiError\n     */\n    public hello(): CancelablePromise<HelloControllerHelloResponse> {\n        return this.httpRequest.request({\n            method: 'GET',\n            url: '/api/hello'\n        });\n    }\n    \n}"

and

"// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { CancelablePromise } from './core/CancelablePromise'\nimport type { BaseHttpRequest } from './core/BaseHttpRequest'\nimport type { HelloControllerHelloResponse } from './types.gen'\n\nexport class HelloService {\n  constructor(public readonly httpRequest: BaseHttpRequest) {}\n\n  /**\n   * Say hello\n   * @returns string\n   * @throws ApiError\n   */\n  public hello(): CancelablePromise<HelloControllerHelloResponse> {\n    return this.httpRequest.request({\n      method: 'GET',\n      url: '/api/hello'\n    })\n  }\n}\n"

Difference

[
  { offset: 120, operation: 'delete', deleteText: ';' },
  { offset: 183, operation: 'delete', deleteText: ';' },
  { offset: 248, operation: 'delete', deleteText: ';' },
  {
    offset: 279,
    operation: 'replace',
    insertText: '  constructor(public readonly httpRequest: BaseHttpRequest) {',
    deleteText: '    constructor(public readonly httpRequest: BaseHttpRequest) { '
  },
  { offset: 345, operation: 'delete', deleteText: '    ' },
  { offset: 352, operation: 'delete', deleteText: '  ' },
  {
    offset: 358,
    operation: 'replace',
    insertText: '   ',
    deleteText: '     '
  },
  { offset: 375, operation: 'delete', deleteText: '  ' },
  {
    offset: 398,
    operation: 'replace',
    insertText: '   ',
    deleteText: '     '
  },
  { offset: 422, operation: 'delete', deleteText: '  ' },
  { offset: 432, operation: 'delete', deleteText: '  ' },
  { offset: 500, operation: 'delete', deleteText: '    ' },
  { offset: 548, operation: 'delete', deleteText: '      ' },
  {
    offset: 569,
    operation: 'replace',
    insertText: '      ',
    deleteText: '            '
  },
  {
    offset: 599,
    operation: 'replace',
    insertText: '    })',
    deleteText: '        });'
  },
  { offset: 611, operation: 'delete', deleteText: '  ' },
  {
    offset: 617,
    operation: 'replace',
    insertText: '}',
    deleteText: '    '
  },
  { offset: 622, operation: 'delete', deleteText: '}' }
]

@fisker
Copy link
Member

fisker commented Mar 6, 2025

Since the diff is actully correct.

Let's close this, and wait to see what should we do in ESLint or eslint-plugin-prettier first.

@fisker fisker closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants