diff --git a/.eslintrc.js b/.eslintrc.js index 037eb10eb06..f31c7299181 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -173,13 +173,15 @@ module.exports = { "Avoid importing from the core lib's dist/ folders; please use directly from the core lib defined exports.", }, ], + // The following will place an error on the `fs-extra` import since we do not want it to be used for browser compatibility reasons. + paths: [ + { + name: 'fs-extra', + message: + 'Avoid fs-extra, use shared/fs/fs.ts. Notify the Toolkit team if your required functionality is not available.', + }, + ], }, - // The following will place an error on the `fs-extra` import since we do not want it to be used for browser compatibility reasons. - // { - // name: 'fs-extra', - // message: - // 'Avoid fs-extra, use shared/fs/fs.ts. Notify the Toolkit team if your required functionality is not available.', - // }, ], }, } diff --git a/packages/amazonq/scripts/build/copyFiles.ts b/packages/amazonq/scripts/build/copyFiles.ts index 75ee0540e92..c1b0861321d 100644 --- a/packages/amazonq/scripts/build/copyFiles.ts +++ b/packages/amazonq/scripts/build/copyFiles.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-restricted-imports */ import * as fs from 'fs-extra' import * as path from 'path' diff --git a/packages/core/scripts/build/copyFiles.ts b/packages/core/scripts/build/copyFiles.ts index 9fe1c5b13fa..ee5c9492bcb 100644 --- a/packages/core/scripts/build/copyFiles.ts +++ b/packages/core/scripts/build/copyFiles.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-restricted-imports */ import * as fs from 'fs-extra' import * as path from 'path' diff --git a/packages/core/scripts/build/generateServiceClient.ts b/packages/core/scripts/build/generateServiceClient.ts index 3e010400c4e..5ee72653212 100644 --- a/packages/core/scripts/build/generateServiceClient.ts +++ b/packages/core/scripts/build/generateServiceClient.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-restricted-imports */ import * as proc from 'child_process' import * as fs from 'fs-extra' import * as path from 'path' diff --git a/packages/core/src/test/lambda/local/util.ts b/packages/core/src/test/lambda/local/util.ts index f444546c4cb..5b14939004d 100644 --- a/packages/core/src/test/lambda/local/util.ts +++ b/packages/core/src/test/lambda/local/util.ts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { writeFile } from 'fs-extra' import { EOL } from 'os' import * as CloudFormation from '../../../shared/cloudformation/cloudformation' +import { fs } from '../../../shared' export async function saveTemplate(templatePath: string, runtime: string, ...functionNames: string[]) { const functionResources = functionNames @@ -57,5 +57,5 @@ Outputs: Value: !GetAtt HelloWorldFunctionRole.Arn ` - await writeFile(templatePath, templateContent, 'utf8') + await fs.writeFile(templatePath, templateContent) } diff --git a/packages/core/src/test/shared/cloudformation/cloudformationTestUtils.ts b/packages/core/src/test/shared/cloudformation/cloudformationTestUtils.ts index 441f0f30dc5..0f60d4bc05e 100644 --- a/packages/core/src/test/shared/cloudformation/cloudformationTestUtils.ts +++ b/packages/core/src/test/shared/cloudformation/cloudformationTestUtils.ts @@ -3,8 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { writeFile } from 'fs-extra' - +import { fs } from '../../../shared' import * as CloudFormation from '../../../shared/cloudformation/cloudformation' export function createBaseTemplate(): CloudFormation.Template { @@ -67,7 +66,7 @@ export function createBaseImageResource(): CloudFormation.Resource { } export async function strToYamlFile(str: string, file: string): Promise { - await writeFile(file, str, 'utf8') + await fs.writeFile(file, str) } export function makeSampleSamTemplateYaml( diff --git a/packages/toolkit/scripts/build/copyFiles.ts b/packages/toolkit/scripts/build/copyFiles.ts index b6814af3b40..99c79124637 100644 --- a/packages/toolkit/scripts/build/copyFiles.ts +++ b/packages/toolkit/scripts/build/copyFiles.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-restricted-imports */ import * as fs from 'fs-extra' import * as path from 'path'