knip 2.12.0 → 2.12.2

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.
package/README.md CHANGED
@@ -181,21 +181,21 @@ This example shows more output related to unused and unlisted dependencies:
181
181
 
182
182
  The report contains the following types of issues:
183
183
 
184
- | Key | Title | Description |
185
- | :------------- | :---------------------------------- | :---------------------------------------------------- |
186
- | `files` | Unused files | unable to find references to this file |
187
- | `dependencies` | Unused dependencies | unable to find references to this dependency |
188
- | `dependencies` | Unused devDependencies | unable to find references to this dependency |
189
- | `unlisted` | Unlisted dependencies | used dependencies not listed in package.json |
190
- | `binaries` | Unlisted binaries | binaries from dependencies not in package.json |
191
- | `unresolved` | Unresolved imports | unable to resolve this (import) specifier |
192
- | `exports` | Unused exports | unable to find references to this export |
193
- | `nsExports` | Unused exports in namespaces | unable to find direct references to this export _(1)_ |
194
- | `types` | Unused exported types | unable to find references to this exported type |
195
- | `nsTypes` | Unused exported types in namespaces | unable to find direct references to this export _(1)_ |
196
- | `enumMembers` | Unused exported enum members | unable to find references to this enum member |
197
- | `classMembers` | Unused exported class members | unable to find references to this class member |
198
- | `duplicates` | Duplicate exports | the same thing is exported more than once |
184
+ | Key | Title | Description |
185
+ | :---------------- | :---------------------------------- | :---------------------------------------------------- |
186
+ | `files` | Unused files | unable to find references to this file |
187
+ | `dependencies` | Unused dependencies | unable to find references to this dependency |
188
+ | `devDependencies` | Unused devDependencies | unable to find references to this devDependency |
189
+ | `unlisted` | Unlisted dependencies | used dependencies not listed in package.json |
190
+ | `binaries` | Unlisted binaries | binaries from dependencies not in package.json |
191
+ | `unresolved` | Unresolved imports | unable to resolve this (import) specifier |
192
+ | `exports` | Unused exports | unable to find references to this export |
193
+ | `nsExports` | Unused exports in namespaces | unable to find direct references to this export _(1)_ |
194
+ | `types` | Unused exported types | unable to find references to this exported type |
195
+ | `nsTypes` | Unused exported types in namespaces | unable to find direct references to this export _(1)_ |
196
+ | `enumMembers` | Unused exported enum members | unable to find references to this enum member |
197
+ | `classMembers` | Unused exported class members | unable to find references to this class member |
198
+ | `duplicates` | Duplicate exports | the same thing is exported more than once |
199
199
 
200
200
  When an issue type has zero issues, it is not shown.
201
201
 
@@ -36,6 +36,7 @@ export declare class ConfigurationChief {
36
36
  dependencies: import("./types/issues.js").IssueSeverity;
37
37
  devDependencies: import("./types/issues.js").IssueSeverity;
38
38
  unlisted: import("./types/issues.js").IssueSeverity;
39
+ binaries: import("./types/issues.js").IssueSeverity;
39
40
  unresolved: import("./types/issues.js").IssueSeverity;
40
41
  exports: import("./types/issues.js").IssueSeverity;
41
42
  types: import("./types/issues.js").IssueSeverity;
@@ -44,7 +45,6 @@ export declare class ConfigurationChief {
44
45
  duplicates: import("./types/issues.js").IssueSeverity;
45
46
  enumMembers: import("./types/issues.js").IssueSeverity;
46
47
  classMembers: import("./types/issues.js").IssueSeverity;
47
- binaries: import("./types/issues.js").IssueSeverity;
48
48
  };
49
49
  include: string[];
50
50
  exclude: string[];
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ConfigurationValidator: z.ZodObject<{
3
3
  exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4
- rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"unlisted">, 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"]>>>;
4
+ 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"]>>>;
5
5
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
6
6
  project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
7
7
  paths: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
@@ -1405,7 +1405,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
1405
1405
  }>]>>;
