Skip to content

chore: add lint:unused script to run Knip #241

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Lint Files
run: npm run lint

- name: Lint Files, Dependencies, & Exports
run: npm run lint:unused

- name: Check Formatting
run: npm run fmt:check

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Publish @eslint/compat package to JSR
run: |
npm run build --if-present
npx jsr publish
npx -y jsr publish
working-directory: packages/compat
if: ${{ steps.release.outputs['packages/compat--release_created'] }}

Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Publish @eslint/core package to JSR
run: |
npm run build --if-present
npx jsr publish
npx -y jsr publish
working-directory: packages/core
if: ${{ steps.release.outputs['packages/core--release_created'] }}

Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish @eslint/object-schema package to JSR
run: npx jsr publish
run: npx -y jsr publish
working-directory: packages/object-schema
if: ${{ steps.release.outputs['packages/object-schema--release_created'] }}

Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish @eslint/config-array package to JSR
run: npx jsr publish
run: npx -y jsr publish
working-directory: packages/config-array
if: ${{ steps.release.outputs['packages/config-array--release_created'] }}

Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish @eslint/plugin-kit package to JSR
run: npx jsr publish
run: npx -y jsr publish
working-directory: packages/plugin-kit
if: ${{ steps.release.outputs['packages/plugin-kit--release_created'] }}

Expand Down
30 changes: 30 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"workspaces": {
".": {
"entry": ["scripts/*.js", "tools/*.js", ".github/workflows/*.yml"]
},
"packages/migrate-config": {
"entry": ["src/migrate-config.js", "tests/**/*.{js,ts}"],
"project": ["src/**/*.{js,ts}", "tests/*.{js,ts}"]
},
"packages/config-array": {
"entry": ["tests/**/*.{js,ts}", "rollup.std__path-config.js"],
"project": ["src/**/*.{js,ts}", "tests/**/*.{js,ts}"]
},
"packages/plugin-kit": {
"entry": ["tests/**/*.{js,ts}"],
"project": ["src/**/*.{js,ts}", "tests/**/*.{js,ts}"]
},
"packages/compat": {
"entry": ["tests/**/*.{js,ts}"],
"project": ["src/**/*.{js,ts}", "tests/*.{js,ts}"]
},
"packages/object-schema": {
"entry": ["tests/**/*.{js,ts}", "src/types.ts"],
"project": ["src/**/*.{js,ts}", "tests/**/*.{js,ts}"]
},
"packages/core": {
"project": ["src/**/*.{js,ts}"]
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build:readme": "node tools/update-readme.js",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"lint:unused": "knip",
"fmt": "prettier --write .",
"fmt:check": "prettier --check .",
"test:jsr": "npm run test:jsr --workspaces --if-present",
Expand All @@ -28,10 +29,10 @@
"!(*.{js,ts})": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@types/mocha": "^10.0.7",
"eslint": "^9.11.1",
"eslint-config-eslint": "^11.0.0",
"got": "^14.4.1",
"knip": "^5.61.3",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"typescript": "^5.5.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"",
"build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"test": "mocha tests/*.js",
"test:coverage": "c8 npm test"
},
Expand All @@ -49,6 +49,7 @@
"homepage": "https://github.com/eslint/rewrite#readme",
"devDependencies": {
"@eslint/core": "^0.9.0",
"@types/mocha": "^10.0.7",
"c8": "^9.1.0",
"eslint": "^9.11.0",
"mocha": "^10.4.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/compat/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"files": ["src/index.js"],
"compilerOptions": {
"outDir": "dist/esm"
"outDir": "dist/esm",
"types": ["mocha", "@eslint/core"]
}
}
3 changes: 2 additions & 1 deletion packages/config-array/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"",
"build:std__path": "rollup -c rollup.std__path-config.js && node fix-std__path-imports",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts && npm run build:std__path",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"pretest": "npm run build",
"test": "mocha tests/",
"test:coverage": "c8 npm test"
Expand All @@ -54,6 +54,7 @@
"devDependencies": {
"@jsr/std__path": "^1.0.4",
"@types/minimatch": "^3.0.5",
"@types/mocha": "^10.0.7",
"c8": "^9.1.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/config-array/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"files": ["src/index.js"],
"compilerOptions": {
"outDir": "dist/esm"
"outDir": "dist/esm",
"types": ["mocha"]
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"",
"build": "tsc && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run"
"test:jsr": "npx -y jsr@latest publish --dry-run"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions packages/migrate-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"homepage": "https://github.com/eslint/rewrite#readme",
"devDependencies": {
"@types/eslint": "^9.6.0",
"@types/mocha": "^10.0.7",
"eslint": "^9.0.0",
"mocha": "^10.4.0",
"typescript": "^5.4.5"
Expand Down
3 changes: 2 additions & 1 deletion packages/migrate-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"files": ["src/migrate-config-cli.js"],
"compilerOptions": {
"outDir": "dist/esm"
"outDir": "dist/esm",
"types": ["mocha", "@types/eslint"]
}
}
3 changes: 2 additions & 1 deletion packages/object-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"",
"build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"test": "mocha tests/",
"test:coverage": "c8 npm test"
},
Expand All @@ -48,6 +48,7 @@
},
"homepage": "https://github.com/eslint/rewrite#readme",
"devDependencies": {
"@types/mocha": "^10.0.7",
"c8": "^9.1.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/object-schema/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"files": ["src/index.js"],
"compilerOptions": {
"outDir": "dist/esm"
"outDir": "dist/esm",
"types": ["mocha"]
}
}
3 changes: 2 additions & 1 deletion packages/plugin-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"pretest": "npm run build",
"test": "mocha tests/",
"test:coverage": "c8 npm test"
Expand All @@ -48,6 +48,7 @@
"devDependencies": {
"@eslint/core": "^0.9.0",
"@types/levn": "^0.4.0",
"@types/mocha": "^10.0.7",
"c8": "^9.1.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-kit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"files": ["src/index.js"],
"compilerOptions": {
"outDir": "dist/esm",
"strict": true
"strict": true,
"types": ["mocha"]
}
}