mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
* moving files from ide-redesign/components/editor-tour to features/editor-tour moving files from ide-redesign/components/integrations-panel to features/integrations-panel fixing imports Revert "moving files from ide-redesign/components/editor-tour to features/editor-tour" This reverts commit 9e4dcd4e001ffa4bfdb1053fb8824c1e8521ab10. * moving files from ide-redesign/components/help -> ide-react/components/rail * ide-redesign/components/breadcrumbs → features/source-editor/extensions * ide-redesign/components/editor.tsx → ide-react/components/layout * ide-redesign/components/full-project-search-panel.tsx → ide-react/components/rail/full-project-search-panel.tsx * removing old-editor-warning-tooltip * ide-redesign/components/tooltip-promo.tsx → shared/components/tooltip-promo.tsx make cleanup_unused_locales * extract-translations GitOrigin-RevId: b9f44c4820bb4e0a7eef4f6f9a58ff96fd007bf9
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
/**
|
|
* Configuration for knip, a tool to find unused exports in a project.
|
|
*
|
|
* To run knip, use the command: bin/npm -w services/web run knip
|
|
*
|
|
* It currently only runs in the frontend web service, but could be
|
|
* adapted to run in the backend as well.
|
|
*
|
|
* This is an initial version built in a hackathon. It is useful but not yet complete.
|
|
* In future we should add it to our CI checks but we need to make it more robust first.
|
|
*/
|
|
|
|
import type { KnipConfig } from 'knip'
|
|
import Path from 'path'
|
|
import settings from './config/settings.webpack'
|
|
|
|
const moduleEntryPoints = Object.values(settings.overleafModuleImports).flatMap(
|
|
paths =>
|
|
paths.map(path => {
|
|
const cleanedPath = path.replace(Path.join(__dirname, '/'), '')
|
|
if (cleanedPath.match(/\.(js|jsx|ts|tsx?)$/)) {
|
|
return cleanedPath
|
|
}
|
|
|
|
return `${cleanedPath}.{js,jsx,ts,tsx}`
|
|
})
|
|
)
|
|
|
|
const knipConfig: KnipConfig = {
|
|
$schema: 'https://unpkg.com/knip@5/schema.json',
|
|
entry: [
|
|
'frontend/js/pages/**/*.{js,jsx,ts,tsx}',
|
|
'frontend/stories/**/*.{js,jsx,ts,tsx}',
|
|
'test/frontend/**/*.{js,jsx,ts,tsx}',
|
|
'modules/**/test/**/*.{js,jsx,ts,tsx}',
|
|
'modules/**/*.test.{js,jsx,ts,tsx}',
|
|
'modules/**/stories/**/*.{js,jsx,ts,tsx}',
|
|
// TODO: update this when I work out how writefull entry points work
|
|
'modules/writefull/**/*.{js,jsx,ts,tsx}',
|
|
'types/window.ts',
|
|
// Workers are loaded dynamically so we explicitly include all workers
|
|
// here until we work out a way to follow the dynamic imports
|
|
'modules/**/*.worker*',
|
|
'frontend/js/**/*.worker*',
|
|
...moduleEntryPoints,
|
|
],
|
|
project: [
|
|
'frontend/js/**/*.{js,jsx,ts,tsx}',
|
|
'modules/**/frontend/**/*.{js,jsx,ts,tsx}',
|
|
'!frontend/js/.storybook/**/*.{js,jsx,ts,tsx}',
|
|
],
|
|
ignore: [
|
|
// TODO: Files that we should keep around even when unused.
|
|
// I would like to do this in the file itself but I can't seem
|
|
// to work out a way to do that (@knipignore only works for
|
|
// individual exports rather than whole files)
|
|
'frontend/js/shared/components/labs/labs-experiments-widget.tsx',
|
|
'frontend/js/shared/components/tooltip-promo.tsx',
|
|
],
|
|
ignoreExportsUsedInFile: true,
|
|
ignoreBinaries: ['.*'],
|
|
ignoreDependencies: ['.*'],
|
|
tags: ['-knipignore'],
|
|
}
|
|
|
|
export default knipConfig
|