Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3420956
Added knip config and action for unused files/exports
shubham1206agra May 14, 2026
f7d32e1
Removed unused file
shubham1206agra May 14, 2026
041c849
Removed unused file
shubham1206agra May 14, 2026
83fb763
Fix action
shubham1206agra May 14, 2026
1549f3f
Fix action
shubham1206agra May 14, 2026
5bcad41
Improve action
shubham1206agra May 14, 2026
b13fadf
Improve action
shubham1206agra May 14, 2026
c18ffad
Improve action
shubham1206agra May 14, 2026
53ab8a2
Merge branch 'main' of https://github.com/shubham1206agra/App into kn…
shubham1206agra May 15, 2026
e702af1
Improve action
shubham1206agra May 15, 2026
5396063
Improve action
shubham1206agra May 15, 2026
d938c2d
Removed unused export
shubham1206agra May 15, 2026
1c3911b
Fix ts
shubham1206agra May 15, 2026
57abb0f
Merge branch 'main' of https://github.com/shubham1206agra/App into kn…
shubham1206agra May 16, 2026
19bd514
Removed unused export
shubham1206agra May 16, 2026
d000299
Add knip-changed script
shubham1206agra May 16, 2026
12ddc1a
Fix cspell
shubham1206agra May 16, 2026
93365a8
Update knip version
shubham1206agra May 16, 2026
29505ed
Merge main
shubham1206agra May 18, 2026
6844c16
Removed unused export
shubham1206agra May 18, 2026
a56e7f1
Merge branch 'main' into knip-config
shubham1206agra May 18, 2026
4129435
Improve action
shubham1206agra May 19, 2026
fcedc5f
Merge main
shubham1206agra May 19, 2026
40de85e
Removed unused export
shubham1206agra May 20, 2026
26c86f1
Merge branch 'main' into knip-config
shubham1206agra May 20, 2026
bc1217e
Fix ts
shubham1206agra May 20, 2026
d55edae
Removed unused export
shubham1206agra May 20, 2026
7e2e013
Fix ESLint
shubham1206agra May 20, 2026
4ac568a
Merge main
shubham1206agra May 23, 2026
4898314
Add more files
shubham1206agra May 23, 2026
a962657
Merge branch 'Expensify:main' into knip-config
shubham1206agra May 24, 2026
42a3c47
Apply suggestion from @shubham1206agra
shubham1206agra May 24, 2026
e148b58
Merge main
shubham1206agra May 25, 2026
0171f04
Add more files
shubham1206agra May 25, 2026
12365e6
Merge branch 'main' of https://github.com/shubham1206agra/App into kn…
shubham1206agra May 27, 2026
fbf873c
Add more files
shubham1206agra May 27, 2026
0ca80e6
Fix ts
shubham1206agra May 27, 2026
ce7d886
Fix ESLint
shubham1206agra May 27, 2026
158ec28
Merge branch 'main' of https://github.com/shubham1206agra/App into kn…
shubham1206agra May 27, 2026
b12e1ad
Add more files
shubham1206agra May 27, 2026
4eedce7
Merge branch 'main' into knip-config
shubham1206agra May 28, 2026
a79a750
Merge branch 'main' into knip-config
shubham1206agra May 28, 2026
bf37d11
Add more files
shubham1206agra May 28, 2026
d6a9506
Merge main
shubham1206agra May 30, 2026
63474e8
Add more files
shubham1206agra May 30, 2026
bdaa81c
Apply suggestions from code review
shubham1206agra Jun 1, 2026
ff6305f
Merge branch 'Expensify:main' into knip-config
shubham1206agra Jun 1, 2026
388e30d
Merge branch 'main' into knip-config
shubham1206agra Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Knip check

on:
pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- '**.mjs'
- '**.cjs'
- 'knip.json'
- 'package.json'
- 'package-lock.json'
- 'patches/**'
- 'tsconfig.json'

concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-knip
cancel-in-progress: true

jobs:
knip-compare:
name: Compare knip issues against main
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- name: Checkout PR
uses: useblacksmith/checkout@c9796daa2a4bdebdab5bd16be2c09a70cd4e1121 # v1

- name: Setup Node
uses: ./.github/actions/composite/setupNode

