astro/no-deprecated-astro-fetchcontent
disallow using deprecated
Astro.fetchContent()
- ⚙ This rule is included in
"plugin:astro/recommended"
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
📖 Rule Details
This rule reports use of deprecated Astro.fetchContent()
.
---
/* eslint astro/no-deprecated-astro-fetchcontent: "error" */
/* ✓ GOOD */
const posts = await Astro.glob('../pages/post/*.md');
/* ✗ BAD */
const posts_bad = await Astro.fetchContent('../pages/post/*.md');
---
<div>
{posts.slice(0, 3).map((post) => (
<article>
<h1>{post.frontmatter.title}</h1>
<p>{post.frontmatter.description}</p>
<a href={post.frontmatter.url}>Read more</a>
</article>
))}
</div>
🔧 Options
Nothing.
📚 Further Reading
🚀 Version
This rule was introduced in eslint-plugin-astro v0.12.0
🔍 Implementation
Edit this page
Back
← astro/no-deprecated-astro-canonicalurl Next Page
astro/no-deprecated-astro-resolve →
← astro/no-deprecated-astro-canonicalurl Next Page
astro/no-deprecated-astro-resolve →