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

More linting from Biome.js #168

Merged
merged 8 commits into from
Feb 18, 2025
Merged

More linting from Biome.js #168

merged 8 commits into from
Feb 18, 2025

Conversation

alexrudd2
Copy link
Owner

@alexrudd2 alexrudd2 commented Feb 17, 2025

I am still experimenting with Biome as a faster and simpler alternative to eslint, its mess of plugins, and prettier.

The defaults seem pretty good and match with many eslint plugins. I think a lot of the rules/lints are worth adopting. Even if we ultimately don't use Biome, we can find the corresponding eslint rules.

@alexrudd2
Copy link
Owner Author

See also #96. I expect efforts to cleanup with any linter will improve the situation with all of them.

IMO there are three large problems with confidence in refactoring:
(1) lots of any types that need to be narrowed
(2) lack of thorough tests
(3) lack of understanding the actual architecture :)

@alexrudd2
Copy link
Owner Author

@drskullster feel free to add your comments as well.

@juli4nb4dillo
Copy link
Collaborator

@alexrudd2 I'm assuming it uses the same eslintrc.js?
Otherwise I don't know where it's getting its rules.
If we're adopting biome, it should be in the dev dependencies instead of eslint.

@alexrudd2
Copy link
Owner Author

@alexrudd2 I'm assuming it uses the same eslintrc.js? Otherwise I don't know where it's getting its rules.

biome.json comes with a set of recommended rules by default. https://biomejs.dev/guides/getting-started/#configuration

If we're adopting biome, it should be in the dev dependencies instead of eslint.

For now I'm still evaluating it, and don't want to step on others' toes removing eslint. We could also consider ts-standard. Also, there are > 100 issues found with the default rules that remain to be fixed. (So far none of the fixes cause eslint to complain, which suggests the good interop/compatibility.)

@@ -1,5 +1,5 @@
import {Plan, plan, Device, AxidrawFast, XYMotion, PenMotion, defaultPlanOptions} from '../planning';
import {Vec2} from '../vec';
import type {Vec2} from '../vec';

Choose a reason for hiding this comment

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

No space between { }, but I expect you're still experimenting with the tool?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, for now in biome.json the linter is enabled but the formatter is not.

I just tried enabling the formatter (with default settings), and it did change to { Vec }.... but also expanded all the imports on different lines. :/

@drskullster
Copy link

@alexrudd2 I think it's a great idea to fix lint issues, I have no opinion on the choice of the tool :)

One thing that'd be nice to look at is unnecessary typings, but I don't know if those tools have rules for that. For example in server.ts we define an interface for the Plotter object here:

saxi/src/server.ts

Lines 158 to 163 in d05fc4c

interface Plotter {
prePlot: (initialPenHeight: number) => Promise<void>;
executeMotion: (m: Motion, progress: [number, number]) => Promise<void>;
postCancel: (initialPenHeight: number) => Promise<void>;
postPlot: () => Promise<void>;
}

But the functions below still have their typings :

async postCancel(initialPenHeight: number): Promise<void> {

which hurts the readability in my opinion.

@jedahan
Copy link
Collaborator

jedahan commented Feb 17, 2025

I'm all for tools with less configuration options, and would love to see how far we can get with the default styles.

@alexrudd2
Copy link
Owner Author

OK, I'll merge these since they're generally code improvements and not fighting the other linters (yet?)

@alexrudd2 alexrudd2 merged commit 319dccc into main Feb 18, 2025
6 checks passed
@alexrudd2 alexrudd2 deleted the biome-lint branch February 18, 2025 00:16
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

Successfully merging this pull request may close these issues.

4 participants