You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After bumping esbuild-plugin-eslint from v0.3.3 to v0.3.8 in order to use the new release from #11, I encountered the problem of importing ESM in a CJS environment (which appears to have been introduced in v0.3.4). Since this is for use with the Serverless Framework (using serverless-esbuild), I can't just move to ESM, unfortunately.
To work around this, I added https://github.com/nktnet1/import-sync in order to import this plugin. This worked great, as I got back to the error of "no eslint configuration found" from v0.3.3. However, once I bumped eslint to the v9 beta, I got the following error
The above error, but in a code block
✘ [ERROR] A dynamic import callback was not specified. [plugin eslint]
/home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/eslint/lib/eslint/eslint.js:315:19:
315 │ const config = (await import(fileURL)).default;
╵ ^
at new NodeError (node:internal/errors:393:5)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:39:9)
at loadFlatConfigFile (/home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/eslint/lib/eslint/eslint.js:315:20)
at async calculateConfigArray (/home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/eslint/lib/eslint/eslint.js:394:28)
at async ESLint.lintFiles (/home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/eslint/lib/eslint/eslint.js:803:25)
at async /home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/esbuild-plugin-eslint/dist/index.js:15:29
at async /home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/esbuild/lib/main.js:1481:27
This error came from the "onEnd" callback registered here:
/home/james/projects/LabelLogicLive_Monorepo/packages/api/node_modules/esbuild-plugin-eslint/dist/index.js:14:8:
14 │ onEnd(async () => {
╵ ~~~~~
This makes me wonder whether the problem is with the importing of ESM in a CJS environment, since my workaround I had while waiting on your fix for #11 was working perfectly fine without the need for any hacks. I also tried it with v9 of eslint, and it still worked perfectly fine. The problem is somewhere between importing esbuild-plugin-eslint, and the loading of eslint itself.
For reference, this is the plugin workaround code
consteslintPlugin=({ filter })=>({name: "eslint",setup: ({ onLoad, onEnd })=>{loadESLint().then(eslintClass=>{/** @type {import("esbuild").OnLoadArgs["path"][]} */constfilesToLint=[];consteslint=neweslintClass();onLoad({ filter },({ path })=>{if(!path.includes("node_modules"))filesToLint.push(path);returnnull;});onEnd(async()=>{constresults=awaiteslint.lintFiles(filesToLint);constformatter=awaiteslint.loadFormatter("stylish");constoutput=awaitformatter.format(results);if(output.length>0)console.log(output);constwarnings=results.reduce((count,result)=>count+result.warningCount,0);consterrors=results.reduce((count,result)=>count+result.errorCount,0);constret={errors: []};if(warnings>0){ret.errors.push({text: `${warnings} warnings were found by eslint!`});}if(errors>0){ret.errors.push({text: `${errors} errors were found by eslint!`});}returnret;});});}});
Would it be possible to get a release of esbuild-plugin-eslint with a cjs build alongside the esm build?
After bumping esbuild-plugin-eslint from v0.3.3 to v0.3.8 in order to use the new release from #11, I encountered the problem of importing ESM in a CJS environment (which appears to have been introduced in v0.3.4). Since this is for use with the Serverless Framework (using
serverless-esbuild
), I can't just move to ESM, unfortunately.To work around this, I added https://github.com/nktnet1/import-sync in order to import this plugin. This worked great, as I got back to the error of "no eslint configuration found" from v0.3.3. However, once I bumped eslint to the v9 beta, I got the following error
The above error, but in a code block
This makes me wonder whether the problem is with the importing of ESM in a CJS environment, since my workaround I had while waiting on your fix for #11 was working perfectly fine without the need for any hacks. I also tried it with v9 of eslint, and it still worked perfectly fine. The problem is somewhere between importing
esbuild-plugin-eslint
, and the loading ofeslint
itself.For reference, this is the plugin workaround code
Would it be possible to get a release of esbuild-plugin-eslint with a cjs build alongside the esm build?
For example, the dist folder would look like
and the package.json would include the following
The text was updated successfully, but these errors were encountered: