From 27ff6de8b9cd74c3dc2b5caca7e2e1fa44ed01f4 Mon Sep 17 00:00:00 2001 From: samfreund Date: Sun, 28 Jun 2026 16:41:53 -0700 Subject: [PATCH 1/3] enforce code blocks using RLIs --- .remarkrc.mjs | 8 +++++- .../contribution/methodsOfContributing.mdx | 1 + src/content/docs/contribution/styleguide.mdx | 1 + .../docs/intro-to-java/java-fundamentals.mdx | 1 + src/plugins/remark-no-inline-code-fences.mjs | 26 +++++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/plugins/remark-no-inline-code-fences.mjs diff --git a/.remarkrc.mjs b/.remarkrc.mjs index 4f8689e..175ab2f 100644 --- a/.remarkrc.mjs +++ b/.remarkrc.mjs @@ -1,7 +1,13 @@ import remarkPresetLintRecommended from 'remark-preset-lint-recommended'; import remarkFrontmatter from 'remark-frontmatter'; import remarkMdx from 'remark-mdx'; +import remarkNoInlineCodeFences from './src/plugins/remark-no-inline-code-fences.mjs'; export default { - plugins: [remarkFrontmatter, remarkMdx, remarkPresetLintRecommended], + plugins: [ + remarkFrontmatter, + remarkMdx, + remarkPresetLintRecommended, + remarkNoInlineCodeFences, + ], }; diff --git a/src/content/docs/contribution/methodsOfContributing.mdx b/src/content/docs/contribution/methodsOfContributing.mdx index 0d04150..4d94e0e 100644 --- a/src/content/docs/contribution/methodsOfContributing.mdx +++ b/src/content/docs/contribution/methodsOfContributing.mdx @@ -12,6 +12,7 @@ import Aside from '../../../components/Aside.astro'; FRCSoftware.org is just getting started, so the easiest way to propose work is by opening a GitHub issue in the main repository. Use this template in your issue: +{/* rli:ignore */} ``` Issue/content: Solution or Notes about the execution of the content: diff --git a/src/content/docs/contribution/styleguide.mdx b/src/content/docs/contribution/styleguide.mdx index 4ea0917..d10f32a 100644 --- a/src/content/docs/contribution/styleguide.mdx +++ b/src/content/docs/contribution/styleguide.mdx @@ -110,6 +110,7 @@ Enforced by `prettier-plugin-sentences-per-line`. Run all checks locally before pushing: +{/* rli:ignore */} ```bash pnpm lint && pnpm format:check ``` diff --git a/src/content/docs/intro-to-java/java-fundamentals.mdx b/src/content/docs/intro-to-java/java-fundamentals.mdx index 14abaa5..643ca84 100644 --- a/src/content/docs/intro-to-java/java-fundamentals.mdx +++ b/src/content/docs/intro-to-java/java-fundamentals.mdx @@ -33,6 +33,7 @@ This could be a variable that holds the temperature or a variable that holds the Variable declarations have the following syntax: +{/* rli:ignore */} ```java Datatype name = value; ``` diff --git a/src/plugins/remark-no-inline-code-fences.mjs b/src/plugins/remark-no-inline-code-fences.mjs new file mode 100644 index 0000000..6a90e4c --- /dev/null +++ b/src/plugins/remark-no-inline-code-fences.mjs @@ -0,0 +1,26 @@ +import { visit } from 'unist-util-visit'; + +const IGNORE_RE = /rli:\s*ignore/; + +export default function remarkNoInlineCodeFences() { + return (tree, file) => { + visit(tree, 'code', (node, index, parent) => { + if (index !== undefined && parent) { + const prev = parent.children[index - 1]; + if (prev?.type === 'mdxFlowExpression' && IGNORE_RE.test(prev.value)) { + return; + } + } + + if (node.meta?.trim()) return; + + if (node.value?.trim()) { + const msg = file.message( + 'Code fences must use the RLI system: ```language path/to/file#regionName', + node, + ); + msg.fatal = true; + } + }); + }; +} From 1d61b2ce555c5cfa6c683da42155935e5946f435 Mon Sep 17 00:00:00 2001 From: samfreund Date: Sun, 28 Jun 2026 17:20:06 -0700 Subject: [PATCH 2/3] fix unexpected any's --- eslint.config.mjs | 2 +- src/components/Slides.astro | 16 +++++++++++++--- .../contribution/methodsOfContributing.mdx | 1 + src/content/docs/contribution/styleguide.mdx | 1 + .../docs/intro-to-java/java-fundamentals.mdx | 1 + src/plugins/remark-code-region.ts | 2 +- src/plugins/remark-image-attributes.ts | 13 +++++++------ src/plugins/remark-mdx-global-imports.ts | 18 +++++++++++++----- src/plugins/remark-no-inline-code-fences.mjs | 5 ++++- 9 files changed, 42 insertions(+), 17 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 37230cb..085833e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -17,7 +17,7 @@ export default [ 'warn', { argsIgnorePattern: '^_' }, ], - '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-explicit-any': 'error', }, }, diff --git a/src/components/Slides.astro b/src/components/Slides.astro index 317b6b3..dd3270a 100644 --- a/src/components/Slides.astro +++ b/src/components/Slides.astro @@ -878,9 +878,19 @@ const slideId = `slides-${Math.random().toString(36).substring(2, 11)}`;