Filename starting with '$' causes ESLint / Prettier to fail
See original GitHub issueWhat 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:
- Created a year ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah I know the substitution is the root cause. But even by running
npx eslint "./app/routes/notes/\$noteId.tsx"
ornpx eslint ./app/routes/notes/\$noteId.tsx
it doesn’t work. Maybe the issue is moreNx
related then, I’ll ask how to deal with exotic filenames there.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.