Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(website): update report as issue to use new issue forms#4916

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 4 commits intomainfromfeat/playground-issue-forms-4913
May 23, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
8 changes: 4 additions & 4 deletionspackages/website/src/components/OptionsSelector.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import CopyIcon from '@site/src/icons/copy.svg';

import useDebouncedToggle from './hooks/useDebouncedToggle';

import { createMarkdown } from './lib/markdown';
import { createMarkdown, createMarkdownParams } from './lib/markdown';

import type { RuleDetails } from './types';

Expand DownExpand Up@@ -97,8 +97,8 @@ function OptionsSelector({
}
window
.open(
`https://github.com/typescript-eslint/typescript-eslint/issues/new?body=${encodeURIComponent(
createMarkdown(state),
`https://github.com/typescript-eslint/typescript-eslint/issues/new?${createMarkdownParams(
state,
)}`,
'_blank',
)
Expand DownExpand Up@@ -202,7 +202,7 @@ function OptionsSelector({
</Tooltip>
</button>
<button className={styles.optionLabel} onClick={openIssue}>
Report Issue
ReportasIssue
<CopyIcon />
</button>
</Expander>
Expand Down
4 changes: 2 additions & 2 deletionspackages/website/src/components/Playground.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ function Playground(): JSX.Element {
rules: {},
tsConfig: {},
});
const {isDarkTheme } = useColorMode();
const {colorMode } = useColorMode();
const [esAst, setEsAst] = useState<TSESTree.Program | string | null>();
const [tsAst, setTsAST] = useState<SourceFile | string | null>();
const [scope, setScope] = useState<Record<string, unknown> | string | null>();
Expand DownExpand Up@@ -83,7 +83,7 @@ function Playground(): JSX.Element {
jsx={state.jsx}
code={state.code}
tsConfig={state.tsConfig}
darkTheme={isDarkTheme}
darkTheme={colorMode === 'dark'}
sourceType={state.sourceType}
rules={state.rules}
showAST={state.showAST}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ export const useSandboxServices = (
): Error | SandboxServices | undefined => {
const [services, setServices] = useState<Error | SandboxServices>();
const [loadedTs, setLoadedTs] = useState<string>(props.ts);
const {isDarkTheme } = useColorMode();
const {colorMode } = useColorMode();

useEffect(() => {
if (props.ts !== loadedTs) {
Expand DownExpand Up@@ -77,7 +77,7 @@ export const useSandboxServices = (
ts,
);
sandboxInstance.monaco.editor.setTheme(
isDarkTheme ? 'vs-dark' : 'vs-light',
colorMode === 'dark' ? 'vs-dark' : 'vs-light',
);

const libMap = await sandboxInstance.tsvfs.createDefaultMapFromCDN(
Expand Down
49 changes: 37 additions & 12 deletionspackages/website/src/components/lib/markdown.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,25 +29,50 @@ function createSummaryJson(
return '';
}

export function genVersions(state: ConfigModel): string {
return [
'| package | version |',
'| -- | -- |',
`| \`@typescript-eslint/eslint-plugin\` | \`${process.env.TS_ESLINT_VERSION}\` |`,
`| \`@typescript-eslint/parser\` | \`${process.env.TS_ESLINT_VERSION}\` |`,
`| \`TypeScript\` | \`${state.ts}\` |`,
`| \`ESLint\` | \`${process.env.ESLINT_VERSION}\` |`,
`| \`node\` | \`web\` |`,
].join('\n');
}

export function createMarkdown(state: ConfigModel): string {
return [
'## Repro',
`[Playground](${document.location.toString()})`,
createSummary(state.code, 'Code', 'ts', 30),
createSummaryJson(state.rules, 'rules', 'Eslint config'),
createSummaryJson(state.tsConfig, 'compilerOptions', 'TypeScript config'),
'## Expected Result\n',
'## Actual Result\n',
'## Additional Info\n',
'## Versions',
`| package | version |
| ---------------------------------- | ------- |
| \`@typescript-eslint/eslint-plugin\` | \`${process.env.TS_ESLINT_VERSION}\` |
| \`@typescript-eslint/parser\` | \`${process.env.TS_ESLINT_VERSION}\` |
| \`TypeScript\` | \`${state.ts}\` |
| \`ESLint\` | \`${process.env.ESLINT_VERSION}\` |
| \`Env\` | \`web\` |`,
genVersions(state),
]
.filter(Boolean)
.join('\n\n');
}

export function createMarkdownParams(state: ConfigModel): string {
const params = {
template: '1-bug-report-plugin.yaml',
title: 'Bug: [rule name here] <short description of the issue>',
'playground-link': document.location.toString(),
'repro-code': state.code,
'eslint-config':
`module.exports = ` +
JSON.stringify(
{ parser: '@typescript-eslint/parser', rules: state.rules },
null,
2,
),
'typescript-config': JSON.stringify(
{ compilerOptions: state.tsConfig },
null,
2,
),
versions: genVersions(state),
};

return new URLSearchParams(params).toString();
}

[8]ページ先頭

©2009-2025 Movatter.jp