Next.js: File system dynamic routes doesn't work with eslint 6

Created on 12 Jul 2019  路  9Comments  路  Source: vercel/next.js

Bug report

Describe the bug

File system dynamic routes doesn't work with eslint 6

See output:

Screen Shot 2019-07-12 at 12 10 17 PM

file is there for sure

System information

  • OS: macOS
  • Version of Next.js: 9.0.1
  • Version of Eslint: 6.0.1

All 9 comments

Sounds like a bug in eslint, not Next.js. Potentially you have to double escape or use "./pages/\[id\].tsx" (with quotes)

I believe you need to use single quotes instead of double, but one of the two options should work!

Please file this bug with ESLint for adding special handling to a valid filename.

receiving a similar issue with prettier:

/Users/paul/repositories/client/crowdcaster2/web/node_modules/.bin/prettier --write pages/podcasts/[id]/edit.js
[error] No matching files. Patterns tried: pages/podcasts/[id]/edit.js !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,svn,hg}/**

EDIT: note this is only using prettier with a file watcher in intellij with prettier

NB: the following command runs fine, in package.json scripts:

//... other scripts
"lint:fix": "prettier --write \"**/*.js\" && eslint . --fix"
//...

@cajoy did you resolve this with eslint on your side?

@cajoy @Timer FYI

Still receiving this in IntelliJ Idea using prettier with a file watcher. Going to disable for now, and usee the command line before committing might be useful for others to document this once its solved.

/Users/paul/repositories/client/crowdcaster2/web/node_modules/.bin/prettier --write 'pages/podcasts/[id]/edit.js'
[error] No matching files. Patterns tried: 'pages/podcasts/[id]/edit.js' !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,svn,hg}/**

have tried, double quotes, single quotes, escaped double quotes in the file watcher config.

Screenshot 2019-07-16 at 22 20 27

My current workaround is to run prettier through eslint and then trigger eslint --fix on every save.

Yeah, this problem was solved by https://github.com/eslint/eslint/pull/11986 馃槃

Awesome @murajun1978 馃挴

this can come up if you are using eslint previous to 6.1.0

https://github.com/eslint/eslint/issues/11940

Was this page helpful?
0 / 5 - 0 ratings