Update
This commit is contained in:
parent
4563047e01
commit
690b46fd2b
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Generated by dts-bundle-generator v9.0.0
|
||||
// Generated by dts-bundle-generator v9.2.1
|
||||
|
||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||
import { Rule } from 'eslint';
|
||||
|
13
dist/package.json
vendored
13
dist/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "0.0.10-beta.5",
|
||||
"version": "0.0.11",
|
||||
"license": "UNLICENSED",
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.53.0",
|
||||
@ -9,14 +9,13 @@
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/eslint": "^8.56.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
||||
"@typescript-eslint/parser": "^6.15.0",
|
||||
"@typescript-eslint/type-utils": "^6.15.0",
|
||||
"@typescript-eslint/utils": "^6.15.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
||||
"@typescript-eslint/parser": "^6.16.0",
|
||||
"@typescript-eslint/type-utils": "^6.16.0",
|
||||
"@typescript-eslint/utils": "^6.16.0",
|
||||
"aria-query": "^5.3.0",
|
||||
"axe-core": "4.8.3",
|
||||
"axobject-query": "^4.0.0",
|
||||
"common-path-prefix": "^3.0.0",
|
||||
"damerau-levenshtein": "1.0.8",
|
||||
"debug": "^4.3.4",
|
||||
"doctrine": "^3.0.0",
|
||||
@ -27,7 +26,7 @@
|
||||
"eslint-import-resolver-node": "^0.3.9",
|
||||
"eslint-module-utils": "^2.8.0",
|
||||
"eslint-plugin-es-x": "7.5.0",
|
||||
"eslint-plugin-jsdoc": "^46.9.1",
|
||||
"eslint-plugin-jsdoc": "^46.10.1",
|
||||
"eslint-plugin-unicorn": "^50.0.1",
|
||||
"estraverse": "^5.3.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
|
24
package.json
24
package.json
@ -6,39 +6,39 @@
|
||||
},
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.6",
|
||||
"@babel/core": "^7.23.7",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.23.3",
|
||||
"@babel/preset-env": "^7.23.6",
|
||||
"@babel/preset-env": "^7.23.7",
|
||||
"@types/babel-plugin-macros": "^3.1.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/eslint": "^8.56.0",
|
||||
"@types/estree": "^1.0.5",
|
||||
"@types/estree-jsx": "^1.0.3",
|
||||
"@types/lodash": "^4.14.202",
|
||||
"@types/node": "^20.10.5",
|
||||
"@typescript-eslint/eslint-plugin": "6.15.0",
|
||||
"@typescript-eslint/type-utils": "^6.15.0",
|
||||
"@typescript-eslint/types": "^6.15.0",
|
||||
"@typescript-eslint/typescript-estree": "^6.15.0",
|
||||
"@typescript-eslint/utils": "^6.15.0",
|
||||
"@types/node": "^20.10.6",
|
||||
"@typescript-eslint/eslint-plugin": "6.16.0",
|
||||
"@typescript-eslint/type-utils": "^6.16.0",
|
||||
"@typescript-eslint/types": "^6.16.0",
|
||||
"@typescript-eslint/typescript-estree": "^6.16.0",
|
||||
"@typescript-eslint/utils": "^6.16.0",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"dts-bundle-generator": "^9.0.0",
|
||||
"dts-bundle-generator": "^9.2.1",
|
||||
"esbin": "0.0.4",
|
||||
"esbuild": "0.19.10",
|
||||
"esbuild": "0.19.11",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-define-config": "^1.24.1",
|
||||
"fast-glob": "^3.3.2",
|
||||
"find-cache-dir": "^5.0.0",
|
||||
"json-schema-to-ts": "^2.9.2",
|
||||
"json-schema-to-ts": "^3.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"minimatch": "^9.0.3",
|
||||
"patch-package": "^8.0.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"prettier": "^3.1.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"typescript": "5.3.3"
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"prettier": {
|
||||
"arrowParens": "avoid",
|
||||
|
1057
pnpm-lock.yaml
generated
1057
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -8,27 +8,39 @@ import { dependencies, peerDependencies } from '../dist/package.json';
|
||||
const deps = Object.keys({ ...dependencies, ...peerDependencies }).concat('eslint');
|
||||
const builtIn = new Set(builtinModules.flatMap(module => [module, `node:${module}`]));
|
||||
|
||||
const files = Object.fromEntries(
|
||||
glob
|
||||
.sync('dist/**/*.js')
|
||||
.map(path => [
|
||||
path,
|
||||
uniq(
|
||||
Array.from(fs.readFileSync(path, 'utf8').matchAll(/require\(["']([^"']+)["']\)/g))
|
||||
function findRequires(text: string) {
|
||||
const list = Array.from(text.matchAll(/require\(["']([^"']+)["']\)/g))
|
||||
.map(m => m[1])
|
||||
.filter(
|
||||
module =>
|
||||
!(
|
||||
builtIn.has(module) ||
|
||||
deps.includes(module) ||
|
||||
deps.some(dep => module.startsWith(`${dep}/`)) ||
|
||||
module.startsWith('eslint/') ||
|
||||
module.startsWith('typescript/')
|
||||
),
|
||||
);
|
||||
return uniq(list);
|
||||
}
|
||||
|
||||
const moduleMap = glob
|
||||
.sync('dist/**/*.js')
|
||||
.map(path => ({ key: path, value: findRequires(fs.readFileSync(path, 'utf8')) }));
|
||||
|
||||
const files = Object.fromEntries(
|
||||
moduleMap
|
||||
.map(({ key, value }) => ({
|
||||
key,
|
||||
value: value.filter(
|
||||
module =>
|
||||
!(deps.includes(module) || deps.some(dep => module.startsWith(`${dep}/`))),
|
||||
),
|
||||
),
|
||||
])
|
||||
.filter(([, modules]) => modules.length > 0),
|
||||
}))
|
||||
.filter(({ value }) => value.length > 0)
|
||||
.map(({ key, value }) => [key, value]),
|
||||
);
|
||||
const uselessDeps = Object.keys(dependencies).filter(
|
||||
dep => !moduleMap.some(({ value }) => value.includes(dep)),
|
||||
);
|
||||
|
||||
console.log(files);
|
||||
console.log('Missing imports:', files);
|
||||
console.log('Unused dependencies:', uselessDeps);
|
||||
|
Loading…
x
Reference in New Issue
Block a user