knip 5.0.2 → 5.0.3

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.
@@ -16,7 +16,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
16
16
  ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
17
17
  ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
18
18
  ignoreWorkspaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
- exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
+ exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
20
20
  rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, z.ZodEnum<["error", "warn", "off"]>>>;
21
21
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
22
22
  project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -27,7 +27,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
27
27
  compilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodString>, z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodString>>]>>>;
28
28
  syncCompilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodString>>>;
29
29
  asyncCompilers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodString>>>>;
30
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
+ include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, "many">>;
31
31
  workspaces: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
32
32
  ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
33
33
  ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
@@ -2001,7 +2001,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
2001
2001
  ignoreBinaries?: (string | RegExp)[] | undefined;
2002
2002
  ignoreDependencies?: (string | RegExp)[] | undefined;
2003
2003
  ignoreWorkspaces?: string[] | undefined;
2004
- exclude?: string[] | undefined;
2004
+ exclude?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
2005
2005
  rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
2006
2006
  entry?: string | string[] | undefined;
2007
2007
  project?: string | string[] | undefined;
@@ -2012,7 +2012,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
2012
2012
  compilers?: Record<string, ((args_0: string, ...args_1: unknown[]) => string) | ((args_0: string, ...args_1: unknown[]) => Promise<string>)> | undefined;
2013
2013
  syncCompilers?: Record<string, (args_0: string, ...args_1: unknown[]) => string> | undefined;
2014
2014
  asyncCompilers?: Record<string, (args_0: string, ...args_1: unknown[]) => Promise<string>> | undefined;
2015
- include?: string[] | undefined;
2015
+ include?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
2016
2016
  workspaces?: Record<string, {
2017
2017
  ignoreBinaries?: (string | RegExp)[] | undefined;
2018
2018
  ignoreDependencies?: (string | RegExp)[] | undefined;
@@ -2566,7 +2566,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
2566
2566
  ignoreBinaries?: (string | RegExp)[] | undefined;
2567
2567
  ignoreDependencies?: (string | RegExp)[] | undefined;
2568
2568
  ignoreWorkspaces?: string[] | undefined;
2569
- exclude?: string[] | undefined;
2569
+ exclude?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
2570
2570
  rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
2571
2571
  entry?: string | string[] | undefined;
2572
2572
  project?: string | string[] | undefined;
@@ -2577,7 +2577,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
2577
2577
  compilers?: Record<string, ((args_0: string, ...args_1: unknown[]) => string) | ((args_0: string, ...args_1: unknown[]) => Promise<string>)> | undefined;
2578
2578
  syncCompilers?: Record<string, (args_0: string, ...args_1: unknown[]) => string> | undefined;
2579
2579
  asyncCompilers?: Record<string, (args_0: string, ...args_1: unknown[]) => Promise<string>> | undefined;
2580
- include?: string[] | undefined;
2580
+ include?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
2581
2581
  workspaces?: Record<string, {
2582
2582
  ignoreBinaries?: (string | RegExp)[] | undefined;
2583
2583
  ignoreDependencies?: (string | RegExp)[] | undefined;
@@ -49,8 +49,8 @@ const rootConfigurationSchema = z.object({
49
49
  asyncCompilers: z.record(z.string(), asyncCompilerSchema).optional(),
50
50
  });
51
51
  const reportConfigSchema = z.object({
52
- include: z.array(z.string()).optional(),
53
- exclude: z.array(z.string()).optional(),
52
+ include: z.array(issueTypeSchema).optional(),
53
+ exclude: z.array(issueTypeSchema).optional(),
54
54
  });
55
55
  export const pluginSchema = z.union([
56
56
  z.boolean(),
@@ -7,7 +7,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
7
7
  ignoreBinaries?: (string | RegExp)[] | undefined;
8
8
  ignoreDependencies?: (string | RegExp)[] | undefined;
9
9
  ignoreWorkspaces?: string[] | undefined;
10
- exclude?: string[] | undefined;
10
+ exclude?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
11
11
  rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
12
12
  entry?: string | string[] | undefined;
13
13
  project?: string | string[] | undefined;
@@ -16,7 +16,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
16
16
  ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "interface" | "enum" | "class" | "member", boolean>> | undefined;
17
17
  includeEntryExports?: boolean | undefined;
18
18
  compilers?: Record<string, ((args_0: string, ...args_1: unknown[]) => string) | ((args_0: string, ...args_1: unknown[]) => Promise<string>)> | undefined;
19
- include?: string[] | undefined;
19
+ include?: ("files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
20
20
  workspaces?: Record<string, {
21
21
  ignoreBinaries?: (string | RegExp)[] | undefined;
22
22
  ignoreDependencies?: (string | RegExp)[] | undefined;
@@ -9,7 +9,7 @@ const isEnabled = ({ dependencies, manifest, config }) => hasDependency(dependen
9
9
  Boolean(manifest.name && /(^eslint-config|\/eslint-config)/.test(manifest.name));
10
10
  export const PACKAGE_JSON_PATH = 'eslintConfig';
11
11
  const CONFIG_FILE_PATTERNS = [
12
- 'eslint.config.js',
12
+ 'eslint.config.{js,cjs,mjs}',
13
13
  '.eslintrc',
14
14
  '.eslintrc.{js,json,cjs}',
15
15
  '.eslintrc.{yml,yaml}',
@@ -18,7 +18,10 @@ const CONFIG_FILE_PATTERNS = [
18
18
  const findESLintDependencies = async (configFilePath, { cwd, manifest, isProduction }) => {
19
19
  if (isProduction)
20
20
  return [];
21
- if (basename(configFilePath) === 'eslint.config.js')
21
+ const baseFilePath = basename(configFilePath);
22
+ if (baseFilePath === 'eslint.config.js' ||
23
+ baseFilePath === 'eslint.config.cjs' ||
24
+ baseFilePath === 'eslint.config.mjs')
22
25
  return [];
23
26
  const dependencies = await getDependenciesDeep(configFilePath, { cwd, manifest });
24
27
  return Array.from(dependencies);
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { ConfigurationValidator, pluginSchema } from '../ConfigurationValidator.js';
3
3
  import * as Plugins from '../plugins/index.js';
4
- import type { Rules } from './issues.js';
4
+ import type { Rules, IssueType } from './issues.js';
5
5
  import type { SyncCompilers, AsyncCompilers } from '../compilers/types.js';
6
6
  export type RawConfiguration = z.infer<typeof ConfigurationValidator>;
7
7
  export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
@@ -28,8 +28,8 @@ export interface WorkspaceConfiguration extends BaseWorkspaceConfiguration, Part
28
28
  type IgnorableExport = 'class' | 'enum' | 'function' | 'interface' | 'member' | 'type';
29
29
  export interface Configuration {
30
30
  rules: Rules;
31
- include: string[];
32
- exclude: string[];
31
+ include: IssueType[];
32
+ exclude: IssueType[];
33
33
  ignore: NormalizedGlob;
34
34
  ignoreBinaries: IgnorePatterns;
35
35
  ignoreDependencies: IgnorePatterns;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.0.2";
1
+ export declare const version = "5.0.3";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.0.2';
1
+ export const version = '5.0.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {