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): surface internal errors in playground#5462

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
JoshuaKGoldberg merged 1 commit intotypescript-eslint:mainfromJosh-Cena:pg-error
Aug 10, 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
13 changes: 12 additions & 1 deletionpackages/website/src/components/ErrorsViewer.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@ import IconExternalLink from '@theme/IconExternalLink';
import styles from './ErrorsViewer.module.css';

export interface ErrorsViewerProps {
readonly value?: ErrorGroup[];
readonly value?: ErrorGroup[] | Error;
}

export interface ErrorBlockProps {
Expand DownExpand Up@@ -100,6 +100,17 @@ export default function ErrorsViewer({
setIsLocked(false);
}, [value]);

if (value && !Array.isArray(value)) {
return (
<div className={styles.list}>
<div className="margin-top--sm">
<h4>ESLint internal error</h4>
{value?.stack}
</div>
</div>
);
}

return (
<div className={styles.list}>
{value?.map(({ group, uri, items }) => {
Expand Down
2 changes: 1 addition & 1 deletionpackages/website/src/components/Playground.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ function Playground(): JSX.Element {
const [esAst, setEsAst] = useState<TSESTree.Program | null>();
const [tsAst, setTsAST] = useState<SourceFile | null>();
const [scope, setScope] = useState<Record<string, unknown> | null>();
const [markers, setMarkers] = useState<ErrorGroup[]>();
const [markers, setMarkers] = useState<ErrorGroup[] | Error>();
const [ruleNames, setRuleNames] = useState<RuleDetails[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [tsVersions, setTSVersion] = useState<readonly string[]>([]);
Expand Down
30 changes: 18 additions & 12 deletionspackages/website/src/components/editor/LoadedEditor.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -127,21 +127,27 @@ export const LoadedEditor: React.FC<LoadedEditorProps> = ({

webLinter.updateParserOptions(jsx, sourceType);

const messages = webLinter.lint(code);
try {
const messages = webLinter.lint(code);

const markers = parseLintResults(messages, codeActions, ruleId =>
sandboxInstance.monaco.Uri.parse(webLinter.rulesUrl.get(ruleId) ?? ''),
);
const markers = parseLintResults(messages, codeActions, ruleId =>
sandboxInstance.monaco.Uri.parse(
webLinter.rulesUrl.get(ruleId) ?? '',
),
);

sandboxInstance.monaco.editor.setModelMarkers(
tabs.code,
'eslint',
markers,
);
sandboxInstance.monaco.editor.setModelMarkers(
tabs.code,
'eslint',
markers,
);

// fallback when event is not preset, ts < 4.0.5
if (!sandboxInstance.monaco.editor.onDidChangeMarkers) {
updateMarkers();
// fallback when event is not preset, ts < 4.0.5
if (!sandboxInstance.monaco.editor.onDidChangeMarkers) {
updateMarkers();
}
} catch (e) {
onMarkersChange(e as Error);
}

onEsASTChange(webLinter.storedAST);
Expand Down
2 changes: 1 addition & 1 deletionpackages/website/src/components/editor/types.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,6 @@ export interface CommonEditorProps extends ConfigModel {
readonly onTsASTChange: (value: undefined | SourceFile) => void;
readonly onEsASTChange: (value: undefined | TSESTree.Program) => void;
readonly onScopeChange: (value: undefined | Record<string, unknown>) => void;
readonly onMarkersChange: (value: ErrorGroup[]) => void;
readonly onMarkersChange: (value: ErrorGroup[] | Error) => void;
readonly onSelect: (position: Monaco.Position | null) => void;
}

[8]ページ先頭

©2009-2025 Movatter.jp