Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(rule-tester): fixes on the same line are not fixed properly#8252

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@StyleShit
Copy link
Contributor

@StyleShitStyleShit commentedJan 14, 2024
edited
Loading

Closes#8251

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@StyleShit!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@netlify
Copy link

netlifybot commentedJan 14, 2024
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitf25d901
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/65a41f6d6b33c90009bbc24f
😎 Deploy Previewhttps://deploy-preview-8252--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🟢 up 3 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify site configuration.

},
{
code:'a;\n++b;',
output:'a\n++b;',
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This was a bug in the tests. See other tests above.

`,
output:`
type Test = |string | (((() => void))) | string;
type Test = |string | (((() => void))) | string;
Copy link
ContributorAuthor

@StyleShitStyleShitJan 14, 2024
edited
Loading

Choose a reason for hiding this comment

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

This should be the real fix. Seethis playground.

The test currently fails because it's being fixed to:

typeTest=|string|(((()=>void)))|string;

(notice there are 2 spaces after the=)
The reason is probably because there are 2 fixes that add spaces before and after the relevant characters (= &|), which then results in 2 spaces.

Not sure how to approach this. I have 2 options in mind:

  1. Trimming the spaces after each fix somehow (probably a bad idea)
  2. Re-running the rule tester on the same line after each fix (is that what happens in real life? not sure if/how to do it though)

WDYT?


// Remain it as a problem if it's overlapped or it's a negative range
if(lastPos>=start||start>end){
if(lastPos>start||start>end){
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The actual fix that causes all of this mess 😅

Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/eslint/eslint/blob/1f3744278433006042b8d5f4e9e1e488b2bbb011/lib/linter/source-code-fixer.js#L92

As per the comment at the top of the file - this code is directly forked from eslint core.

If it's broken here then this only changes tests run using our rule tester. Code run through eslint will have the old logic.

So either you've found a bug upstream or tests are running correctly, but correctly, but differently to how you expect.

If it's the former - the fix needs to land upstream before we land it here.

Copy link
Member

@bradzacherbradzacher left a comment
edited
Loading

Choose a reason for hiding this comment

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

Above comment#8252 (comment)

@bradzacher
Copy link
Member

Closing for now as per above.
We can reopen if it lands upstream.

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsJan 22, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@bradzacherbradzacherbradzacher requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: RuleTester doesn't fix properly when there are multiple fixes on the same line

2 participants

@StyleShit@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp