Skip to content

Commit 62e4012

Browse files
committed
Merge branch 'main' into next
# Conflicts: # jest.config.js # package.json # src/config/jest.config.js # yarn.lock
2 parents 955ea31 + ad6df53 commit 62e4012

File tree

24 files changed

+3783
-2467
lines changed

24 files changed

+3783
-2467
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959

6060
- name: Upload Coverage / Release
6161
run: yarn ci-after-success
62-
if: ${{ matrix.node == '14' }}
62+
if: ${{ matrix.node == '16' }}
6363
env:
6464
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6565
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.13.0
1+
18.12.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ This project is actively maintained by engineers at
294294
[license-badge]: https://img.shields.io/npm/l/@hover/javascript.svg
295295
[license-link]: https://github.com/hoverinc/hover-javascript/blob/master/LICENSE
296296
[node-link]: https://nodejs.org/en/download/
297-
[node-badge]: https://img.shields.io/badge/node-v16.13.0-green
297+
[node-badge]: https://img.shields.io/badge/node-v18.12.1-green
298298
[prettier-badge]:
299299
https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier
300300
[prettier-link]: https://prettierjs.org/en/download/

jest.config.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,4 @@ module.exports = {
1111
roots: ['<rootDir>/src'],
1212
coverageThreshold: null,
1313
transformIgnorePatterns: [...transformIgnorePatterns, '.prettierrc.js'],
14-
// Specifying ts-jest options via `global` in Jest configuration has been
15-
// deprecated so we have to do this in order to add the `exclude` option to
16-
// the transform in our Jest configuration that already has `transform` ☹
17-
transform: Object.fromEntries(
18-
Object.entries(transform).map(([glob, [transformer, options]]) => [
19-
glob,
20-
[transformer, {...options, exclude: '**/*'}],
21-
]),
22-
),
2314
}

