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

Revert "chore(website): align file names to RuleTester requirements"#9327

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 intomainfromrevert-9271-website-file-names-align
Jun 11, 2024
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
10 changes: 3 additions & 7 deletionspackages/website/src/components/editor/LoadedEditor.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,11 +13,7 @@ import {
} from '../lib/jsonSchema';
import { parseTSConfig, tryParseEslintModule } from '../lib/parseConfig';
import type { LintCodeAction } from '../linter/utils';
import {
createFileName,
parseLintResults,
parseMarkers,
} from '../linter/utils';
import { parseLintResults, parseMarkers } from '../linter/utils';
import type { TabType } from '../types';
import { createProvideCodeActions } from './createProvideCodeActions';
import type { CommonEditorProps } from './types';
Expand DownExpand Up@@ -93,7 +89,7 @@ export const LoadedEditor: React.FC<LoadedEditorProps> = ({
}, [webLinter, sourceType]);

useEffect(() => {
const newPath =createFileName(fileType);
const newPath =`/input${fileType}`;
if (tabs.code.uri.path !== newPath) {
const code = tabs.code.getValue();
const newModel = monaco.editor.createModel(
Expand DownExpand Up@@ -244,7 +240,7 @@ export const LoadedEditor: React.FC<LoadedEditorProps> = ({
system.watchFile('/.eslintrc', filename => {
onChange({ eslintrc: system.readFile(filename) });
}),
system.watchFile('/{file,react}.*', filename => {
system.watchFile('/input.*', filename => {
onChange({ code: system.readFile(filename) });
}),
];
Expand Down
4 changes: 2 additions & 2 deletionspackages/website/src/components/linter/bridge.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ import type * as ts from 'typescript';
import { debounce } from '../lib/debounce';
import type { ConfigModel } from '../types';
import type { PlaygroundSystem } from './types';
import {createFileName,getPathRegExp } from './utils';
import { getPathRegExp } from './utils';

export function createFileSystem(
config: Pick<ConfigModel, 'code' | 'eslintrc' | 'fileType' | 'tsconfig'>,
Expand All@@ -13,7 +13,7 @@ export function createFileSystem(
const files = new Map<string, string>();
files.set(`/.eslintrc`, config.eslintrc);
files.set(`/tsconfig.json`, config.tsconfig);
files.set(createFileName(config.fileType), config.code);
files.set(`/input${config.fileType}`, config.code);

const fileWatcherCallbacks = new Map<RegExp, Set<ts.FileWatcherCallback>>();

Expand Down
4 changes: 2 additions & 2 deletionspackages/website/src/components/linter/createLinter.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,10 +164,10 @@ export function createLinter(
};

const triggerLintAll = (): void => {
system.searchFiles('/{file,react}.*').forEach(triggerLint);
system.searchFiles('/input.*').forEach(triggerLint);
};

system.watchFile('/{file,react}.*', triggerLint);
system.watchFile('/input.*', triggerLint);
system.watchFile('/.eslintrc', filename => {
applyEslintConfig(filename);
triggerLintAll();
Expand Down
3 changes: 1 addition & 2 deletionspackages/website/src/components/linter/createParser.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,6 @@ import type {
UpdateModel,
WebLinterModule,
} from './types';
import { createFileName } from './utils';

export function createParser(
system: PlaygroundSystem,
Expand DownExpand Up@@ -44,7 +43,7 @@ export function createParser(
text: string,
options: ParserOptions = {},
): Parser.ParseResult => {
const filePath = options.filePath ??createFileName('.ts');
const filePath = options.filePath ??'/input.ts';

// if text is empty use empty line to avoid error
const code = text || '\n';
Expand Down
7 changes: 0 additions & 7 deletionspackages/website/src/components/linter/utils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,13 +48,6 @@ export function createEditOperation(
};
}

/**
* @see https://typescript-eslint.io/packages/rule-tester/#type-aware-testing
*/
export function createFileName(extension = '.ts'): string {
return `/${extension.endsWith('sx') ? 'react' : 'file'}.${extension}`;
}

function normalizeCode(code: Monaco.editor.IMarker['code']): {
value: string;
target?: string;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp