question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filename starting with '$' causes ESLint / Prettier to fail

See original GitHub issue

What version of Remix are you using?

1.5.1

Steps to Reproduce

Create a new Remix project with npx create-remix@latest and choose the Blues stack. Run npx eslint ./app/routes/notes/$noteId.tsx

You will get the following error:

Oops! Something went wrong! :(

ESLint: 8.16.0

No files matching the pattern "./app/routes/notes/.tsx" were found.
Please check for typing mistakes in the pattern.

Expected Behavior

No error is thrown and the file gets parsed by ESLint.

Actual Behavior

I’m using Remix inside an Nx monorepo. When I run the command nx format:check I get this error and the command fails (which also affects the CI).

It’s happening because $noteId is considered a variable. I think this issue belongs here since it’s a Remix convention to add $ in the filename.

The only workaround I found for now is to have a path like ./app/routes/notes/$noteId/index.tsx

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lildesertcommented, May 30, 2022

Yeah I know the substitution is the root cause. But even by running npx eslint "./app/routes/notes/\$noteId.tsx" or npx eslint ./app/routes/notes/\$noteId.tsx it doesn’t work. Maybe the issue is more Nx related then, I’ll ask how to deal with exotic filenames there.

0reactions
lildesertcommented, Jul 4, 2022

Quick update on this, we’ve found a workaround by using pretty-quick https://www.npmjs.com/package/pretty-quick It runs in CI with github-actions and with husky as a pre-commit hook. We previously used lint-staged but the issue is directly linked to it -> https://github.com/okonet/lint-staged/issues/962 In dev we just use vscode format on save with prettier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eslint prettier error on new line incomprehensible
Ir looks like a JSX configuration that's causing problems. Try changing the value of bracketSameLine in your prettier configuration to true ...
Read more >
How to make ESLint work with Prettier avoiding conflicts ...
I just had a problem when adding the "prettier/prettier" : "error", inside the rules at the .eslintrc file. It caused many errors that...
Read more >
Integrating with Linters
First, we have plugins that let you run Prettier as if it was a linter rule: eslint-plugin-prettier · stylelint-prettier. These plugins were especially...
Read more >
Using Prettier and ESLint to automate formatting and fixing ...
Learn how to use ESLint and Prettier together to automatically format and fix JavaScript code in your projects.
Read more >
Rules - ESLint - Pluggable JavaScript Linter
The eqeqeq rule is off and the curly rule is set to be an error. ... curly: "error" * -------- * This will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found