package.json

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.0.0-semantically-released",
44
"description": "CLI toolbox for common scripts for JavaScript + TypeScript projects",
55
"engines": {
6-
"node": ">=12",
6+
"node": ">=v12.22.12",
77
"npm": ">=6",
8-
"yarn": ">=1"
8+
"yarn": ">=1.22.19"
99
},
1010
"publishConfig": {
1111
"registry": "https://registry.npmjs.org"
@@ -26,7 +26,7 @@
2626
"start": "run-p start:*",
2727
"start:source": "yarn build:source --watch",
2828
"start:types": "tsc -b -w --preserveWatchOutput src/",
29-
"test": "node src test",
29+
"test": "SWC_NODE_PROJECT=src/tsconfig.json node src test",
3030
"test:update": "node src test --updateSnapshot",
3131
"validate": "node src validate",
3232
"prepare": "husky install"
@@ -50,50 +50,52 @@
5050
"author": "Jamie Rolfs <[email protected]>",
5151
"license": "MIT",
5252
"dependencies": {
53-
"@commitlint/cli": "^16.1.0",
54-
"@commitlint/config-conventional": "^16.2.1",
55-
"@commitlint/prompt": "^16.1.0",
56-
"@types/jest": "^29.0.0",
57-
"@types/lodash.has": "^4.5.6",
53+
"@commitlint/cli": "^17.4.2",
54+
"@commitlint/config-conventional": "^17.4.2",
55+
"@commitlint/prompt": "^17.4.2",
56+
"@swc-node/jest": "^1.5.6",
57+
"@swc/core": "^1.3.27",
58+
"@swc/helpers": "^0.4.14",
59+
"@types/jest": "^29.2.5",
60+
"@types/lodash.has": "^4.5.7",
5861
"@types/mkdirp": "^1.0.2",
59-
"@types/node": ">=17.x",
62+
"@types/node": "^18.11.18",
6063
"@types/rimraf": "^3.0.2",
6164
"@types/which": "^2.0.1",
62-
"@typescript-eslint/eslint-plugin": "^5.13.0",
63-
"@typescript-eslint/parser": "^5.27.0",
64-
"arrify": "^2.0.1",
65-
"commitizen": "^4.2.4",
66-
"concurrently": "^7.0.0",
67-
"cosmiconfig": "^7.0.1",
65+
"@typescript-eslint/eslint-plugin": "^5.48.2",
66+
"@typescript-eslint/parser": "^5.48.2",
67+
"commitizen": "^4.2.6",
68+
"concurrently": "^7.6.0",
69+
"cosmiconfig": "^8.0.0",
6870
"cross-env": "^7.0.3",
69-
"cross-spawn": "^7.0.1",
70-
"doctoc": "^2.1.0",
71-
"eslint": "^8.16.0",
72-
"eslint-config-airbnb": "19.0.0",
71+
"cross-spawn": "^7.0.3",
72+
"doctoc": "^2.2.1",
73+
"eslint": "^8.32.0",
74+
"eslint-config-airbnb": "19.0.4",
7375
"eslint-config-airbnb-typescript": "^17.0.0",
74-
"eslint-config-prettier": "^8.5.0",
75-
"eslint-plugin-import": "^2.25.4",
76-
"eslint-plugin-jest": "^26.1.1",
77-
"eslint-plugin-jsx-a11y": "^6.5.1",
78-
"eslint-plugin-prettier": "^4.0.0",
79-
"eslint-plugin-react": "^7.30.0",
80-
"eslint-plugin-react-hooks": "^4.3.0",
81-
"glob": "^8.0.3",
76+
"eslint-config-prettier": "^8.6.0",
77+
"eslint-plugin-import": "^2.27.5",
78+
"eslint-plugin-jest": "^27.2.1",
79+
"eslint-plugin-jsx-a11y": "^6.7.1",
80+
"eslint-plugin-prettier": "^4.2.1",
81+
"eslint-plugin-react": "^7.32.1",
82+
"eslint-plugin-react-hooks": "^4.6.0",
83+
"glob": "^8.1.0",
8284
"is-ci": "^3.0.1",
83-
"jest": "^29.0.2",
85+
"jest": "^29.3.1",
86+
"jest-environment-jsdom": "^29.3.1",
8487
"jest-github-actions-reporter": "^1.0.3",
85-
"jest-watch-typeahead": "^2.1.1",
86-
"lint-staged": "^12.3.4",
88+
"jest-watch-typeahead": "^2.2.1",
89+
"lint-staged": "^13.1.0",
8790
"lodash.has": "^4.5.2",
88-
"mkdirp": "^1.0.3",
89-
"prettier": "^2.5.1",
91+
"mkdirp": "^2.1.3",
92+
"prettier": "^2.8.3",
9093
"read-pkg-up": "^7.0.1",
91-
"rimraf": "^3.0.2",
92-
"ts-jest": "^29.0.0-next.1",
93-
"tslib": "^2.4.0",
94+
"rimraf": "^4.1.1",
95+
"tslib": "^2.4.1",
9496
"typescript": "^4",
95-
"which": "^2.0.2",
96-
"yargs-parser": "^21.0.1"
97+
"which": "^3.0.0",
98+
"yargs-parser": "^21.1.1"
9799
},
98100
"eslintConfig": {
99101
"parserOptions": {
@@ -109,7 +111,8 @@
109111
"import/no-unassigned-import": "off",
110112
"no-console": "off",
111113
"no-nested-ternary": "off",
112-
"no-useless-catch": "off"
114+
"no-useless-catch": "off",
115+
"jest/prefer-snapshot-hint": "off"
113116
}
114117
},
115118
"eslintIgnore": [
@@ -126,15 +129,23 @@
126129
},
127130
"homepage": "https://github.com/hoverinc/hover-javascript#readme",
128131
"devDependencies": {
129-
"@babel/cli": "^7.17.10",
130-
"@babel/core": "^7.17.2",
131-
"@babel/preset-env": "^7.16.11",
132+
"@babel/cli": "^7.20.7",
133+
"@babel/core": "^7.20.12",
134+
"@babel/preset-env": "^7.20.2",
132135
"@types/cross-spawn": "^6.0.2",
133136
"depcheck": "^1.4.3",
134-
"eslint-config-kentcdodds": "^20.0.1",
135-
"husky": "^7.0.4",
137+
"eslint-config-kentcdodds": "^20.4.0",
138+
"husky": "^8.0.3",
136139
"jest-in-case": "^1.0.2",
137140
"npm-run-all": "^4.1.5",
138141
"slash": "^3.0.0"
142+
},
143+
"peerDependencies": {
144+
"ts-jest": "^29.0.0"
145+
},
146+
"peerDependenciesMeta": {
147+
"ts-jest": {
148+
"optional": true
149+
}
139150
}
140151
}

renovate.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>jrolfs/renovate:npm.json5",
5+
"github>jrolfs/renovate:npm-feat.json5"
6+
],
7+
"packageRules": [
8+
{
9+
"matchPackagePatterns": ["eslint"],
10+
"groupName": "eslint"
11+
}
12+
]
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!node_modules

src/api/__tests__/__fixtures__/ls/dirs/node_modules/.gitkeep

Whitespace-only changes.

