Comments (11)
You should provide a runnable minimal reproduction first.
@JounQin runnable minimal reproduction.
from prettier-eslint-cli.
@JounQin Sure thing. In the example, the file at pages/index.js
has this code with a long string of text:
export default function Home() {
return (
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Veniam illum placeat ratione consequuntur dolor ea? Quas explicabo minus voluptate, laudantium aliquam accusamus aperiam aliquid nisi, iste adipisci placeat, repudiandae cumque.
</p>
)
}
Problem: Running prettier-eslint
on this file throws an error:
TypeError [ERR_INVALID_ARG_VALUE]: Failed to load plugin 'react-hooks' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
Expected: prettier-eslint
should format the file without throwing an error.
Steps to reproduce:
- Clone the repo and install dependencies.
- From the root directory, run
yarn format
oryarn prettier-eslint pages/.*js
The eslint config is the default provided by Next.js. If the config is removed, prettier-eslint
formats the code as expected.
from prettier-eslint-cli.
@mattbrannon Sorry I was a bit busy these days, hope I can find some free time to invest today.
from prettier-eslint-cli.
You should provide a runnable minimal reproduction first.
from prettier-eslint-cli.
Ok, I guess we can try to propose a PR with this fix to rushstack/eslint-patch.
Thanks for investigating !
from prettier-eslint-cli.
Same problem over here.
Tried installing several packages for the ESLint plugins (not necessary when executing eslint
and next lint
) but still getting the same error, just with a different plugin (@typescript-eslint
):
Error: Failed to load plugin '@typescript-eslint' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
TypeError: Failed to load plugin '@typescript-eslint' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
at new NodeError (node:internal/errors:371:5)
at createRequire (node:internal/modules/cjs/loader:1277:13)
at Object.resolve (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:2325:16)
at Object.ModuleResolver.resolve (d:\git\subfolder\project\web_prod\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:201:44)
at ConfigArrayFactory._loadPlugin (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3376:33)
at ConfigArrayFactory._loadPlugin (d:\git\subfolder\project\web_prod\node_modules\@rushstack\eslint-patch\lib\modern-module-resolution.js:203:43)
at d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3267:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3263:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3063:44)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3003:20)
at _normalizeObjectConfigData.next (<anonymous>)
at ConfigArrayFactory.create (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:2798:16)
at createCLIConfigArray (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3608:47)
at CascadingConfigArrayFactory.clearCache (d:\git\subfolder\project\web_prod\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3780:32)
at new ESLint (d:\git\subfolder\project\web_prod\node_modules\eslint\lib\eslint\eslint.js:448:32)
at Pge (c:\Users\onlyme\.vscode\extensions\rvest.vs-code-prettier-eslint-5.0.1\dist\extension.js:180:69)
at c:\Users\onlyme\.vscode\extensions\rvest.vs-code-prettier-eslint-5.0.1\dist\extension.js:188:700
at Lge (c:\Users\onlyme\.vscode\extensions\rvest.vs-code-prettier-eslint-5.0.1\dist\extension.js:180:1439)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
from prettier-eslint-cli.
Same issue as this one: #426
from prettier-eslint-cli.
Sorry to bump this issue, but is this on your radar ? Do you plan to solve it, or is this a deeper issue, that should rather be fixed in @rushstack/eslint-patch
?
from prettier-eslint-cli.
You should provide a runnable minimal reproduction first.
Thanks for reproduction first, but can you please clarify what command to reproduce the issue, what's the problem and what is expected?
from prettier-eslint-cli.
@mattbrannon I believe this is caused by @rushstack/eslint-patch
which is used by eslint-config-next
.
A quick fix could be return originalResolve.call(this, moduleName, ctx.filePath || relativeToPath)
from prettier-eslint-cli.
FYI this has been merged into eslint-patch, however the nextjs eslint extension is not using the latest version of the package. see this comment for how to override it
from prettier-eslint-cli.
Related Issues (20)
- support directory as argument HOT 3
- Is it possible to provide a `--check` option like prettier? HOT 2
- I have problem about this package, HOT 1
- eslint error: Configuration for rule "import/order" is invalid HOT 1
- What different beween use prettier-eslint-cli and use prettier and eslint step by step? HOT 3
- Can an error be reported when the error cannot be resolved? HOT 1
- `--list-different` doesn't exclude node_modules HOT 1
- `--list-different` from script fails HOT 1
- Error: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '' HOT 4
- Error after updating eslint to 8.1.0 HOT 8
- Still reports "jsxBracketSameLine is deprecated." even when option is not used HOT 1
- Option to fix only `layout` issues HOT 1
- Add --cache option HOT 1
- [v7] bump dependencies HOT 1
- Maintainace: replace `semantic-release` with `changesets` HOT 12
- Support Yarn Plug n Play HOT 1
- Failed to load plugin 'react-hooks' declared in 'CLIOptions' HOT 1
- Support for Prettier 3 (TypeError: Expected `input` to be a `string`, got `object`) HOT 1
- Allow prettier-eslint-cli to write eslint errors/warnings to stderr? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-eslint-cli.