Common Next.js issues that could use integrated ESLint rules #27051
Comments
|
maybe also a rule for where global css imports are allowed? |
|
I would love to work on this @leerob. Can you please assign this to me? |
|
@Patil2099 Which one specifically would you like to work on first? |
|
@leerob I'll work on Just to confirm, are you looking to include these interfaces as well https://developer.mozilla.org/en-US/docs/Web/API#interfaces ? |
I'm not sure how you were planning on detecting API/promises, but if it is typescript based it can probably either defer to this existing rule or extend it somehow if necessary: |
|
Another one: throw an error if using fs or other node packages on the client side. |
We enforce to be kebab-case file name, no more case sensitive vs not issues. Worth reading a bit more here: https://github.com/straw-hat-team/adr/tree/master/adrs/3122196229 I think the problem begins by adopting things that cause more harm than good in the long run with little to no value IMO. I don't remember anymore how many times I had to fix CI by telling people to fix the casing situation and reminds them to use I would discourage the usage of camelCase or PascalCase and stick to kebab-case as NodeJS used to be until we diverged. :2cents: |
|
@yordis I'm not saying Next.js ESLint should have a preference on how you do casing – that's a bit to stylistic to determine at the framework level. I'm talking about when you import a file |
|
Oh like, check for those errors?! Sorry, I misunderstood |
|
Hello everyone! I'm Keen and I just joined Google's WebSDK (Aurora) team this week
Please let me know if you have any concerns, otherwise I'll get started! |
|
hi all! @leerob I would like to try to implement this rule: Just to clarify, the rule should not allow using |


Describe the feature you'd like to request
These are common issues developers run into with Next.js. Some are mentioned in the docs, but ideally you don't have to go check the docs.
Describe the solution you'd like
Instead, ESLint can provide compile-time feedback and suggestions.
Trying to call an API route from inside
getStaticProps/getServerSidePropsleading to next build failing.Trying to use
getStaticPropsinside of_app.js, assuming it works like the other pages, but it doesn't.Forgetting to await an async function inside an API route, works fine locally but does out of band work which will cause issues if there’s multiple requests.
Code Example
Using
documentor other browser APIs outside ofuseEffectFile name casing (e.g.
myFile.jsvsMyFile.js). This could potentially be solved with linting if import statement diffs from the actual file path? Not sure.Describe alternatives you've considered
N/A
The text was updated successfully, but these errors were encountered: