Skip to content

Commit

Permalink
Restore package.json require() in plugin.ts.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwilsonvu committed Aug 17, 2024
1 parent 2c2be13 commit c8a7981
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
26 changes: 4 additions & 22 deletions scripts/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,39 +186,21 @@ const buildTilde = async () => {
].join("\n");
};

async function processReadme() {
markdownMagic(path.join(__dirname, "..", "README.md"), {
async function run() {
await markdownMagic(path.join(__dirname, "..", "README.md"), {
transforms: {
RULES: () => buildRulesTable(ruleTableRows),
TILDE: () => buildTilde(),
},
failOnMissingTransforms: true,
});
}

async function processRuleDocs() {
// const docRoot = path.resolve(__dirname, "..", "docs");

markdownMagic(path.resolve(__dirname, "..", "docs", "*.md"), {
await markdownMagic(path.resolve(__dirname, "..", "docs", "*.md"), {
transforms: {
HEADER: ({ srcPath }: any) => buildHeader(path.basename(srcPath)),
OPTIONS: ({ srcPath }: any) => buildOptions(path.basename(srcPath)),
CASES: ({ content, srcPath }: any) => buildCases(content, path.basename(srcPath)),
},
failOnMissingTransforms: true,
});

// const docFiles = (await fs.readdir(docRoot)).filter((p) => p.endsWith(".md"));
// for (const docFile of docFiles) {
// markdownMagic(path.join(docRoot, docFile), {
// transforms: {
// HEADER: ({ content, srcPath }: any) => buildHeader(path.basename(srcPath)),
// OPTIONS: ({ content, srcPath }: any) => buildOptions(path.basename(srcPath)),
// CASES: ({ content, srcPath }: any) => buildCases(content, path.basename(srcPath)),
// },
// failOnMissingTransforms: true,
// });
// }
}

Promise.all([processReadme(), processRuleDocs()]);
run();
5 changes: 2 additions & 3 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import noArrayHandlers from "./rules/no-array-handlers";
// import validateJsxNesting from "./rules/validate-jsx-nesting";

// Use require() so that `package.json` doesn't get copied to `dist`

import packageJson from "../package.json";
const { name, version } = packageJson; // require("../package.json");
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { name, version } = require("../package.json");
const meta = { name, version };

const allRules = {
Expand Down

0 comments on commit c8a7981

Please sign in to comment.