- name: Run knip on PR
run: KNIP=true npx knip --reporter json --no-exit-code > /tmp/knip-pr.json
Comment thread
shubham1206agra marked this conversation as resolved.

- name: Checkout main
run: |
git fetch origin main --no-tags --depth=1
git checkout origin/main

- name: Run knip on main
run: KNIP=true npx knip --reporter json --no-exit-code > /tmp/knip-main.json
Comment thread
shubham1206agra marked this conversation as resolved.

- name: Restore PR workspace
run: git checkout ${{ github.sha }}

- name: Compare reports
run: npx ts-node ./scripts/compareKnipReports.ts --mainPath=/tmp/knip-main.json --prPath=/tmp/knip-pr.json
16 changes: 10 additions & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,22 @@ if (process.env.CAPTURE_METRICS === 'true') {
}

module.exports = (api) => {
console.debug('babel.config.js');
console.debug(' - api.version:', api.version);
console.debug(' - api.env:', api.env());
console.debug(' - process.env.NODE_ENV:', process.env.NODE_ENV);
console.debug(' - process.env.BABEL_ENV:', process.env.BABEL_ENV);
if (!process.env.KNIP) {
console.debug('babel.config.js');
console.debug(' - api.version:', api.version);
console.debug(' - api.env:', api.env());
console.debug(' - process.env.NODE_ENV:', process.env.NODE_ENV);
console.debug(' - process.env.BABEL_ENV:', process.env.BABEL_ENV);
}

// For `react-native` (iOS/Android) caller will be "metro"
// For `webpack` (Web) caller will be "@babel-loader"
// For jest, it will be babel-jest
// For `storybook` there won't be any config at all so we must give default argument of an empty object
const runningIn = api.caller((args = {}) => args.name);
console.debug(' - running in: ', runningIn);
if (!process.env.KNIP) {
console.debug(' - running in: ', runningIn);
}

return ['metro', 'babel-jest'].includes(runningIn) ? metro : webpack;
};
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,8 @@
"مثال",
"NitroFetch",
"Prefetch",
"Prefetcher"
"Prefetcher",
"knip"
],
"ignorePaths": [
".gitignore",
Expand Down
67 changes: 67 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"entry": [
"index.js",
"wdyr.ts",
"src/App.tsx",
"src/HybridAppHandler.tsx",
"scripts/**/*.{js,ts}",
"web/proxy.ts",
"config/webpack/**/*.{js,mjs,ts}",
".github/scripts/**/*.ts",
".github/actions/javascript/**/*.ts",
".storybook/**/*.{js,ts,tsx}",
"metro.config.js",
"eslint.changed.config.mjs",
"react-native.config.js",
"rock.config.mjs"
],
"project": [
"src/**/*.{js,jsx,ts,tsx}",
"tests/**/*.{js,jsx,ts,tsx}",
"__mocks__/**/*.{js,jsx,ts,tsx}",
"web/**/*.{js,jsx,ts,tsx}",
"config/**/*.{js,mjs,ts,tsx}",
"scripts/**/*.{js,ts}",
"jest/**/*.{js,ts}",
".storybook/**/*.{js,ts,tsx}",
".github/actions/javascript/**/*.ts"
],
"ignore": [".github/actions/**/index.js", "tests/perf-test/**", "web/snippets/gib.js"],
"ignoreDependencies": [
"@expensify/react-native-hybrid-app",
"group-ib-fp",
"react-native-image-size",
"react-native-picker-select",
"lodash",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-private-property-in-object",
"babel-plugin-module-resolver",
"babel-plugin-transform-remove-console",
"@fullstory/babel-plugin-react-native",
"eslint-config-airbnb-typescript",
"eslint-config-prettier",
"eslint-plugin-storybook",
"@dword-design/eslint-plugin-import-alias",
"tsconfig-paths",
"@vercel/ncc",
"shellcheck",
"patch-package",
"diff-so-fancy"
],
"ignoreBinaries": ["metro-symbolicate", "mkcert"],
"eslint": {
"config": ["config/eslint/eslint.config.mjs", "eslint.changed.config.mjs"]
},
"webpack": {
"config": ["config/webpack/webpack.common.ts"]
},
"babel": {
"config": ["babel.config.js"]
},
"jest": {
"config": ["jest.config.js"]
},
"storybook": {
"config": [".storybook/main.ts"]
}
}
Loading
Loading