Добавление ts-prune и общего скрипта проверки
This commit is contained in:
14
scripts/find-unused-code/ignore-files.js
Normal file
14
scripts/find-unused-code/ignore-files.js
Normal file
@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
ignore: [
|
||||
'src/core/hooks/useEqualMemo',
|
||||
'src/core/hooks/useParams',
|
||||
'src/core/hooks/useQuery',
|
||||
'src/core/hooks/useToggle',
|
||||
'src/core/referers/common',
|
||||
'src/core/utils/asyncDataUtils',
|
||||
'src/core/utils/makeTreeList',
|
||||
'src/core/utils/objectKeys',
|
||||
'src/core/utils/triggerLink',
|
||||
'src/core/utils/jsonStringify',
|
||||
],
|
||||
};
|
||||
16
scripts/find-unused-code/index.js
Normal file
16
scripts/find-unused-code/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
const configurator = require("ts-prune/lib/configurator");
|
||||
const runner = require("ts-prune/lib/runner");
|
||||
const {ignore} = require('./ignore-files');
|
||||
|
||||
const error = [];
|
||||
|
||||
runner.run(configurator.getConfig(), (text) => {
|
||||
if (ignore.every(ign => !text.includes(ign))) {
|
||||
error.push(text);
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
if (error.length) {
|
||||
throw new Error(`Присутствует не используемый код: \n${error.join('\n')}`);
|
||||
}
|
||||
}, 0);
|
||||
Reference in New Issue
Block a user