1406
1406
  }, "strip", z.ZodTypeAny, {
1407
1407
  exclude?: string[] | undefined;
1408
- rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
1408
+ rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
1409
1409
  entry?: string | string[] | undefined;
1410
1410
  project?: string | string[] | undefined;
1411
1411
  paths?: Record<string, string[]> | undefined;
@@ -1807,7 +1807,7 @@ export declare const ConfigurationValidator: z.ZodObject<{
1807
1807
  } | undefined;
1808
1808
  }, {
1809
1809
  exclude?: string[] | undefined;
1810
- rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
1810
+ rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
1811
1811
  entry?: string | string[] | undefined;
1812
1812
  project?: string | string[] | undefined;
1813
1813
  paths?: Record<string, string[]> | undefined;
@@ -10,6 +10,7 @@ const issueTypeSchema = z.union([
10
10
  z.literal('dependencies'),
11
11
  z.literal('devDependencies'),
12
12
  z.literal('unlisted'),
13
+ z.literal('binaries'),
13
14
  z.literal('unresolved'),
14
15
  z.literal('exports'),
15
16
  z.literal('types'),
@@ -9,7 +9,15 @@ const findPostCSSDependencies = async (configFilePath, { manifest }) => {
9
9
  ? manifest?.postcss
10
10
  : await load(configFilePath);
11
11
  return config?.plugins
12
- ? (Array.isArray(config.plugins) ? config.plugins : Object.keys(config.plugins)).filter(plugin => typeof plugin === 'string')
12
+ ? (Array.isArray(config.plugins) ? config.plugins : Object.keys(config.plugins)).flatMap(plugin => {
13
+ if (typeof plugin === 'string') {
14
+ return plugin;
15
+ }
16
+ if (Array.isArray(plugin) && typeof plugin[0] === 'string') {
17
+ return plugin[0];
18
+ }
19
+ return [];
20
+ })
13
21
  : [];
14
22
  };
15
23
  export const findDependencies = timerify(findPostCSSDependencies);
@@ -1,3 +1,3 @@
1
1
  export type PostCSSConfig = {
2
- plugins?: string[] | Record<string, unknown>;
2
+ plugins?: string[] | [string, unknown][] | Record<string, unknown>;
3
3
  };
@@ -4,7 +4,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
4
4
  syncCompilers: Record<string, SyncCompilerFn>;
5
5
  asyncCompilers: Record<string, AsyncCompilerFn>;
6
6
  exclude?: string[] | undefined;
7
- rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
7
+ rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
8
8
  entry?: string | string[] | undefined;
9
9
  project?: string | string[] | undefined;
10
10
  paths?: Record<string, string[]> | undefined;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.12.0";
1
+ export declare const version = "2.12.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.12.0';
1
+ export const version = '2.12.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://github.com/webpro/knip",
6
6
  "repository": "github:webpro/knip",
@@ -63,15 +63,15 @@
63
63
  "@jest/types": "29.5.0",
64
64
  "@npmcli/package-json": "3.1.0",
65
65
  "@release-it/bumper": "4.0.2",
66
- "@types/eslint": "8.37.0",
66
+ "@types/eslint": "8.40.0",
67
67
  "@types/js-yaml": "4.0.5",
68
68
  "@types/micromatch": "4.0.2",
69
69
  "@types/minimist": "1.2.2",
70
- "@types/node": "20.2.1",
70
+ "@types/node": "20.2.3",
71
71
  "@types/npmcli__map-workspaces": "3.0.1",
72
72
  "@types/webpack": "5.28.1",
73
- "@typescript-eslint/eslint-plugin": "5.59.6",
74
- "@typescript-eslint/parser": "5.59.6",
73
+ "@typescript-eslint/eslint-plugin": "5.59.7",
74
+ "@typescript-eslint/parser": "5.59.7",
75
75
  "c8": "7.13.0",
76
76
  "eslint": "8.41.0",
77
77
  "eslint-import-resolver-typescript": "3.5.5",