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

bug(linter) incorrect fixer in no_null #5194

Closed
camc314 opened this issue Aug 25, 2024 · 11 comments · Fixed by #5247
Closed

bug(linter) incorrect fixer in no_null #5194

camc314 opened this issue Aug 25, 2024 · 11 comments · Fixed by #5247
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers

Comments

@camc314
Copy link
Collaborator

camc314 commented Aug 25, 2024

see https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/10518058484/job/29218160739?pr=25

return null!

is being fixed to

return !;

which is invalid TS

@camc314 camc314 added the C-bug Category - Bug label Aug 25, 2024
@camc314
Copy link
Collaborator Author

camc314 commented Aug 26, 2024

another one:

  x Expected a semicolon or an implicit semicolon after a statement, but found none
    ,-[packages/backend/server/src/core/quota/service.ts:73:19]
 72 |         } catch {}
 73 |         return  as unknown as typeof quota & {
    :                   ^
 74 |           feature: QuotaConfig;
    `----
  help: Try insert a semicolon here
  

@DonIsaac
Copy link
Collaborator

I don't have capacity for this, @camc314 can you handle it?

@DonIsaac DonIsaac added good first issue Experience Level - Good for newcomers A-linter Area - Linter labels Aug 27, 2024
@Dunqing Dunqing assigned Dunqing and unassigned DonIsaac Aug 27, 2024
DonIsaac pushed a commit that referenced this issue Aug 27, 2024
…Statement` (#5247)

close: #5194

It’s a long time no contributed to Linter, I'd like to try it
@Dunqing Dunqing closed this as completed Aug 27, 2024
@DonIsaac
Copy link
Collaborator

Re-opening this because @Dunqing's PR only handled the first mentioned problem, not the second.

@DonIsaac DonIsaac reopened this Aug 27, 2024
@camc314 camc314 assigned camc314 and unassigned Dunqing Aug 27, 2024
@camc314
Copy link
Collaborator Author

camc314 commented Aug 27, 2024

I'll look at this - i think i will make the fixer a lot more concervative as to whether it fixes or doesn't.

@Dunqing
Copy link
Member

Dunqing commented Aug 27, 2024

Re-opening this because @Dunqing's PR only handled the first mentioned problem, not the second.

("() => { return null as any as typeof Array }", "() => { return }", None),

It's also resolved

@camc314
Copy link
Collaborator Author

camc314 commented Aug 27, 2024

still broken 😞
although maybe this is a different issue.

const newDecorations = enabled ?
	this._debugService.getModel().getBreakpoints().map(breakpoint => {
		const parsed = CellUri.parse(breakpoint.uri);
		if (!parsed || parsed.notebook.toString() !== this._notebookEditor.textModel!.uri.toString()) {
			return null;
		}

		const options: INotebookCellDecorationOptions = {
			overviewRuler: {
				color: debugIconBreakpointForeground,
				includeOutput: false,
				modelRanges: [new Range(breakpoint.lineNumber, 0, breakpoint.lineNumber, 0)],
				position: NotebookOverviewRulerLane.Left
			}
		};
		return { handle: parsed.handle, options };
	}).filter(x => !!x) as INotebookDeltaDecoration[]
	: [];

is being fixed to:

const newDecorations = enabled ?
	
	: [];

@camc314 camc314 removed their assignment Aug 27, 2024
@camc314 camc314 reopened this Aug 27, 2024
@camc314
Copy link
Collaborator Author

camc314 commented Aug 27, 2024

@mysteryven do you want to fix this?

@DonIsaac
Copy link
Collaborator

I'm wondering if we should make this a suggestion 🤔

@camc314
Copy link
Collaborator Author

camc314 commented Aug 27, 2024

actually i'm not sure why our fixer works this way

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/204d31c9c2a92496a59635d9f42a532e1dc46f90/rules/no-null.js#L87-L122

unicorn:

  1. if its the arg of a loose equals, suggests replacing with undefined
  2. suggests deleteing the null literal if it's the argument of a return stmt
  3. suggests deleting it if it's not a const var decl
  4. suggests replacing with undefined

@mysteryven

This comment was marked as outdated.

@camc314
Copy link
Collaborator Author

camc314 commented Aug 29, 2024

no worries,

i think this one is fixed now by d6b84ec (#5273)

@camc314 camc314 closed this as completed Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants