knip 5.60.1 → 5.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -83,6 +83,7 @@ export declare class ConfigurationChief {
83
83
  astro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
84
84
  ava?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
85
85
  babel?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
86
+ biome?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
86
87
  bun?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
87
88
  c8?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
88
89
  capacitor?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -34,6 +34,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
34
34
  entry?: string | string[] | undefined;
35
35
  project?: string | string[] | undefined;
36
36
  } | undefined;
37
+ biome?: string | boolean | string[] | {
38
+ config?: string | string[] | undefined;
39
+ entry?: string | string[] | undefined;
40
+ project?: string | string[] | undefined;
41
+ } | undefined;
37
42
  bun?: string | boolean | string[] | {
38
43
  config?: string | string[] | undefined;
39
44
  entry?: string | string[] | undefined;
@@ -590,6 +595,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
590
595
  entry?: string | string[] | undefined;
591
596
  project?: string | string[] | undefined;
592
597
  } | undefined;
598
+ biome?: string | boolean | string[] | {
599
+ config?: string | string[] | undefined;
600
+ entry?: string | string[] | undefined;
601
+ project?: string | string[] | undefined;
602
+ } | undefined;
593
603
  bun?: string | boolean | string[] | {
594
604
  config?: string | string[] | undefined;
595
605
  entry?: string | string[] | undefined;
@@ -0,0 +1,10 @@
1
+ import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
+ import type { BiomeConfig } from './types.js';
3
+ declare const _default: {
4
+ title: string;
5
+ enablers: string[];
6
+ isEnabled: IsPluginEnabled;
7
+ config: string[];
8
+ resolveConfig: ResolveConfig<BiomeConfig>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { toConfig } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ const title = 'Biome';
4
+ const enablers = ['@biomejs/biome', 'biome'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const config = ['biome.json', 'biome.jsonc'];
7
+ const resolveExtends = (extendsArray, options) => {
8
+ return extendsArray.map(specifier => {
9
+ if (specifier.endsWith('.json') || specifier.endsWith('.jsonc')) {
10
+ return toConfig('biome', specifier);
11
+ }
12
+ return toConfig('biome', specifier, { containingFilePath: options.configFilePath });
13
+ });
14
+ };
15
+ const resolveConfig = (config, options) => {
16
+ return [...resolveExtends(config.extends || [], options)];
17
+ };
18
+ export default {
19
+ title,
20
+ enablers,
21
+ isEnabled,
22
+ config,
23
+ resolveConfig,
24
+ };
@@ -0,0 +1,3 @@
1
+ export type BiomeConfig = {
2
+ extends?: string[];
3
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -31,6 +31,13 @@ export declare const Plugins: {
31
31
  config: string[];
32
32
  resolveConfig: import("../types/config.js").ResolveConfig<import("./babel/types.js").BabelConfig>;
33
33
  };
34
+ biome: {
35
+ title: string;
36
+ enablers: string[];
37
+ isEnabled: import("../types/config.js").IsPluginEnabled;
38
+ config: string[];
39
+ resolveConfig: import("../types/config.js").ResolveConfig<import("./biome/types.js").BiomeConfig>;
40
+ };
34
41
  bun: {
35
42
  title: string;
36
43
  enablers: string[];
@@ -2,6 +2,7 @@ import { default as angular } from './angular/index.js';
2
2
  import { default as astro } from './astro/index.js';
3
3
  import { default as ava } from './ava/index.js';
4
4
  import { default as babel } from './babel/index.js';
5
+ import { default as biome } from './biome/index.js';
5
6
  import { default as bun } from './bun/index.js';
6
7
  import { default as c8 } from './c8/index.js';
7
8
  import { default as capacitor } from './capacitor/index.js';
@@ -111,6 +112,7 @@ export const Plugins = {
111
112
  astro,
112
113
  ava,
113
114
  babel,
115
+ biome,
114
116
  bun,
115
117
  c8,
116
118
  capacitor,
@@ -6,8 +6,13 @@ const packageJsonPath = (id) => id;
6
6
  const resolveConfig = localConfig => {
7
7
  const scripts = localConfig.scripts;
8
8
  const entries = [toProductionEntry('server.js')];
9
- if (scripts && Object.keys(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(scripts[script]))) {
10
- const patterns = ['**/*{.,-,_}test.?(c|m)js', '**/test-*.?(c|m)js', '**/test.?(c|m)js', '**/test/**/*.?(c|m)js'];
9
+ if (scripts && Object.values(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(script))) {
10
+ const patterns = [
11
+ '**/*{.,-,_}test.{cjs,mjs,js,cts,mts,ts}',
12
+ '**/test-*.{cjs,mjs,js,cts,mts,ts}',
13
+ '**/test.{cjs,mjs,js,cts,mts,ts}',
14
+ '**/test/**/*.{cjs,mjs,js,cts,mts,ts}',
15
+ ];
11
16
  entries.push(...patterns.map(id => toEntry(id)));
12
17
  }
13
18
  return entries;
@@ -1,8 +1,10 @@
1
1
  import { existsSync } from 'node:fs';
2
+ import os from 'node:os';
2
3
  import { toEntry } from '../../util/input.js';
3
4
  import { join } from '../../util/path.js';
4
5
  import { hasDependency, load } from '../../util/plugin.js';
5
6
  import vite from '../vite/index.js';
7
+ const isWindows = os.platform() === 'win32';
6
8
  const title = 'React Router';
7
9
  const enablers = ['@react-router/dev'];
8
10
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -26,7 +28,7 @@ const resolveConfig = async (localConfig, options) => {
26
28
  };
27
29
  const routes = routeConfig
28
30
  .flatMap(mapRoute)
29
- .map(route => route.replace(/[$^*+?()\[\]]/g, '\\$&'));
31
+ .map(route => (isWindows ? route : route.replace(/[$^*+?()\[\]]/g, '\\$&')));
30
32
  return [
31
33
  join(appDir, 'routes.{js,ts}'),
32
34
  join(appDir, 'root.{jsx,tsx}'),
@@ -8,7 +8,7 @@ const packageJsonPath = (id) => id;
8
8
  const resolveConfig = localConfig => {
9
9
  const scripts = localConfig.scripts;
10
10
  const entries = [];
11
- if (scripts && Object.keys(scripts).some(script => /(?<=^|\s)tsx\s(.*)--test/.test(scripts[script]))) {
11
+ if (scripts && Object.values(scripts).some(script => /(?<=^|\s)tsx\s(.*)--test/.test(script))) {
12
12
  const patterns = [
13
13
  '**/*{.,-,_}test.?(c|m)(j|t)s',
14
14
  '**/test-*.?(c|m)(j|t)s',
@@ -10,11 +10,7 @@ const config = ['vitest.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,proj
10
10
  const mocks = ['**/__mocks__/**/*.[jt]s?(x)'];
11
11
  const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)', ...mocks];
12
12
  const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
13
- const hasScriptWithCoverage = (scripts) => scripts
14
- ? Object.values(scripts).some(script => {
15
- return isVitestCoverageCommand.test(script);
16
- })
17
- : false;
13
+ const hasScriptWithCoverage = (scripts) => scripts ? Object.values(scripts).some(script => isVitestCoverageCommand.test(script)) : false;
18
14
  const findConfigDependencies = (localConfig, options) => {
19
15
  const { manifest, cwd: dir } = options;
20
16
  const testConfig = localConfig.test;
@@ -4,7 +4,7 @@ import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
4
4
  const title = 'Vue';
5
5
  const enablers = ['vue'];
6
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
- const config = ['vue.config.{js,ts}'];
7
+ const config = ['vue.config.{js,ts,mjs}'];
8
8
  const resolveConfig = async (config, options) => {
9
9
  const { manifest } = options;
10
10
  const inputs = [];
@@ -8,7 +8,7 @@ const unused = (options) => `Remove from ${type(options.type)}${options.workspac
8
8
  const empty = (options) => `Refine ${type(options.type)}${workspace(options)}: ${id(options.identifier)} (no files found)`;
9
9
  const remove = (options) => `Remove ${type(options.type)}${workspace(options)}: ${id(options.identifier)}`;
10
10
  const add = (options) => `Add to or refine in ${yellow('workspaces')}: ${id(options.identifier)} (${options.size} unused files)`;
11
- const topLevel = (options) => `Remove or move unused top-level ${type(options.type)} to ${yellow('"."')}: ${id(options.identifier)}`;
11
+ const topLevel = (options) => `Remove or move unused top-level ${type(options.type)} to ${yellow('"."')} workspace: ${id(options.identifier)}`;
12
12
  const hintPrinters = new Map([
13
13
  ['ignoreBinaries', { print: unused }],
14
14
  ['ignoreDependencies', { print: unused }],
@@ -41,11 +41,13 @@ export const printConfigurationHints = ({ counters, issues, tagHints, configurat
41
41
  }
42
42
  }
43
43
  if (configurationHints.size > 0) {
44
+ const isTopLevel = (type) => type.includes('top-level');
45
+ const hintOrderer = (a, b) => isTopLevel(a.type) && !isTopLevel(b.type) ? -1 : !isTopLevel(a.type) && isTopLevel(b.type) ? 1 : 0;
44
46
  const getTitle = isTreatConfigHintsAsErrors ? getColoredTitle : getDimmedTitle;
45
47
  const style = isTreatConfigHintsAsErrors ? plain : dim;
46
48
  console.log(getTitle('Configuration hints', configurationHints.size));
47
49
  const isRootOnly = includedWorkspaces.length === 1 && includedWorkspaces[0].name === '.';
48
- for (const hint of configurationHints) {
50
+ for (const hint of Array.from(configurationHints).sort(hintOrderer)) {
49
51
  const hintPrinter = hintPrinters.get(hint.type);
50
52
  if (hintPrinter)
51
53
  console.warn(style(hintPrinter.print({ ...hint, isRootOnly })));
@@ -85,6 +85,19 @@ export declare const knipConfigurationSchema: z.ZodObject<{
85
85
  entry?: string | string[] | undefined;
86
86
  project?: string | string[] | undefined;
87
87
  }>]>>;
88
+ biome: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
89
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
90
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
91
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ config?: string | string[] | undefined;
94
+ entry?: string | string[] | undefined;
95
+ project?: string | string[] | undefined;
96
+ }, {
97
+ config?: string | string[] | undefined;
98
+ entry?: string | string[] | undefined;
99
+ project?: string | string[] | undefined;
100
+ }>]>>;
88
101
  bun: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
89
102
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
90
103
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1465,6 +1478,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
1465
1478
  entry?: string | string[] | undefined;
1466
1479
  project?: string | string[] | undefined;
1467
1480
  } | undefined;
1481
+ biome?: string | boolean | string[] | {
1482
+ config?: string | string[] | undefined;
1483
+ entry?: string | string[] | undefined;
1484
+ project?: string | string[] | undefined;
1485
+ } | undefined;
1468
1486
  bun?: string | boolean | string[] | {
1469
1487
  config?: string | string[] | undefined;
1470
1488
  entry?: string | string[] | undefined;
@@ -2015,6 +2033,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
2015
2033
  entry?: string | string[] | undefined;
2016
2034
  project?: string | string[] | undefined;
2017
2035
  } | undefined;
2036
+ biome?: string | boolean | string[] | {
2037
+ config?: string | string[] | undefined;
2038
+ entry?: string | string[] | undefined;
2039
+ project?: string | string[] | undefined;
2040
+ } | undefined;
2018
2041
  bun?: string | boolean | string[] | {
2019
2042
  config?: string | string[] | undefined;
2020
2043
  entry?: string | string[] | undefined;
@@ -2591,6 +2614,19 @@ export declare const knipConfigurationSchema: z.ZodObject<{
2591
2614
  entry?: string | string[] | undefined;
2592
2615
  project?: string | string[] | undefined;
2593
2616
  }>]>>;
2617
+ biome: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
2618
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2619
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2620
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2621
+ }, "strip", z.ZodTypeAny, {
2622
+ config?: string | string[] | undefined;
2623
+ entry?: string | string[] | undefined;
2624
+ project?: string | string[] | undefined;
2625
+ }, {
2626
+ config?: string | string[] | undefined;
2627
+ entry?: string | string[] | undefined;
2628
+ project?: string | string[] | undefined;
2629
+ }>]>>;
2594
2630
  bun: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
2595
2631
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2596
2632
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -3974,6 +4010,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
3974
4010
  entry?: string | string[] | undefined;
3975
4011
  project?: string | string[] | undefined;
3976
4012
  } | undefined;
4013
+ biome?: string | boolean | string[] | {
4014
+ config?: string | string[] | undefined;
4015
+ entry?: string | string[] | undefined;
4016
+ project?: string | string[] | undefined;
4017
+ } | undefined;
3977
4018
  bun?: string | boolean | string[] | {
3978
4019
  config?: string | string[] | undefined;
3979
4020
  entry?: string | string[] | undefined;
@@ -4532,6 +4573,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
4532
4573
  entry?: string | string[] | undefined;
4533
4574
  project?: string | string[] | undefined;
4534
4575
  } | undefined;
4576
+ biome?: string | boolean | string[] | {
4577
+ config?: string | string[] | undefined;
4578
+ entry?: string | string[] | undefined;
4579
+ project?: string | string[] | undefined;
4580
+ } | undefined;
4535
4581
  bun?: string | boolean | string[] | {
4536
4582
  config?: string | string[] | undefined;
4537
4583
  entry?: string | string[] | undefined;
@@ -5086,6 +5132,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
5086
5132
  entry?: string | string[] | undefined;
5087
5133
  project?: string | string[] | undefined;
5088
5134
  } | undefined;
5135
+ biome?: string | boolean | string[] | {
5136
+ config?: string | string[] | undefined;
5137
+ entry?: string | string[] | undefined;
5138
+ project?: string | string[] | undefined;
5139
+ } | undefined;
5089
5140
  bun?: string | boolean | string[] | {
5090
5141
  config?: string | string[] | undefined;
5091
5142
  entry?: string | string[] | undefined;
@@ -5644,6 +5695,11 @@ export declare const knipConfigurationSchema: z.ZodObject<{
5644
5695
  entry?: string | string[] | undefined;
5645
5696
  project?: string | string[] | undefined;
5646
5697
  } | undefined;
5698
+ biome?: string | boolean | string[] | {
5699
+ config?: string | string[] | undefined;
5700
+ entry?: string | string[] | undefined;
5701
+ project?: string | string[] | undefined;
5702
+ } | undefined;
5647
5703
  bun?: string | boolean | string[] | {
5648
5704
  config?: string | string[] | undefined;
5649
5705
  entry?: string | string[] | undefined;
@@ -66,6 +66,19 @@ export declare const pluginsSchema: z.ZodObject<{
66
66
  entry?: string | string[] | undefined;
67
67
  project?: string | string[] | undefined;
68
68
  }>]>;
69
+ biome: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
70
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
71
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
72
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ config?: string | string[] | undefined;
75
+ entry?: string | string[] | undefined;
76
+ project?: string | string[] | undefined;
77
+ }, {
78
+ config?: string | string[] | undefined;
79
+ entry?: string | string[] | undefined;
80
+ project?: string | string[] | undefined;
81
+ }>]>;
69
82
  bun: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
70
83
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
71
84
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1444,6 +1457,11 @@ export declare const pluginsSchema: z.ZodObject<{
1444
1457
  entry?: string | string[] | undefined;
1445
1458
  project?: string | string[] | undefined;
1446
1459
  };
1460
+ biome: string | boolean | string[] | {
1461
+ config?: string | string[] | undefined;
1462
+ entry?: string | string[] | undefined;
1463
+ project?: string | string[] | undefined;
1464
+ };
1447
1465
  bun: string | boolean | string[] | {
1448
1466
  config?: string | string[] | undefined;
1449
1467
  entry?: string | string[] | undefined;
@@ -1985,6 +2003,11 @@ export declare const pluginsSchema: z.ZodObject<{
1985
2003
  entry?: string | string[] | undefined;
1986
2004
  project?: string | string[] | undefined;
1987
2005
  };
2006
+ biome: string | boolean | string[] | {
2007
+ config?: string | string[] | undefined;
2008
+ entry?: string | string[] | undefined;
2009
+ project?: string | string[] | undefined;
2010
+ };
1988
2011
  bun: string | boolean | string[] | {
1989
2012
  config?: string | string[] | undefined;
1990
2013
  entry?: string | string[] | undefined;
@@ -14,6 +14,7 @@ export const pluginsSchema = z.object({
14
14
  astro: pluginSchema,
15
15
  ava: pluginSchema,
16
16
  babel: pluginSchema,
17
+ biome: pluginSchema,
17
18
  bun: pluginSchema,
18
19
  c8: pluginSchema,
19
20
  capacitor: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
- export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
1
+ export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'biome' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
+ export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "biome", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
@@ -3,6 +3,7 @@ export const pluginNames = [
3
3
  'astro',
4
4
  'ava',
5
5
  'babel',
6
+ 'biome',
6
7
  'bun',
7
8
  'c8',
8
9
  'capacitor',
@@ -7,7 +7,7 @@ import { GLOBAL_IGNORE_PATTERNS, ROOT_WORKSPACE_NAME } from '../constants.js';
7
7
  import { timerify } from './Performance.js';
8
8
  import { compact } from './array.js';
9
9
  import { debugLogObject } from './debug.js';
10
- import { isFile } from './fs.js';
10
+ import { isDirectory, isFile } from './fs.js';
11
11
  import { parseAndConvertGitignorePatterns } from './parse-and-convert-gitignores.js';
12
12
  import { dirname, join, relative, toPosix } from './path.js';
13
13
  const walk = promisify(_walk);
@@ -16,12 +16,16 @@ const cachedGitIgnores = new Map();
16
16
  const cachedGlobIgnores = new Map();
17
17
  const findAncestorGitignoreFiles = (cwd) => {
18
18
  const gitignorePaths = [];
19
+ if (isDirectory(join(cwd, '.git')))
20
+ return gitignorePaths;
19
21
  let dir = dirname(cwd);
20
22
  let prev;
21
23
  while (dir) {
22
24
  const filePath = join(dir, '.gitignore');
23
25
  if (isFile(filePath))
24
26
  gitignorePaths.push(filePath);
27
+ if (isDirectory(join(dir, '.git')))
28
+ break;
25
29
  dir = dirname((prev = dir));
26
30
  if (prev === dir || dir === '.')
27
31
  break;
@@ -43,9 +47,9 @@ export const findAndParseGitignores = async (cwd) => {
43
47
  }
44
48
  return false;
45
49
  };
46
- const addFile = (filePath) => {
50
+ const addFile = (filePath, baseDir) => {
47
51
  gitignoreFiles.push(relative(cwd, filePath));
48
- const dir = dirname(toPosix(filePath));
52
+ const dir = baseDir ?? dirname(toPosix(filePath));
49
53
  const base = relative(cwd, dir);
50
54
  const ancestor = base.startsWith('..') ? `${relative(dir, cwd)}/` : undefined;
51
55
  const ignoresForDir = new Set(base === '' ? init : []);
@@ -102,9 +106,10 @@ export const findAndParseGitignores = async (cwd) => {
102
106
  for (const pattern of ignoresForDir)
103
107
  matchers.add(_picomatch(pattern, pmOptions));
104
108
  };
105
- findAncestorGitignoreFiles(cwd).forEach(addFile);
109
+ for (const filePath of findAncestorGitignoreFiles(cwd))
110
+ addFile(filePath);
106
111
  if (isFile('.git/info/exclude'))
107
- addFile('.git/info/exclude');
112
+ addFile('.git/info/exclude', cwd);
108
113
  const entryFilter = (entry) => {
109
114
  if (entry.dirent.isFile() && entry.name === '.gitignore') {
110
115
  addFile(entry.path);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.60.1";
1
+ export declare const version = "5.61.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.60.1';
1
+ export const version = '5.61.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.60.1",
3
+ "version": "5.61.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
package/schema.json CHANGED
@@ -315,6 +315,10 @@
315
315
  "title": "Babel plugin configuration (https://knip.dev/reference/plugins/babel)",
316
316
  "$ref": "#/definitions/plugin"
317
317
  },
318
+ "biome": {
319
+ "title": "biome plugin configuration (https://knip.dev/reference/plugins/biome)",
320
+ "$ref": "#/definitions/plugin"
321
+ },
318
322
  "bun": {
319
323
  "title": "bun plugin configuration (https://knip.dev/reference/plugins/bun)",
320
324
  "$ref": "#/definitions/plugin"