Skip to content

Commit

Permalink
Remove the remark messaging linter (#449)
Browse files Browse the repository at this point in the history
Remove the messaging linter from our remark-based linting setup in
gravitational/docs so we can move the linter to the vale configuration
in gravitational/teleport.
  • Loading branch information
ptgott authored Apr 15, 2024
1 parent e8d9487 commit 48ad166
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 273 deletions.
6 changes: 0 additions & 6 deletions .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
} from "./.build/server/docs-helpers.mjs";
import {
loadConfig,
loadMessagingConfig,
} from "./.build/server/config-docs.mjs";
import { remarkLintMessaging } from "./.build/server/remark-lint-messaging.mjs";

const configFix = {
settings: {
Expand Down Expand Up @@ -76,10 +74,6 @@ const configLint = {
// Disabling the remarkLintFrontmatter check until we fix
// gravitational/docs#80
// [remarkLintFrontmatter, ["error"]],
[
remarkLintMessaging,
loadMessagingConfig(resolve("messaging-config.json")),
],
],
};

Expand Down
18 changes: 0 additions & 18 deletions messaging-config.json

This file was deleted.

40 changes: 0 additions & 40 deletions server/config-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { existsSync, readFileSync } from "fs";
import { isExternalLink, isHash, splitPath } from "../utils/url";
import { NavigationCategory, NavigationItem } from "../layouts/DocsPage/types";
import { loadConfig as loadSiteConfig } from "./config-site";
import { RemarkLintMessagingOptions } from "./remark-lint-messaging";

const { latest } = loadSiteConfig();
export interface Config {
Expand Down Expand Up @@ -130,32 +129,6 @@ const validator = ajv.compile({
additionalProperties: false,
});

// Schema for the document that configures the messaging linter
const messagingConfigValidator = ajv.compile({
type: "array",
items: {
type: "object",
properties: {
incorrect: {
type: "string",
},
correct: {
type: "string",
},
explanation: {
type: "string",
},
where: {
type: "array",
items: {
type: "string",
enum: ["title", "description", "comments", "body", "headers"],
},
},
},
},
});

/*
* We store relative paths in the config so we don't need to change them all
* when we add new version, but for next/link and next/router to work they should be absolte.
Expand Down Expand Up @@ -356,16 +329,3 @@ export const loadConfig = (version: string) => {

return normalize(config, version);
};

export const loadMessagingConfig = (
path: string
): RemarkLintMessagingOptions => {
if (!existsSync(path)) {
throw Error(`File ${path} does not exist.`);
}
const content = readFileSync(path, "utf-8");
const config = JSON.parse(content) as RemarkLintMessagingOptions;
validateConfig<RemarkLintMessagingOptions>(messagingConfigValidator, config);

return config;
};
209 changes: 0 additions & 209 deletions server/remark-lint-messaging.ts

This file was deleted.

0 comments on commit 48ad166

Please sign in to comment.