Skip to content

create lint:fix command and add more eslint rules#2089

Merged
dteviot merged 4 commits into
dteviot:ExperimentalTabModefrom
crybx:lintfix
Aug 7, 2025
Merged

create lint:fix command and add more eslint rules#2089
dteviot merged 4 commits into
dteviot:ExperimentalTabModefrom
crybx:lintfix

Conversation

@crybx

@crybx crybx commented Aug 5, 2025

Copy link
Copy Markdown
Contributor
  • Additional eslint rules for consistent spacing, semicolon usage, and some code formatting.
  • Added command npm run lint:fix to make fixing what doesn't match the rules easy.
  • File changes from running the new command with the new rules.

This continues to help me reduce diffs with the versions of the plugin I run all the time: (https://github.com/crybx/WebToEpub/tree/dev-v2 if interested. Despite the diverging ahead/behind commit numbers, I keep cherry picking or rebasing updates from the original repo and merging the diffs is a pain, and this branch is from before I started merging with another extension 😭)

Comment thread eslint/.eslintrc.js
"always"
],
"no-undef": "off",
"no-unused-vars": "off",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why do you think no-undef and no-unused-vars should be turned off?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dteviot This was for the sake of making fixing lint errors automatically possible. Without turning those off, the npm run lint:fix does this for me:
no-undef
no-unused-vars

These things ARE all defined when the files are concatenated together into one big packed.js (or running and added with script tags to the html), but when running lint to auto fix the individual files without stitching them together, they don't exist. I believe it's possible to tell eslint which things exist.

@dteviot

dteviot commented Aug 7, 2025

Copy link
Copy Markdown
Owner

Will accept as is, can decide on the lint rules later.
As it's touched almost every file, I don't want to have to fixup a merge conflict if someone commits before we've decided.
And it does make the code a bit more consistent. And we need to run lint anyway.

Note, My reason for running lint was to look for potential bugs, rather than code style. The fact that we need to fix the style, I'm not entirely sure is a benefit. But is necessary to keep the warnings clean. (Yes, I could probably turn off the indentation warnings. But, well, it works well enough, can't be bothered trying to mess with it.)

I'll note, we probably missed an opportunity to replace all the

parserFactory.register("gravitytales.com", function() { return new GravityTalesParser() });

with

parserFactory.register("gravitytales.com", () => new GravityTalesParser()});

As lint was reformatting them to add the missing colon.

@dteviot dteviot merged commit a10c5e8 into dteviot:ExperimentalTabMode Aug 7, 2025
1 check passed
@crybx crybx deleted the lintfix branch August 10, 2025 17:40
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.

2 participants