diff --git a/__tests__/generate.spec.ts b/__tests__/generate.spec.ts index 7fce09d0..1ae09f2b 100644 --- a/__tests__/generate.spec.ts +++ b/__tests__/generate.spec.ts @@ -60,7 +60,7 @@ describe('Generate', () => { readFile.mockImplementation((file, callback): void => { const fullPath = path.join( __dirname, - withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile] + withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile], ); const content = readFileSync(fullPath); callback(null, content); @@ -73,7 +73,7 @@ describe('Generate', () => { check: true, preserveBlockPosition: true, }, - { parent: {} } + { parent: {} }, ); }); it('should generate a CODEOWNERS file (re-using codeowners content) and fail when using --check option', async () => { @@ -91,7 +91,7 @@ describe('Generate', () => { readFile.mockImplementation((file, callback): void => { const fullPath = path.join( __dirname, - withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile] + withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile], ); const content = readFileSync(fullPath); callback(null, content); @@ -99,7 +99,7 @@ describe('Generate', () => { await generateCommand( { output: 'CODEOWNERS', customRegenerationCommand: 'yarn codeowners-generator generate', check: true }, - { parent: {} } + { parent: {} }, ); expect(mockExit).toBeCalledWith(1); @@ -118,7 +118,7 @@ describe('Generate', () => { readFile.mockImplementation((file, callback): void => { const fullPath = path.join( __dirname, - withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile] + withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile], ); const content = readFileSync(fullPath); callback(null, content); @@ -126,7 +126,7 @@ describe('Generate', () => { await generateCommand( { output: 'CODEOWNERS', customRegenerationCommand: 'yarn codeowners-generator generate' }, - { parent: {} } + { parent: {} }, ); expect(writeFile.mock.calls[0]).toMatchInlineSnapshot(` [ @@ -183,7 +183,7 @@ describe('Generate', () => { readFile.mockImplementation((file, callback): void => { const fullPath = path.join( __dirname, - withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile] + withPopulatedCodeownersFile[file as keyof typeof withPopulatedCodeownersFile], ); const content = readFileSync(fullPath); callback(null, content); @@ -195,7 +195,7 @@ describe('Generate', () => { customRegenerationCommand: 'yarn codeowners-generator generate', preserveBlockPosition: true, }, - { parent: {} } + { parent: {} }, ); expect(writeFile.mock.calls[0]).toMatchInlineSnapshot(` [ @@ -253,7 +253,7 @@ describe('Generate', () => { groupSourceComments: true, customRegenerationCommand: 'npm run codeowners-generator generate', }, - { parent: {} } + { parent: {} }, ); expect(writeFile.mock.calls).toMatchInlineSnapshot(` [ @@ -337,7 +337,7 @@ describe('Generate', () => { output: 'CODEOWNERS', useMaintainers: true, }, - }) + }), ); const packageFiles = { @@ -355,7 +355,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -413,7 +413,7 @@ describe('Generate', () => { output: 'CODEOWNERS', useMaintainers: true, }, - }) + }), ); const packageFiles = { @@ -431,7 +431,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -484,7 +484,7 @@ describe('Generate', () => { groupSourceComments: true, includes: ['dir1/*', 'dir2/*', 'dir5/*', 'dir6/*', 'dir7/*'], }, - }) + }), ); const packageFiles = { @@ -501,7 +501,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -545,7 +545,7 @@ describe('Generate', () => { groupSourceComments: true, includes: ['dir1/*', 'dir2/*', 'dir5/*', 'dir6/*', 'dir7/*'], }, - }) + }), ); const packageFiles = { @@ -562,7 +562,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -616,7 +616,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -671,7 +671,7 @@ describe('Generate', () => { const withAddedPackageFiles = { ...packageFiles, ...withGitIgnore }; readFile.mockImplementation((file, callback) => { const content = readFileSync( - path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]) + path.join(__dirname, withAddedPackageFiles[file as keyof typeof withAddedPackageFiles]), ); callback(null, content); }); @@ -788,7 +788,7 @@ describe('Generate', () => { parent: { includes: ['**/NOT_STANDARD_CODEOWNERS'], }, - } + }, ); expect(stopAndPersist.mock.calls).toMatchInlineSnapshot(` [ diff --git a/index.html b/index.html index 267ad672..8490373f 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - +
diff --git a/package-lock.json b/package-lock.json index 33f002d1..5d533e98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "jest": "^29.0.0", "jest-mock-process": "^2.0.0", "lint-staged": "13.0.3", - "prettier": "2.7.1", + "prettier": "3.1.0", "tslib": "2.4.0", "tsx": "^3.12.5", "typescript": "4.7.4" @@ -7759,15 +7759,15 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -14070,9 +14070,9 @@ "dev": true }, "prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true }, "pretty-format": { diff --git a/package.json b/package.json index f08913ca..b73bc1ab 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "jest": "^29.0.0", "jest-mock-process": "^2.0.0", "lint-staged": "13.0.3", - "prettier": "2.7.1", + "prettier": "3.1.0", "tslib": "2.4.0", "tsx": "^3.12.5", "typescript": "4.7.4" diff --git a/src/bin/cli.ts b/src/bin/cli.ts index 13c8e0aa..1cc2ff7e 100644 --- a/src/bin/cli.ts +++ b/src/bin/cli.ts @@ -17,31 +17,31 @@ program .option( '--use-maintainers', 'For every package.json found, generate a CODEOWNERS entry using the maintainers field', - false + false, ) .option( '--use-root-maintainers', 'It will use `maintainers` field from the package.json in the root to generate default codeowners. Works only in conjunction with `useMaintainers`', - false + false, ) .option( '--group-source-comments', 'Instead of generating one comment per rule, enabling this flag will group them, reducing comments to one per source file. Useful if your codeowners file gets too noisy', - false + false, ) .option( '--preserve-block-position', 'It will keep the generated block in the same position it was found in the CODEOWNERS file (if present). Useful for when you make manual additions', - false + false, ) .option( '--custom-regeneration-command', - 'Specify a custom regeneration command to be printed in the generated CODEOWNERS file, it should be mapped to run codeowners-generator' + 'Specify a custom regeneration command to be printed in the generated CODEOWNERS file, it should be mapped to run codeowners-generator', ) .option('--output [output file]', 'The output path and name of the file, (default: CODEOWNERS)') .option( '--check', - 'It will fail if the CODEOWNERS generated does not match the current (or missing) CODEOWNERS. Useful for validating that the CODEOWNERS file is up to date date during CI' + 'It will fail if the CODEOWNERS generated does not match the current (or missing) CODEOWNERS. Useful for validating that the CODEOWNERS file is up to date date during CI', ) .action(generateCommand); diff --git a/src/commands/generate.ts b/src/commands/generate.ts index 06bcfb44..55177b71 100644 --- a/src/commands/generate.ts +++ b/src/commands/generate.ts @@ -73,7 +73,7 @@ export const generate: Generate = async ({ rootDir, includes, useMaintainers = f const filteredJSONs: string[] = groups.json.filter((packageJsonFile: string) => { if (codeownersDirNames.has(dirname(packageJsonFile))) { console.warn( - `We will ignore the package.json ${packageJsonFile}, given that we have encountered a CODEOWNERS file at the same dir level` + `We will ignore the package.json ${packageJsonFile}, given that we have encountered a CODEOWNERS file at the same dir level`, ); return false; } @@ -147,13 +147,13 @@ export const command = async (options: Options, command: Command): Promise