src/api/__tests__/commit.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,29 @@ describe('ls', () => {
2626
})
2727

2828
test('with prefix', () => {
29-
const result = ls.dirs(`${fixtures}/ls/dirs`, 'prefix')
29+
const result = ls.dirs(`${fixtures}/ls/dirs`, {prefix: 'prefix'})
3030

3131
const expected = ['prefix/.baz', 'prefix/bar', 'prefix/foo']
3232

3333
expect(result.sort()).toEqual(expected.sort())
3434
})
35+
36+
test('with custom exclude (string)', () => {
37+
const result = ls.dirs(`${fixtures}/ls/dirs`, {exclude: 'foo'})
38+
39+
const expected = ['.baz', 'bar', 'node_modules']
40+
41+
expect(result.sort()).toEqual(expected.sort())
42+
})
43+
44+
test('with custom exclude (RegExp)', () => {
45+
const result = ls.dirs(`${fixtures}/ls/dirs`, {
46+
exclude: /(^node_modules|^bar)/,
47+
})
48+
49+
const expected = ['.baz', 'foo']
50+
51+
expect(result.sort()).toEqual(expected.sort())
52+
})
3553
})
3654
})

src/api/__tests__/test.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/api/commit.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,39 @@ const configs = path =>
4444
)}`,
4545
)
4646

47+
/**
48+
* @typedef DirsOptions
49+
* @property {string} [prefix] prefix to prepend to each scope entry (e.g:
50+
* `{ prefix: 'prefix' }` becomes `type(prefix/scope)`)
51+
* @property {RegExp | string | null} [exclude] expression for excluding
52+
* directories, defaults to `^node_modules`
53+
*/
54+
4755
/**
4856
* Enumerate one level of directories
4957
*
5058
* @param {string} path - directory to enumerate
51-
* @param {string} [prefix] - prefix for each scope entry (e.g: `prefix/entry`)
59+
* @param {DirsOptions} options -
5260
*/
53-
const dirs = (path, prefix) =>
54-
readdirSync(path)
55-
.filter(f => statSync(join(path, f)).isDirectory())
61+
const dirs = (path, options) => {
62+
const {exclude, prefix} = {exclude: /^node_modules/, ...options}
63+
64+
/**
65+
* @param {string} f filename
66+
*/
67+
const test = f => {
68+
if (!exclude) return true
69+
70+
return !(typeof exclude === 'string'
71+
? f.includes(exclude)
72+
: exclude.test(f))
73+
}
74+
75+
return readdirSync(path)
76+
.filter(f => statSync(join(path, f)).isDirectory() && test(f))
5677
.map(item => (prefix ? `${prefix}/${item}` : item))
5778
.map(item => item.toLowerCase())
79+
}
5880

5981
const ls = {configs, dirs}
6082

src/api/depcheck/depcheck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs')
22
const depcheck = require('depcheck')
3-
const hoverSpecials = require('./specials')
43
const {hasFile, uniq} = require('../../utils')
4+
const hoverSpecials = require('./specials')
55

66
/**
77
* @typedef Config

src/api/test.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/config/__tests__/__snapshots__/eslintrc.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Object {
119119
},
120120
],
121121
"import/prefer-default-export": "off",
122+
"jest/prefer-snapshot-hint": "off",
122123
"no-implied-eval": "error",
123124
"no-throw-literal": "error",
124125
"no-void": Array [
@@ -251,6 +252,7 @@ Object {
251252
},
252253
],
253254
"import/prefer-default-export": "off",
255+
"jest/prefer-snapshot-hint": "off",
254256
"no-implied-eval": "error",
255257
"no-throw-literal": "error",
256258
"no-void": Array [

src/config/helpers/build-eslint.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ const buildConfig = ({withReact = false} = {}) => {
6969
],
7070
'no-void': ['error', {allowAsStatement: true}],
7171
'prettier/prettier': 'error',
72+
// TODO: consider enabling this as a warning?
73+
'jest/prefer-snapshot-hint': 'off',
7274
...parserRules(false, isReact),
7375
},
7476
overrides: [

src/config/helpers/build-lint-staged.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {resolveHoverScripts, resolveBin} = require('../../utils')
33
const hoverScripts = resolveHoverScripts()
44
const doctoc = resolveBin('doctoc')
55

6-
const defaultTestCommand = `${hoverScripts} test --findRelatedTests`
6+
const defaultTestCommand = `${hoverScripts} test --findRelatedTests --passWithNoTests`
77

88
const sourceExtensions = ['js', 'jsx', 'ts', 'tsx']
99

0 commit comments

Comments
 (0)