Remove dirty checks - fixes
MODIFY
packages/@romejs/cli/cli.ts
packages/@romejs/cli/cli.ts
@@ -110,9 +110,6 @@ export default async function cli() {
review: c.get('review').asBoolean(
DEFAULT_CLIENT_REQUEST_FLAGS.review,
),
- allowDirty: c.get('allowDirty').asBoolean(
- DEFAULT_CLIENT_REQUEST_FLAGS.allowDirty,
- ),
watch: c.get('watch').asBoolean(DEFAULT_CLIENT_REQUEST_FLAGS.watch),
fieri: c.get('fieri').asBoolean(DEFAULT_CLIENT_REQUEST_FLAGS.fieri),
focus: c.get('focus').asString(DEFAULT_CLIENT_REQUEST_FLAGS.focus),

MODIFY
packages/@romejs/core/client/review.ts
packages/@romejs/core/client/review.ts
@@ -15,8 +15,6 @@ import {
} from '@romejs/diagnostics';
import {MasterQueryResponse} from '../common/bridges/MasterBridge';
import {ClientRequestFlags} from '../common/types/client';
-import {localCommands} from './commands';
-import {masterCommands} from '../master/commands';
import {Dict} from '@romejs/typescript-helpers';
import {EMPTY_SUCCESS_RESPONSE} from '../master/MasterRequest';
@@ -144,17 +142,6 @@ async function check(
...action.requestFlags,
};
- // If this command allows the allowDirty flag then set it
- // The validation of the flag would have happened with the initial query
- // Also pretty sure the presence of `commandDef === undefined` is an error
- const commandDef = localCommands.get(action.command) || masterCommands.get(
- action.command,
- );
- if (commandDef !== undefined && commandDef.allowRequestFlags !== undefined &&
- commandDef.allowRequestFlags.includes('allowDirty')) {
- requestFlags.allowDirty = true;
- }
-
// Execute action
const actionRes = await client.query({
command: action.command,

MODIFY
packages/@romejs/core/master/Master.ts
packages/@romejs/core/master/Master.ts
@@ -113,7 +113,6 @@ async function validateRequestFlags(
// Commands need to explicitly allow these flags
validateAllowedRequestFlag(req, 'watch', masterCommand);
validateAllowedRequestFlag(req, 'review', masterCommand);
- validateAllowedRequestFlag(req, 'allowDirty', masterCommand);
// Don't allow review in combination with other flags
if (requestFlags.review) {

MODIFY
packages/@romejs/core/master/MasterRequest.ts
packages/@romejs/core/master/MasterRequest.ts
@@ -265,26 +265,6 @@ export default class MasterRequest {
);
}
- async assertCleanVSC() {
- if (this.query.requestFlags.allowDirty) {
- return;
- }
-
- const vsc = await this.maybeGetVCSClient();
- if (vsc === undefined) {
- return;
- }
-
- const files = await vsc.getUncommittedFiles();
- if (files.length > 0) {
- this.throwDiagnosticFlagError({
- description: descriptions.FLAGS.DIRTY_VSC(files),
- target: {type: 'command'},
- showHelp: false,
- });
- }
- }
-
createDiagnosticsProcessor(
opts: DiagnosticsProcessorOptions = {},
): DiagnosticsProcessor {

MODIFY
packages/@romejs/core/master/commands/ci.ts
packages/@romejs/core/master/commands/ci.ts
@@ -43,7 +43,6 @@ export default createMasterCommand({
description: 'run lint and tests',
usage: '',
examples: [],
- allowRequestFlags: ['allowDirty'],
defineFlags(consumer: Consumer): Flags {
return {
@@ -54,10 +53,6 @@ export default createMasterCommand({
async callback(req: MasterRequest, flags: Flags): Promise<void> {
const {reporter} = req;
- if (flags.fix) {
- await req.assertCleanVSC();
- }
-
reporter.heading('Running lint');
await runChildCommand(req, async () => {
await lint.callback(req, {

MODIFY
packages/@romejs/core/master/commands/lint.ts
packages/@romejs/core/master/commands/lint.ts
@@ -23,7 +23,7 @@ type Flags = {
export default createMasterCommand<Flags>({
category: commandCategories.CODE_QUALITY,
description: 'run lint against a set of files',
- allowRequestFlags: ['watch', 'review', 'allowDirty'],
+ allowRequestFlags: ['watch', 'review'],
usage: '',
examples: [],
@@ -84,11 +84,6 @@ export default createMasterCommand<Flags>({
};
const linter = new Linter(req, opts);
-
- if (linter.shouldSave()) {
- await req.assertCleanVSC();
- }
-
await linter.run(req.query.requestFlags.watch);
},
});

MODIFY
packages/@romejs/diagnostics/descriptions.ts
packages/@romejs/diagnostics/descriptions.ts
@@ -147,29 +147,6 @@ export const descriptions = createMessages(
],
}),
- DIRTY_VSC: (files: Array<string>) => ({
- message: 'You have uncommitted files. This operation can modify files. For your safety we recommend committing before running this command.',
- category: 'vsc/dirty',
- advice: [
- {
- type: 'log',
- category: 'info',
- message: 'If you really want to do this then you can bypass this restriction with the <command>--allow-dirty</command> flag',
- },
- {
- type: 'log',
- category: 'warn',
- message: 'These files are uncommitted',
- },
- {
- type: 'list',
- list: files.map(
- (filename) => markup`<filelink target="${filename}" />`,
- ),
- },
- ],
- }),
-
INCORRECT_ARG_COUNT: (excessive: boolean, message: string) => ({
message: excessive ? 'Too many arguments' : 'Missing arguments',
advice: [

Remove dirty checks - fixes #326