Skip to content

Commit

Permalink
feat: cleanup file-progress spinner output
Browse files Browse the repository at this point in the history
Closes #265

Signed-off-by: Dirk de Visser <github@dirkdevisser.nl>
  • Loading branch information
dirkdev98 committed Oct 8, 2024
1 parent ebe2c88 commit 873f25e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/eslint-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint";
import gitignore from "eslint-config-flat-gitignore";
// @ts-expect-error no types available
import pluginFileProgress from "eslint-plugin-file-progress";
import { defineGlobals } from "./globals.js";
import type { GlobalsConfig } from "./globals.js";
import { globUseFromUserConfig } from "./globs.js";
Expand All @@ -10,6 +8,7 @@ import { javascript } from "./javascript.js";
import { markdownConfig, markdownSnippetOverrides } from "./markdown.js";
import { prettierConfig } from "./prettier.js";
import type { PrettierConfig } from "./prettier.js";
import { progress } from "./progress.js";
import type { ReactConfig } from "./react.js";
import { typescript, typescriptResolveConfig } from "./typescript.js";
import type { TypeScriptConfig } from "./typescript.js";
Expand Down Expand Up @@ -52,17 +51,7 @@ export async function defineConfig(
},
},
...defineGlobals(opts.globals),

{
// Show a friendly spinner.
files: ["**/*"],
plugins: {
"file-progress": pluginFileProgress as unknown as FlatConfig.Plugin,
},
rules: {
"file-progress/activate": "warn",
},
},
...progress(),

// Language specifics
...markdownConfig(),
Expand Down
39 changes: 39 additions & 0 deletions packages/eslint-config/src/progress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type { FlatConfig } from "@typescript-eslint/utils/ts-eslint";
// @ts-expect-error no types available
import pluginFileProgress from "eslint-plugin-file-progress";
import { globMarkdownSnippetFromGlob, globUse } from "./globs.js";

export function progress(): Array<FlatConfig.Config> {
if (process.env.CI === "true") {
return [];
}

return [
{
// Show a friendly spinner.
files: ["**/*"],
plugins: {
"file-progress": pluginFileProgress as unknown as FlatConfig.Plugin,
},
rules: {
"file-progress/activate": "warn",
},
},

{
// Don't show snippets in the progress-spinner.
files: globUse([globMarkdownSnippetFromGlob("**/*")]),
rules: {
"file-progress/activate": "off",
},
},

{
// Don't show virtual format files in the progress-spinner.
files: ["**/*.*/**/*.format"],
rules: {
"file-progress/activate": "off",
},
},
];
}

0 comments on commit 873f25e

Please sign in to comment.