Skip to content

Commit

Permalink
cleanup(core): remove console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Apr 3, 2024
1 parent 3cd80ea commit 6a20bcc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
2 changes: 0 additions & 2 deletions packages/nx/src/native/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ Module._load = function (request, parent, isMain) {
.digest('hex');
const tmpFile = join(nativeFileCacheLocation, hash + '-' + fileName);
if (existsSync(tmpFile)) {
console.log('file already exists @', tmpFile);
return originalLoad.apply(this, [tmpFile, parent, isMain]);
}
if (!existsSync(nativeFileCacheLocation)) {
mkdirSync(nativeFileCacheLocation, { recursive: true });
}
copyFileSync(nativeLocation, tmpFile);
console.log('copied sucessfully, loading from', tmpFile);
return originalLoad.apply(this, [tmpFile, parent, isMain]);
} else {
return originalLoad.apply(this, arguments);
Expand Down
23 changes: 11 additions & 12 deletions tools/eslint-rules/rules/only-wrapped-native-imports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ const ruleTester = new TSESLint.RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
});


ruleTester.run(RULE_NAME, rule, {
valid: [
{
code: `import something from 'nx/src/native/import';`,
filename: 'project/path/to/file/validFile.js',
filename: 'project/path/to/file/validFile.js',
},
{
code: `import something from 'nx/src/native/import';`,
filename: 'project/path/to/file/validFile.ts',
filename: 'project/path/to/file/validFile.ts',
},
{
code: `import something from 'nx/src/native/other-entry-point';`,
filename: 'project/path/to/file/validFile.ts',
filename: 'project/path/to/file/validFile.ts',
},
],
invalid: [
Expand All @@ -35,22 +34,22 @@ ruleTester.run(RULE_NAME, rule, {
{
code: `import indexThing from 'nx/src/native/index';`,
errors: [{ messageId: 'invalidImport' }],
filename: 'project/path/to/file/invalidFile3.ts',
filename: 'project/path/to/file/invalidFile3.ts',
},
{
code: `import relativeNative from '../native';`,
code: `import relativeNative from '../native';`,
errors: [{ messageId: 'invalidImport' }],
filename: 'packages/nx/src/nested/relativeImport.ts',
filename: 'packages/nx/src/nested/relativeImport.ts',
},
{
code: `import relativeNative from '../../native';`,
code: `import relativeNative from '../../native';`,
errors: [{ messageId: 'invalidImport' }],
filename: 'packages/nx/src/nested/utils/relativeImport.ts',
filename: 'packages/nx/src/nested/utils/relativeImport.ts',
},
{
code: `import relativeNative from './native';`,
code: `import relativeNative from './native';`,
errors: [{ messageId: 'invalidImport' }],
filename: 'packages/nx/src/relativeImport.ts',
filename: 'packages/nx/src/relativeImport.ts',
},
],
});
});
4 changes: 2 additions & 2 deletions tools/eslint-rules/rules/only-wrapped-native-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function isInvalidImport(importPath: string, fileName: string): boolean {
const absolutePath = resolve(dirname(fileName), importPath);
const normalizedPath = normalize(absolutePath);

return regex.test(normalizedPath)
return regex.test(normalizedPath);
}
return regex.test(importPath)
return regex.test(importPath);
}

0 comments on commit 6a20bcc

Please sign in to comment.