Skip to content

Commit e3cbe8a

Browse files
fix(qwik-nx): check for file existance before reading it (#80)
1 parent a5b6b36 commit e3cbe8a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/qwik-nx/src/utils/configure-eslint.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ export function configureEslint(
1919
cfg.root,
2020
'.eslintrc.json'
2121
);
22-
const existingLibEslintConfig = tree.read(existingLibEslintConfigPath);
22+
23+
let existingLibEslintConfig: Buffer | undefined;
24+
25+
if (tree.exists(existingLibEslintConfigPath)) {
26+
existingLibEslintConfig = tree.read(existingLibEslintConfigPath);
27+
}
2328

2429
lintProjectGenerator(tree, {
2530
project: project,
@@ -34,7 +39,10 @@ export function configureEslint(
3439

3540
const viteConfigFileName = 'vite.config.ts';
3641
const eslintIgnorePath = './.eslintignore';
37-
const eslintIgnore = tree.read(eslintIgnorePath)?.toString() ?? '';
42+
let eslintIgnore = '';
43+
if (tree.exists(eslintIgnorePath)) {
44+
eslintIgnore = tree.read(eslintIgnorePath)?.toString() ?? '';
45+
}
3846
if (!eslintIgnore.includes(viteConfigFileName)) {
3947
tree.write(
4048
eslintIgnorePath,

0 commit comments

Comments
 (0)