Skip to content

Commit 5fd8eea

Browse files
authored
feat!: bump all (dev)Dependencies, drop node < 16 (#449)
1 parent c4b5aa1 commit 5fd8eea

11 files changed

Lines changed: 102 additions & 105 deletions

.changeset/new-years-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"prettier-eslint-cli": major
3+
---
4+
5+
feat!: bump all (dev)Dependencies, drop node < 16

__mocks__/glob.js

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,94 @@
1-
module.exports = jest.fn(function mockGlob(globString, options, callback) {
1+
const glob = jest.fn(async function mockGlob(globString) {
22
/* eslint complexity:0 */
33
if (globString.includes('1')) {
4-
callback(null, [
4+
return [
55
fredProject('index.js'),
66
fredProject('start.js'),
77
fredProject('stop/index.js'),
88
fredProject('stop/log.js')
9-
]);
10-
} else if (globString.includes('2')) {
11-
callback(null, [
9+
];
10+
}
11+
12+
if (globString.includes('2')) {
13+
return [
1214
fredProject('index.js'),
1315
fredProject('start.js'),
1416
fredProject('continue/index.js'),
1517
fredProject('continue/forever.js')
16-
]);
17-
} else if (globString.includes('node_modules')) {
18-
callback(null, [
18+
];
19+
}
20+
21+
if (globString.includes('node_modules')) {
22+
return [
1923
fredProject('foo/node_modules/stuff1.js'),
2024
fredProject('foo/node_modules/stuff2.js'),
2125
fredProject('foo/node_modules/stuff3.js')
22-
]);
23-
} else if (globString.includes('files-with-syntax-errors')) {
24-
callback(null, [
25-
fredProject('syntax-error1.js'),
26-
fredProject('syntax-error2.js')
27-
]);
28-
} else if (globString.includes('no-match')) {
29-
callback(null, []);
30-
} else if (globString.includes('throw-error')) {
31-
callback(new Error('something weird happened'));
32-
} else if (globString.includes('no-change')) {
33-
callback(null, [
26+
];
27+
}
28+
29+
if (globString.includes('files-with-syntax-errors')) {
30+
return [fredProject('syntax-error1.js'), fredProject('syntax-error2.js')];
31+
}
32+
33+
if (globString.includes('no-match')) {
34+
return [];
35+
}
36+
37+
if (globString.includes('throw-error')) {
38+
throw new Error('something weird happened');
39+
}
40+
41+
if (globString.includes('no-change')) {
42+
return [
3443
fredProject('no-change/1.js'),
3544
fredProject('no-change/2.js'),
3645
fredProject('no-change/3.js')
37-
]);
38-
} else if (globString.includes('eslintignored')) {
39-
callback(null, [
46+
];
47+
}
48+
49+
if (globString.includes('eslintignored')) {
50+
return [
4051
fredProject('eslintignored1.js'),
4152
fredProject('eslintignored2.js'),
4253
fredProject('eslintignored3.js'),
4354
fredProject('applied4.js')
44-
]);
45-
} else if (globString.includes('prettierignored')) {
46-
callback(null, [
55+
];
56+
}
57+
58+
if (globString.includes('prettierignored')) {
59+
return [
4760
fredProject('prettierignored1.js'),
4861
fredProject('prettierignored2.js'),
4962
fredProject('prettierignored3.js'),
5063
fredProject('applied4.js')
51-
]);
52-
} else if (globString.includes('no-ignore')) {
53-
callback(null, [
64+
];
65+
}
66+
67+
if (globString.includes('no-ignore')) {
68+
return [
5469
barneyProject('no-ignore/1.js'),
5570
barneyProject('no-ignore/2.js'),
5671
barneyProject('no-ignore/3.js')
57-
]);
58-
} else if (globString.includes('eslint-config-error')) {
59-
callback(null, [
72+
];
73+
}
74+
75+
if (globString.includes('eslint-config-error')) {
76+
return [
6077
fredProject('eslint-config-error/1.js'),
6178
fredProject('eslint-config-error/2.js')
62-
]);
63-
} else {
64-
throw new Error(
65-
`Your test globString: "${globString}"` +
66-
" doesn't have associated mock data."
67-
);
79+
];
6880
}
81+
82+
throw new Error(
83+
`Your test globString: "${globString}"` +
84+
" doesn't have associated mock data."
85+
);
6986
});
7087

88+
glob.glob = glob;
89+
90+
exports.glob = glob;
91+
7192
function fredProject(path) {
7293
return `/Users/fredFlintstone/Developer/top-secret/footless-carriage/${path}`;
7394
}

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
testEnvironment: 'node',
88
// TODO: test all the files...
99
// collectCoverageFrom: ['src/**/*.js'],
10-
testPathIgnorePatterns: ['/node_modules/', '/fixtures/'],
10+
testPathIgnorePatterns: ['/node_modules/', '/fixtures/', '/dist/'],
1111
coveragePathIgnorePatterns: ['/node_modules/', '/fixtures/', '/dist/'],
1212
coverageThreshold: {
1313
global: {

package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CLI for prettier-eslint",
55
"main": "dist/no-main.js",
66
"engines": {
7-
"node": ">=12.22"
7+
"node": ">=16.0.0"
88
},
99
"bin": {
1010
"prettier-eslint": "dist/index.js"
@@ -39,44 +39,44 @@
3939
}
4040
},
4141
"dependencies": {
42-
"@messageformat/core": "^3.0.1",
43-
"@prettier/eslint": "npm:prettier-eslint@^15.0.1",
42+
"@messageformat/core": "^3.2.0",
43+
"@prettier/eslint": "npm:prettier-eslint@^16.0.0",
4444
"arrify": "^2.0.1",
4545
"boolify": "^1.0.1",
46-
"camelcase-keys": "^7.0.2",
46+
"camelcase-keys": "^9.1.0",
4747
"chalk": "^4.1.2",
4848
"common-tags": "^1.8.2",
49-
"core-js": "^3.24.1",
50-
"eslint": "^8.21.0",
49+
"core-js": "^3.33.0",
50+
"eslint": "^8.51.0",
5151
"find-up": "^5.0.0",
5252
"get-stdin": "^8.0.0",
53-
"glob": "^7.2.3",
54-
"ignore": "^5.2.0",
53+
"glob": "^10.3.10",
54+
"ignore": "^5.2.4",
5555
"indent-string": "^4.0.0",
5656
"lodash.memoize": "^4.1.2",
5757
"loglevel-colored-level-prefix": "^1.0.0",
58-
"rxjs": "^7.5.6",
59-
"yargs": "^13.1.1"
58+
"rxjs": "^7.8.1",
59+
"yargs": "^17.7.2"
6060
},
6161
"devDependencies": {
62-
"@babel/cli": "^7.18.10",
63-
"@babel/core": "^7.18.10",
64-
"@babel/node": "^7.18.10",
65-
"@babel/preset-env": "^7.18.10",
66-
"@changesets/changelog-github": "^0.4.6",
67-
"@changesets/cli": "^2.24.3",
68-
"all-contributors-cli": "^6.20.0",
69-
"clean-pkg-json": "^1.0.1",
70-
"eslint-config-kentcdodds": "^20.3.1",
71-
"eslint-plugin-node-dependencies": "^0.8.0",
72-
"jest": "^28.1.3",
73-
"lint-staged": "^12.5.0",
62+
"@babel/cli": "^7.23.0",
63+
"@babel/core": "^7.23.2",
64+
"@babel/node": "^7.22.19",
65+
"@babel/preset-env": "^7.23.2",
66+
"@changesets/changelog-github": "^0.4.8",
67+
"@changesets/cli": "^2.26.2",
68+
"all-contributors-cli": "^6.26.1",
69+
"clean-pkg-json": "^1.2.0",
70+
"eslint-config-kentcdodds": "^20.5.0",
71+
"eslint-plugin-node-dependencies": "^0.11.0",
72+
"jest": "^29.7.0",
73+
"lint-staged": "^14.0.1",
7474
"nps": "^5.10.0",
7575
"nps-utils": "^1.7.0",
76-
"patch-package": "^6.4.7",
76+
"patch-package": "^8.0.0",
7777
"pify": "^5.0.0",
78-
"rimraf": "^3.0.2",
79-
"simple-git-hooks": "^2.8.0",
78+
"rimraf": "^5.0.5",
79+
"simple-git-hooks": "^2.9.0",
8080
"spawn-command": "0.0.2-1",
8181
"strip-indent": "^3.0.0",
8282
"yargs-parser": "^21.1.1"

patches/@rushstack+eslint-patch+1.1.4.patch

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

patches/eslint-config-kentcdodds+20.3.1.patch

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

src/__snapshots__/uncaught-exception-handler.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
exports[`logs a check for trace 1`] = `
44
"There has been an unknown error when running the prettier-eslint CLI. If it's unclear to you what went wrong, then try this:
5-
✅ Run the script again with the LOG_LEVEL environment variable set to \\"trace\\"
5+
✅ Run the script again with the LOG_LEVEL environment variable set to "trace"
66
2. Search existing issues on GitHub: https://github.com/prettier/prettier-eslint-cli/issues?utf8=%E2%9C%93&q=my%20error
77
3. Make a minimal reproduction in a totally separate repository. You can fork this one: https://github.com/kentcdodds/prettier-eslint-cli-repro
88
4. Post an issue with a link to your reproduction to the issues on GitHub: https://github.com/prettier/prettier-eslint-cli/issues/new"
99
`;
1010

1111
exports[`logs all options 1`] = `
1212
"There has been an unknown error when running the prettier-eslint CLI. If it's unclear to you what went wrong, then try this:
13-
1. Run the script again with the LOG_LEVEL environment variable set to \\"trace\\"
13+
1. Run the script again with the LOG_LEVEL environment variable set to "trace"
1414
2. Search existing issues on GitHub: https://github.com/prettier/prettier-eslint-cli/issues?utf8=%E2%9C%93&q=my%20error
1515
3. Make a minimal reproduction in a totally separate repository. You can fork this one: https://github.com/kentcdodds/prettier-eslint-cli-repro
1616
4. Post an issue with a link to your reproduction to the issues on GitHub: https://github.com/prettier/prettier-eslint-cli/issues/new"

src/format-files.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint complexity:[1, 7] */
33
import path from 'path';
44
import fs from 'fs';
5-
import glob from 'glob';
5+
import { glob } from 'glob';
66
import { bindNodeCallback, from, of } from 'rxjs';
77
import { catchError, concatAll, distinct, map, mergeMap } from 'rxjs/operators';
88
import chalk from 'chalk';
@@ -16,7 +16,6 @@ import format from './prettier-eslint';
1616
import * as messages from './messages';
1717

1818
const LINE_SEPERATOR_REGEX = /(\r|\n|\r\n)/;
19-
const rxGlob = bindNodeCallback(glob);
2019
const rxReadFile = bindNodeCallback(fs.readFile);
2120
const rxWriteFile = bindNodeCallback(fs.writeFile);
2221
const findUpEslintignoreSyncMemoized = memoize(
@@ -165,7 +164,8 @@ function formatFilesFromGlobs({
165164
}
166165

167166
function onComplete() {
168-
const isSilent = logger.getLevel() === logger.levels.SILENT || cliOptions.listDifferent;
167+
const isSilent =
168+
logger.getLevel() === logger.levels.SILENT || cliOptions.listDifferent;
169169

170170
/* use console.error directly here because
171171
* - we don't want these messages prefixed
@@ -219,7 +219,7 @@ function getFilesFromGlob(
219219
// not smart unless you explicitly include it in your glob
220220
globOptions.ignore.push('**/node_modules/**');
221221
}
222-
return rxGlob(fileGlob, globOptions).pipe(
222+
return from(glob(fileGlob, globOptions)).pipe(
223223
map(filePaths => {
224224
return filePaths.filter(filePath => {
225225
if (applyEslintIgnore && isFilePathMatchedByEslintignore(filePath)) {

src/format-files.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import fsMock from 'fs';
33
import findUpMock from 'find-up';
4-
import globMock from 'glob';
4+
import { glob as globMock } from 'glob';
55
import mockGetStdin from 'get-stdin';
66
import getLogger from 'loglevel-colored-level-prefix';
77
import formatMock from './prettier-eslint';
@@ -43,8 +43,7 @@ test('glob call inclues an ignore of node_modules', async () => {
4343
const globOptions = expect.objectContaining({
4444
ignore: expect.arrayContaining(['**/node_modules/**'])
4545
});
46-
const callback = expect.any(Function);
47-
expect(globMock).toHaveBeenCalledWith(fileGlob, globOptions, callback);
46+
expect(globMock).toHaveBeenCalledWith(fileGlob, globOptions);
4847
});
4948

5049
test('glob call excludes an ignore of node_modules', async () => {
@@ -55,8 +54,7 @@ test('glob call excludes an ignore of node_modules', async () => {
5554
expect.objectContaining({
5655
// should not have an ignore with **/node_modules/**
5756
ignore: expect.arrayContaining(['**/node_modules/**'])
58-
}),
59-
expect.any
57+
})
6058
);
6159
});
6260

@@ -189,8 +187,7 @@ test('allows you to specify an ignore glob', async () => {
189187
const globOptions = expect.objectContaining({
190188
ignore: [...ignore, '**/node_modules/**']
191189
});
192-
const callback = expect.any(Function);
193-
expect(globMock).toHaveBeenCalledWith(fileGlob, globOptions, callback);
190+
expect(globMock).toHaveBeenCalledWith(fileGlob, globOptions);
194191
});
195192

196193
test('wont modify a file if it is eslint ignored', async () => {

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ const parser = yargs
226226
// TODO: support range-start and range-end
227227
// would require changes in prettier-eslint
228228
})
229-
.strict();
229+
.strictOptions();
230230

231231
export default parser;
232232

0 commit comments

Comments
 (0)