Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"endOfLine": "auto"
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
42 changes: 42 additions & 0 deletions eslint.config.mjs
Copy link
Contributor

Choose a reason for hiding this comment

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

When I tried running the command with the provided solution (settings object), I noticed that the command took quite some time, so I chat gpt'd reasons as to why it may be, and I guess I concluded with the idea that when I run the command in the root directory, it goes through all folders and files. I'm not sure if that's the reason why it takes so long, but I tested it by forcing the linting to only work on the src folder and it wound up being alot quicker

npx eslint --fix src/

Do you find a similar issue on your end or is this isolated to my computer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do find it kind of slow (like 10 seconds slow), but when I run npx eslint --fix src/ the time is about the same for me. I suspected that maybe it was linting node modules but by default eslint ignores node modules. I also ran npx eslint --debug and confirmed so that node modules wasn't being linted

I guess eslint-plugin-prettier adds some overhead, but when I tried removing the it the time was still was >5 seconds, so I think it's also eslint-plugin-import-x. Some files just take a while to lint with the plugins. You can try running npx eslint --debug yourself to see how long stuff takes to run, I'm open to any suggestions. Given that we're probably only running this once in a while I'm inclined to move forward and work on continue working on improving the performance later though, let me know if you agree

Copy link
Contributor Author

@Dennull Dennull Dec 6, 2024

Choose a reason for hiding this comment

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

Okay, as discussed offline, it turns out the issue was that the linter was looking through your build folder. I managed to find out why my config to ignore the build directory wasn't working and fixed it. Give it a shot and see if that stops the linter from going forever 👍

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* eslint-disable import-x/no-named-as-default-member */
import pluginJs from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import eslintPluginImportX from "eslint-plugin-import-x";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import pluginReact from "eslint-plugin-react";
import globals from "globals";
import tseslint from "typescript-eslint";

export default [
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
eslintPluginPrettierRecommended,
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
{
languageOptions: {
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"import-x/default": "off",
"import-x/order": [
"error",
{
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"react/jsx-sort-props": ["error", { ignoreCase: true }],
"react/sort-prop-types": "error",
},
},
];
Loading
Loading