Skip to content

Commit 380cbe5

Browse files
committed
Revert "fix(cli): preserve check file scope in fix hint"
This reverts commit b2a5d56.
1 parent b2a5d56 commit 380cbe5

2 files changed

Lines changed: 6 additions & 28 deletions

File tree

packages/rstack/src/cli/commands.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,6 @@ async function runRspressCLI(args: string[]): Promise<void> {
141141

142142
const RSLINT_CONFIG_PATH = join(import.meta.dirname, 'rslintConfig.js');
143143

144-
const SHELL_SAFE_ARGUMENT_REGEXP = /^[\w@%+=:,./-]+$/u;
145-
146-
const quoteShellArgument = (argument: string): string =>
147-
SHELL_SAFE_ARGUMENT_REGEXP.test(argument)
148-
? argument
149-
: `'${argument.replaceAll("'", "'\"'\"'")}'`;
150-
151-
const formatCommand = (args: readonly string[]): string =>
152-
args.map(quoteShellArgument).join(' ');
153-
154144
async function runRslintCLI(args: string[]): Promise<void> {
155145
if (hasHelpFlag(args)) {
156146
return printCommandHelp('lint');
@@ -202,7 +192,7 @@ async function runCheckCLI(args: string[]): Promise<void> {
202192
'../fmt/cli.ts'
203193
);
204194
await runFmtCLI(['--check', ...fileArgs], {
205-
fixCommand: formatCommand(['rs', 'fmt', ...fileArgs]),
195+
fixCommand: 'rs fmt',
206196
loadedConfig,
207197
});
208198
}

packages/rstack/tests/cli/check.test.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,16 @@ test('passes file arguments to lint and the formatting check', () => {
6363
expect(result.stderr).toBe('');
6464
});
6565

66-
test('preserves file arguments in the formatting fix command', () => {
67-
writeLintConfig();
68-
writeProjectFile("src/selected file's.ts", 'const selected=true');
69-
70-
const result = runCheck(["src/selected file's.ts"]);
71-
72-
expect(result.status).toBe(1);
73-
expect(result.stderr).toContain(
74-
`Run rs fmt -- 'src/selected file'"'"'s.ts' to fix.`,
75-
);
76-
});
77-
7866
test('supports file arguments after the option terminator', () => {
7967
writeLintConfig();
80-
writeProjectFile('--selected.ts', 'const selected=true');
68+
writeProjectFile('--selected.ts', 'const selected = true;\n');
8169

8270
const result = runCheck(['--', '--selected.ts']);
8371

84-
expect(result.status).toBe(1);
85-
expect(result.stderr).toContain(
86-
'Formatting issues found in 1 file. Run rs fmt -- --selected.ts to fix.',
87-
);
72+
expect(result.status).toBe(0);
73+
expect(result.stdout).toContain('Format check passed in');
74+
expect(result.stdout).toContain('(1 file)');
75+
expect(result.stderr).toBe('');
8876
});
8977

9078
test('enables type checking only with --type-check', () => {

0 commit comments

Comments
 (0)