Skip to content

Commit 0068527

Browse files
authored
Merge pull request #234 from Auge19/add_knip
Add knip linter and fix all unused dependencies and exports
2 parents ad24da6 + 9a50749 commit 0068527

56 files changed

Lines changed: 1266 additions & 215 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Checking package dependencies with knip and lerna
2+
3+
on:
4+
# Runs for every pull-requests created
5+
pull_request:
6+
push:
7+
branches: [main]
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
knip:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v6
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version: 24
23+
cache: 'npm'
24+
25+
- name: Build TKO
26+
run: make
27+
28+
- name: Check for dependency cycles and faulty imports/exports with knip
29+
run: make knip
30+
31+
- name: Check lerna packages
32+
run: make lerna-check

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ format-fix:
5252
tsc:
5353
$(NPX) tsc
5454

55+
knip:
56+
$(NPX) knip --no-config-hints
57+
5558
eslint:
5659
$(NPX) eslint .
5760

@@ -67,6 +70,9 @@ dts:
6770
docker-build:
6871
$(DOCKER) build . --tag tko
6972

73+
lerna-check:
74+
$(LERNA) exec --stream -- true
75+
7076
# Run the `repackage` target in every directory. Essentially
7177
# homogenizes the `package.json`.
7278
repackage: tools/repackage.mjs

builds/knockout/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161
"@tko/provider.multi": "^4.0.0",
6262
"@tko/provider.virtual": "^4.0.0",
6363
"@tko/utils.component": "^4.0.0",
64-
"@tko/utils.functionrewrite": "^4.0.0",
65-
"tslib": "^2.2.0"
64+
"@tko/utils.functionrewrite": "^4.0.0"
6665
},
6766
"exports": {
6867
".": {

builds/reference/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"@tko/provider.native": "^4.0.0",
3131
"@tko/provider.virtual": "^4.0.0",
3232
"@tko/utils.component": "^4.0.0",
33-
"@tko/utils.jsx": "^4.0.0",
34-
"tslib": "^2.2.0"
33+
"@tko/utils.jsx": "^4.0.0"
3534
},
3635
"files": [
3736
"dist/",

eslint.config.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
import globals from "globals";
2-
import pluginJs from "@eslint/js";
3-
import tseslint from "typescript-eslint";
1+
const pluginJs = require('@eslint/js')
2+
const tseslint = require('typescript-eslint')
43

54

65
/** @type {import('eslint').Linter.Config[]} */
7-
export default [
6+
module.exports = [
87
pluginJs.configs.recommended,
98
...tseslint.configs.recommended,
10-
{ ignores: ['**/*.{js,mjs,cjs}', 'builds/**/*'] },
9+
{ ignores: ['**/*.{js,mjs,cjs}', 'builds/**/*', '**/*.d.ts'] },
1110
{
1211
rules: {
13-
"no-empty": "off",
14-
"prefer-rest-params" : "off",
15-
"prefer-spread": "off",
16-
"prefer-const": "off",
17-
"no-useless-escape": "off",
18-
"no-useless-assignment": "off",
12+
'no-empty': 'off',
13+
'prefer-rest-params': 'off',
14+
'prefer-spread': 'off',
15+
'prefer-const': 'off',
16+
'no-useless-escape': 'off',
17+
'no-useless-assignment': 'off',
1918
// "no-var": "off",
20-
"no-array-constructor": "off",
21-
"no-misleading-character-class": "off",
22-
"@typescript-eslint/no-this-alias": "off",
23-
"@typescript-eslint/no-array-constructor": "off",
24-
"@typescript-eslint/no-explicit-any": "off",
25-
"@typescript-eslint/no-require-imports": "off",
26-
"@typescript-eslint/no-unused-vars" : "off",
27-
"@typescript-eslint/no-unsafe-function-type": "off"
19+
'no-array-constructor': 'off',
20+
'no-misleading-character-class': 'off',
21+
'@typescript-eslint/no-this-alias': 'off',
22+
'@typescript-eslint/no-array-constructor': 'off',
23+
'@typescript-eslint/no-explicit-any': 'off',
24+
'@typescript-eslint/no-require-imports': 'off',
25+
'@typescript-eslint/no-unused-vars': 'off',
26+
'@typescript-eslint/no-unsafe-function-type': 'off'
2827
}
2928
}
30-
];
29+
]

knip.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"ignoreExportsUsedInFile": {
4+
"interface": true,
5+
"type": true
6+
},
7+
"tags": [
8+
"-lintignore",
9+
"-internal"
10+
],
11+
"ignoreBinaries": ["make"],
12+
"ignoreDependencies": ["@types/mocha", "chai", "electron", "esbuild", "fs-extra", "karma[.]*", "mocha", "nyc", "prettier", "sinon", "lerna"],
13+
"workspaces": {
14+
"packages/*": {
15+
"entry": "src/index.ts",
16+
"project": "src/**/*.ts",
17+
"ignore": ["/helpers/**"]
18+
}
19+
},
20+
"ignoreWorkspaces": ["builds/**", "docs/**", "tko.io/**", "tools/**"]
21+
}

0 commit comments

Comments
 (0)