microsoft / vscode-eslint

VSCode extension to integrate eslint into VSCode
MIT License
1.74k stars 335 forks source link

eslint is not loading suddenly #1832

Closed saadamin closed 3 months ago

saadamin commented 6 months ago

development enviroment: Version: 1.88.1 (system setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

nodejs: v20.12.1 vscode-eslint: v2.4.4

package.json "scripts": { "dev": "vite", "build": "tsc && vite build", "pretty": "prettier --write \"src/*/.{css,js,json,ts,tsx}\"", "update": "yarn-upgrade-all", "upgrade": "yarn upgrade-interactive" }, "dependencies": { "@heroicons/react": "^1.0.6", "autoprefixer": "^10.4.19", "axios": "^1.6.8", "export-from-json": "^1.7.4", "framer-motion": "^11.0.25", "postcss": "^8.4.38", "postcss-import": "^16.1.0", "postcss-nesting": "^12.1.1", "react": "^18.2.0", "react-datepicker": "^6.6.0", "react-dom": "^18.2.0", "react-router-dom": "^6.22.3", "react-select": "^5.8.0", "react-table": "^7.8.0", "react-toastify": "^10.0.5", "recharts": "^2.12.4", "urijs": "^1.19.11" }, "devDependencies": { "@types/node": "^20.12.7", "@types/react": "^18.2.75", "@types/react-dom": "^18.2.24", "@typescript-eslint/eslint-plugin": "^7.6.0", "@typescript-eslint/parser": "^7.6.0", "@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react-swc": "^3.6.0", "eslint": "^9.0.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-storybook": "^0.8.0", "eslint-plugin-tailwindcss": "^3.15.1", "export-from-json": "^1.7.4", "prettier": "^3.2.5", "react-quill": "^2.0.0", "regenerator-runtime": "^0.14.1", "tailwindcss": "^3.4.3", "terser": "^5.30.3", "tsconfig-paths-webpack-plugin": "^4.1.0", "typescript": "^5.4.4", "vite": "^5.2.8", "vite-plugin-remove-console": "^2.2.0", "vite-tsconfig-paths": "^4.3.2", "yarn-upgrade-all": "^0.7.2" }

Here is the output

[Info - 2:29:15 AM] ESLint server is starting. [Info - 2:29:15 AM] ESLint server running in node v18.18.2 [Info - 2:29:15 AM] ESLint server is running. [Info - 2:29:17 AM] ESLint library loaded from: D:\Copy\ACSW ResearchCloud\node_modules\eslint\lib\api.js [Error - 2:29:17 AM] Calculating config file for file://PATH_OF_MY_PROJECT_FOLDER/vite.config.ts) failed. TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///PATH_OF_MY_PROJECT_FOLDER/.eslintrc.json?mtime=1711012749924" needs an import assertion of type "json" at new NodeError (node:internal/errors:405:5) at validateAssertions (node:internal/modules/esm/assert:95:15) at defaultLoad (node:internal/modules/esm/load:91:3) at nextLoad (node:internal/modules/esm/loader:166:28) at ESMLoader.load (node:internal/modules/esm/loader:608:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:462:22) at new ModuleJob (node:internal/modules/esm/module_job:64:26) at #createModuleJob (node:internal/modules/esm/loader:485:17) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:439:34)

dbaeumer commented 6 months ago

Looks like you are using eslint 9.0. This has flat config on by default and is best used with the 3.0.5 pre-release extension of ESLint extension.

If using that extension doesn't help, please ensure that liniting works correctly in the terminal. If it does but not in the VS Code extension please provide me with a GitHub repository I can clone with a minimal setup to reproduce the problem.

karlhorky commented 3 months ago

Looks like you are using eslint 9.0. This has flat config on by default and is best used with the 3.0.5 pre-release extension of ESLint extension.

Update for anyone reading this again now:

This 3.0.5 pre-release version has now been released as full extension releases (versions 3.0.8 and 3.0.10, as seen on the ESLint VS Code extension Marketplace page):

Screenshot 2024-07-09 at 17 00 25

dbaeumer commented 3 months ago

I will close the issue since things should work now with eslint 9.0 and 3.10.0 of the extension.