Skip to content

Commit

Permalink
Add unimported to workflow (#2441)
Browse files Browse the repository at this point in the history
* Remove unused file: lib/sinon/blob.js

The last reference to this file was removed in 6b1841f, making it safe to remove

* Move getConfig into test/

This has only been in use by tests since e37e1a6, so doesn't belong in the src/ folder anymore

* Remove unused lib/sinon/util/core/restore.js

Searching the git history, we find that the last reference to this file
was removed with e37e1a6.

```
git log -p --full-history --all -G'require.*restore"' li
```

Therefore, it is safe to remove the file.

* Add check for unimported files

This allows us to find files that are no longer in use in the project
and can be safely removed.

See https://github.com/smeijer/unimported

* fixup! Remove unused lib/sinon/util/core/restore.js
  • Loading branch information
mroderick committed Jan 31, 2022
1 parent 209f71f commit f329a01
Show file tree
Hide file tree
Showing 10 changed files with 1,556 additions and 104 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
branches:
- '**'
- "**"

jobs:
prettier:
Expand Down Expand Up @@ -56,6 +56,29 @@ jobs:
run: |
npm run lint
unused:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Cache modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
- name: Find unused files
run: |
npm run unimported
browser-test:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions .unimportedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"entry": ["lib/sinon.js", "lib/sinon-esm.js"],
"extensions": [".js"],
"ignorePatterns": ["**/node_modules/**"],
"ignoreUnresolved": [],
"ignoreUnimported": ["docs/**", "pkg/**", "test/**"],
"ignoreUnused": []
}
9 changes: 0 additions & 9 deletions lib/sinon/blob.js

This file was deleted.

16 changes: 0 additions & 16 deletions lib/sinon/util/core/restore.js

This file was deleted.

Loading

0 comments on commit f329a01

Please sign in to comment.