Skip to content

Commit

Permalink
fix: create piece cli lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abuaboud committed Apr 8, 2024
1 parent 85be96d commit 2c9f313
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
deploy
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"ignorePatterns": ["**/*", "deploy/**/*"],
"plugins": ["@nx"],
"overrides": [
{
Expand Down
5 changes: 5 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"@nx/eslint:lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"@nx/js:tsc": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
}
},
"namedInputs": {
Expand Down
15 changes: 8 additions & 7 deletions packages/cli/src/lib/commands/create-piece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,19 @@ const updateProjectJsonConfig = async (
projectJson.targets.build.options.updateBuildableProjectDepsInPackageJson =
true;

if (projectJson.targets.lint) {
const lintFilePatterns = projectJson.targets.lint.options.lintFilePatterns;
const lintFilePatterns = projectJson.targets.lint?.options?.lintFilePatterns;

if (lintFilePatterns) {
const patternIndex = lintFilePatterns.findIndex((item) =>
item.endsWith('package.json')
);
if (patternIndex !== -1) lintFilePatterns?.splice(patternIndex, 1);
} else {
projectJson.targets.lint = {
executor: '@nx/eslint:lint',
outputs: ['{options.outputFile}'],
};
}
projectJson.targets.lint = {
executor: '@nx/eslint:lint',
outputs: ['{options.outputFile}'],
};
}

await writeProjectJson(
`packages/pieces/${pieceType}/${pieceName}`,
Expand Down

0 comments on commit 2c9f313

Please sign in to comment.