Skip to content

chore: remove unused code and eslint disable comments #3522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/utils/gulpError.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* eslint-disable */
const gulpError = `gulpErrorPlaceHolder`;

export default gulpError;
57 changes: 23 additions & 34 deletions site/plugin-tdoc/md-to-vue.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/* eslint-disable */
import fs from 'fs';
import path from 'path';
import matter from 'gray-matter';
// import camelCase from 'camelcase';

// import testCoverage from '../test-coverage';

const componentPath = path.join(__dirname, './component.vue').replaceAll('\\', '/');

Expand All @@ -20,33 +16,6 @@ const DEFAULT_EN_TABS = [
{ tab: 'design', name: 'Guideline' },
];

export default function mdToVue(options: any) {
const mdSegment = customRender(options);
const { demoCodesImportsStr = '', demoCodesDefsStr } = options;

// let coverage = '';
// if (mdSegment.isComponent) {
// coverage = testCoverage[camelCase(mdSegment.componentName)] || '0%';
// }

const sfc = `
<template><tdesign-doc /></template>
<script>
import TdesignDoc from '${componentPath}';
import { defineComponent } from 'vue';
${demoCodesImportsStr}

export default defineComponent({
props: { docType: String },
components: { TdesignDoc },
provide: { info: ${JSON.stringify(mdSegment)}, demos: { ${demoCodesDefsStr} } },
});
</script>
`;

return sfc;
}

// 解析 markdown 内容
function customRender({ source, file, md }: any) {
const { content, data } = matter(source);
Expand All @@ -72,7 +41,7 @@ function customRender({ source, file, md }: any) {
const componentName = reg && reg[1];

// split md
let [demoMd = '', apiMd = ''] = content.split(pageData.apiFlag);
const [demoMd = '', apiMd = ''] = content.split(pageData.apiFlag);

const mdSegment = {
...pageData,
Expand Down Expand Up @@ -103,10 +72,30 @@ function customRender({ source, file, md }: any) {
if (fs.existsSync(designDocPath)) {
const designMd = fs.readFileSync(designDocPath, 'utf-8');
mdSegment.designMd = md.render.call(md, `${pageData.toc ? '[toc]\n' : ''}${designMd}`).html;
} else {
// console.log(`[vite-plugin-tdoc]: 未找到 ${designDocPath} 文件`);
}
}

return mdSegment;
}

export default function mdToVue(options: any) {
const mdSegment = customRender(options);
const { demoCodesImportsStr = '', demoCodesDefsStr } = options;

const sfc = `
<template><tdesign-doc /></template>
<script>
import TdesignDoc from '${componentPath}';
import { defineComponent } from 'vue';
${demoCodesImportsStr}

export default defineComponent({
props: { docType: String },
components: { TdesignDoc },
provide: { info: ${JSON.stringify(mdSegment)}, demos: { ${demoCodesDefsStr} } },
});
</script>
`;

return sfc;
}
2 changes: 0 additions & 2 deletions src/tabs/tabs.wxs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable */

function animate(options) {
var result = [];

Expand Down
1 change: 0 additions & 1 deletion src/textarea/textarea.wxs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
var utils = require('../common/utils.wxs');

function textareaStyle(autosize) {
Expand Down