Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose eslint --cache flag #891

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface Options {
no: boolean;
logger: Logger;
yarn?: boolean;
cache?: boolean;
}

export type VerbFilesFunction = (
Expand Down Expand Up @@ -65,6 +66,7 @@ const cli = meow({
-n, --no Assume a no answer for every prompt.
--dry-run Don't make any actual changes.
--yarn Use yarn instead of npm.
--cache Only check changed files

Examples
$ gts init -y
Expand All @@ -78,6 +80,7 @@ const cli = meow({
no: {type: 'boolean', alias: 'n'},
dryRun: {type: 'boolean'},
yarn: {type: 'boolean'},
cache: {type: 'boolean'},
},
});

Expand Down Expand Up @@ -118,6 +121,7 @@ export async function run(verb: string, files: string[]): Promise<boolean> {
no: cli.flags.no || cli.flags.n || false,
logger,
yarn: cli.flags.yarn || isYarnUsed(),
cache: cli.flags.cache || false,
} as Options;
// Linting/formatting depend on typescript. We don't want to load the
// typescript module during init, since it might not exist.
Expand All @@ -137,6 +141,10 @@ export async function run(verb: string, files: string[]): Promise<boolean> {
);
}

if (options.cache) {
flags.push('--cache');
}

switch (verb) {
case 'lint':
case 'check': {
Expand Down
Loading