Skip to content
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

fix(linter): do not replace legacy package in binary files #16617

Merged
merged 1 commit into from
Apr 27, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Tree, formatFiles, visitNotIgnoredFiles } from '@nx/devkit';
import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package';

import { basename } from 'path';
import { isBinaryPath } from '@nx/devkit/src/utils/binary-extensions';

const eslintFileNames = [
'.eslintrc',
Expand All @@ -28,6 +29,10 @@ export default async function replacePackage(tree: Tree): Promise<void> {
*/
const ignoreLineRegex = /(eslint-disable(?:(?:-next)?-line)?\s*)@nrwl\/nx/g;
visitNotIgnoredFiles(tree, '.', (path) => {
if (isBinaryPath(path)) {
return;
}

let contents = tree.read(path).toString();
if (eslintFileNames.includes(basename(path))) {
if (!contents.includes('@nrwl/nx')) {
Expand Down