Skip to content
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
14 changes: 2 additions & 12 deletions packages/rstack/src/fmt/yukuPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,7 @@ const parseJavaScript = (
);
const { program, comments } = tryCombinations(combinations);

return postprocess(
program as unknown as AstNode,
comments as PrettierComment[],
text,
'yuku-js',
);
return postprocess(program as unknown as AstNode, comments, text, 'yuku-js');
};

const parseTypeScript = (
Expand All @@ -581,12 +576,7 @@ const parseTypeScript = (
);
const { program, comments } = tryCombinations(combinations);

return postprocess(
program as unknown as AstNode,
comments as PrettierComment[],
text,
'yuku-ts',
);
return postprocess(program as unknown as AstNode, comments, text, 'yuku-ts');
};

const createParser = (
Expand Down
3 changes: 1 addition & 2 deletions packages/rstack/tests/fmt/cacheIdentity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import type { ResolvedFmtOptions } from '../../src/fmt/types.ts';

const rootPath = path.join(import.meta.dirname, 'project');

const asOptions = (value: Record<string, unknown>): ResolvedFmtOptions =>
value as ResolvedFmtOptions;
const asOptions = (value: Record<string, unknown>): ResolvedFmtOptions => value;

test('creates stable SHA-256-derived option hashes', () => {
const hashOptions = createOptionsHasher();
Expand Down
32 changes: 14 additions & 18 deletions packages/rstack/tests/fmt/yukuPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,24 +332,20 @@ test('matches the official hashbang AST shape', async () => {
});

test('reports Yuku diagnostics with Prettier locations', async () => {
try {
await formatWithYuku('\n\nconst = 1', { parser: 'yuku-ts' });
throw new Error('Expected Yuku to report a syntax error.');
} catch (error) {
if (!(error instanceof SyntaxError)) {
throw error;
}
const error = await formatWithYuku('\n\nconst = 1', {
parser: 'yuku-ts',
}).catch((error: unknown) => error);
expect(error).toBeInstanceOf(SyntaxError);

const parseError = error as SyntaxError & {
loc: {
end: { column: number; line: number };
start: { column: number; line: number };
};
const parseError = error as SyntaxError & {
loc: {
end: { column: number; line: number };
start: { column: number; line: number };
};
expect(Object.keys(parseError.loc)).toEqual(['start', 'end']);
expect(parseError.loc).toEqual({
start: { column: 7, line: 3 },
end: { column: 8, line: 3 },
});
}
};
expect(Object.keys(parseError.loc)).toEqual(['start', 'end']);
expect(parseError.loc).toEqual({
start: { column: 7, line: 3 },
end: { column: 8, line: 3 },
});
});
2 changes: 2 additions & 0 deletions packages/rstack/tests/setup/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ test('installs generated hooks and configures the repository', () => {
const filePath = path.join(directory, name);
expect(readFileSync(filePath, 'utf8')).toBe(content);
if (process.platform !== 'win32') {
// The platform guard intentionally skips POSIX permissions on Windows.
// rslint-disable-next-line rstest/no-conditional-expect
expect(statSync(filePath).mode & 0o777).toBe(0o755);
}
}
Expand Down
76 changes: 38 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ catalog:
'@rsbuild/plugin-react': '^2.1.0'
'@rsbuild/plugin-sass': '^2.0.1'
'@rslib/core': '~1.0.0'
'@rslint/core': '0.9.0'
'@rslint/core': '0.9.1'
'@rspress/core': '^2.0.21'
'@rspress/plugin-client-redirects': '^2.0.21'
'@rspress/plugin-sitemap': '^2.0.21'
Expand Down
7 changes: 7 additions & 0 deletions rstack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ define.lint(({ globals, js, ts, rstestPlugin }) => {
{
files: ['**/*.test.{ts,tsx}'],
...rstestPlugin.configs.recommended,
rules: {
'rstest/expect-expect': ['error', { assertFunctionNames: ['expect*'] }],
'rstest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['test'] },
],
},
},
// Source imports use .ts for Node.js native TypeScript execution; builds rewrite them to .js.
{
Expand Down