-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#9457: move knip
to repository root
#9505
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b29fa36
[WIP] move knip to root
twschiller 20bba49
Fix relative import
twschiller 1af6e0b
Update CI job
twschiller c16d28b
Drop prettier from workspace
twschiller c09a76d
Fix production check
twschiller 70e4f23
Merge remote-tracking branch 'origin/main' into feature/9457-knip-root
twschiller 97a6289
Merge origin/main
twschiller 26dc6f0
Fix libraries package.json
twschiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import configFactory from "@pixiebrix/extension/webpack.config.mjs"; | ||
|
||
const config = configFactory(process.env, {}); | ||
|
||
/** | ||
* https://knip.dev/overview/configuration#customize | ||
* @type {import("knip").KnipConfig} | ||
* | ||
* Production mode: https://knip.dev/features/production-mode | ||
*/ | ||
const knipConfig = { | ||
$schema: "https://unpkg.com/knip@5/schema.json", | ||
|
||
workspaces: { | ||
"applications/browser-extension": { | ||
entry: [ | ||
// ! suffix files are included in production mode | ||
...Object.values(config.entry).map((x) => | ||
`${x}.{ts,tsx,js,jsx}!`.replace("./", ""), | ||
), | ||
// App messenger and common storage | ||
"src/background/messenger/external/api.ts!", | ||
"src/store/browserExtensionIdStorage.ts!", | ||
|
||
// Loaded via .eslintrc | ||
"eslint-local-rules/*", | ||
|
||
// Include in default run only | ||
"end-to-end-tests/fixtures/*.ts", | ||
"end-to-end-tests/setup/*.setup.ts", | ||
"end-to-end-tests/utils.ts", | ||
|
||
// Imported via .html files and manifest.json | ||
"static/*", | ||
|
||
// Scripting/config entry points that are not being picked up | ||
"src/testUtils/FixJsdomEnvironment.js", | ||
"scripts/*.{mjs,ts}", | ||
"src/telemetry/lexicon.ts", | ||
|
||
"webpack.sharedConfig.js", | ||
".storybook/main.js", | ||
], | ||
project: [ | ||
// Include in production mode and default run | ||
"src/**/*.ts!", | ||
|
||
/** | ||
* Exclude from production runs (`!` prefix and suffix) | ||
* @see https://knip.dev/guides/configuring-project-files#production-mode | ||
*/ | ||
"!end-to-end-tests/**!", | ||
"!src/__mocks__/**!", | ||
"!src/**/testHelpers.{ts,tsx}!", | ||
"!src/testUtils/**!", | ||
"!src/telemetry/lexicon.ts!", | ||
"!src/development/hooks/**!", | ||
"!src/vendors/reactPerformanceTesting/**!", | ||
"!scripts/**!", | ||
"!webpack.sharedConfig.js!", | ||
"!.storybook/main.js!", | ||
], | ||
// https://knip.dev/guides/handling-issues#mocks-and-other-implicit-imports | ||
ignore: [ | ||
// Test Mocks | ||
"**/__mocks__/**", | ||
// Development/debugging helpers | ||
"src/development/hooks/**", | ||
// Including end-to-end tests for dependency check but not dead code | ||
"end-to-end-tests/**", | ||
|
||
// https://knip.dev/reference/jsdoc-tsdoc-tags/#tags-cli | ||
// Instead of adding files to this list, prefer adding a @knip JSDoc comment with explanation, like: | ||
|
||
// /** @knip We want to use this later */ | ||
// export const someValue = 0; | ||
|
||
// Prefer adding `@internal` JSDoc comment if only used by tests, factories, etc. | ||
// `@internal` only ignores during production runs so it will still flag unused exports during full runs | ||
], | ||
ignoreDependencies: [ | ||
// TODO: These are used by production files, shouldn't need to ignore them? | ||
// Most appear to be dynamic imports, maybe there's a plugin we need | ||
"@fortawesome/free-brands-svg-icons", | ||
"@fortawesome/free-regular-svg-icons", | ||
"@szhsin/react-menu", | ||
"ace-builds", | ||
"bootstrap-icons", | ||
"fit-textarea", | ||
"holderjs", | ||
"jquery", | ||
"jszip", | ||
"lodash-es", | ||
"react-ace", | ||
"react-autosuggest", | ||
"react-hot-toast", | ||
"react-hotkeys", | ||
"react-image-crop", | ||
"react-outside-click-handler", | ||
"react-router-dom", | ||
"react-select-virtualized", | ||
"react-spinners", | ||
"react-virtualized-auto-sizer", | ||
"react-window", | ||
"simple-icons", | ||
|
||
// PeerDependency of react-select-virtualized | ||
"react-virtualized", | ||
|
||
// Browser environment types | ||
"@types/chrome", | ||
"@types/dom-navigation", | ||
// Provides require.context, etc. | ||
"@types/webpack-env", | ||
// Used by src/contrib/google/sheets/core/types.ts | ||
"@types/gapi.client", | ||
"@types/gapi.client.drive-v3", | ||
"@types/gapi.client.oauth2-v2", | ||
"@types/gapi.client.sheets-v4", | ||
|
||
// Referenced in scss files | ||
"bootstrap", | ||
"compass-mixins", | ||
// Not getting detected by webpack plugin for .storybook/main.js | ||
"style-loader", | ||
"@storybook/react-webpack5", | ||
|
||
// Used but not detected | ||
"@types/holderjs", | ||
"@types/react-autosuggest", | ||
"@types/react-outside-click-handler", | ||
"@types/react-virtualized-auto-sizer", | ||
"@types/react-window", | ||
"@tiptap/pm", | ||
"@tiptap/starter-kit", | ||
"@tiptap/react", | ||
"@tiptap/extension-underline", | ||
], | ||
// False positive for PackageInstance.featureFlag | ||
ignoreMembers: ["featureFlag"], | ||
}, | ||
}, | ||
}; | ||
|
||
// Echo settings to console to make CI results easier to understand/debug | ||
console.log(JSON.stringify(knipConfig, null, 2)); | ||
|
||
export default knipConfig; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion: #9503