-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Error in Angular-ESLint Integration: Unique Name Issue in Monorepo Project #1752
Comments
@JanHeinemeyer88 could you share any more info about your monorepo setup?
A repo that reproduces this issue would be very helpful, if possible. |
I agree that a minimal reproduction would help a lot to get this issue fixed. To answer your other question on why Angular ESLint has a dependency to Nx, actually it's just the |
@JanHeinemeyer88 I'm happy to help here if you can share a bit more about the structure of the project. Are package manager workspaces being used? If so which package manager and what is the config? I am guessing there is a nested package.json in |
We don't use any specific monorepo tooling. We use npm workspaces alongside the angular cli. We have one angular.json in the workspace, in which we defined a newProjectRoot and then defined some projects. {
…
"newProjectRoot": "projects",
"projects": {
"main-app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"deleteOutputPath": true,
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"vendorChunk": true,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
…
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
…
},
…
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"],
"eslintConfig": ".eslintrc.json"
}
}
}
},
"project01": {
"projectType": "library",
"root": "projects/project01",
"sourceRoot": "projects/project01/src",
"prefix": "p01",
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"changeDetection": "OnPush"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"configurations": {
"production": {
"tsConfig": "projects/project01/tsconfig.lib.prod.json",
"project": "projects/project01/ng-package.json"
},
"development": {
"tsConfig": "projects/project01/tsconfig.lib.prod.json",
"project": "projects/project01/ng-package-dev.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/project01/src/test.ts",
"tsConfig": "projects/project01/tsconfig.spec.json",
"karmaConfig": "projects/project01/karma.conf.js"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["projects/project01/src/**/*.ts", "projects/project01/src/**/*.html"],
"eslintConfig": "projects/project01/.eslintrc.json"
}
}
}
},
"problematic-project": {
"projectType": "library",
"root": "projects/problematic-project",
"sourceRoot": "projects/problematic-project/src",
"prefix": "p02",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/problematic-project/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/problematic-project/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/problematic-project/tsconfig.lib.json"
}
},
},
}
},
"schematics": {
"@angular-eslint/schematics:application": {
"setParserOptionsProject": true
},
"@angular-eslint/schematics:library": {
"setParserOptionsProject": true
}
}
} package.json of project that has the problem: {
"name": "problematic-project",
"version": "0.0.1",
"scripts": {
"build": "ng build problematic-project",
"watch": "npm run build -- --watch --configuration development & npm run build:sass -- --watch",
"postbuild": "npm run build:sass && npm run build:schematics",
"build:schematics": "tsc -p tsconfig.schematics.json",
"build:sass": "sass --load-path=../../node_modules --style=compressed --no-source-map src/lib/styles/problematic-project.scss:dist/styles/problematic-project.css"
},
"schematics": "./schematics/collection.json"
} Also, we store the build output (from ng-packagr) of the libraries directly in the respective project folder (e.g., project/project-name/dist) and reference it in the package.json off the app. App package.json: {
...
"workspaces": [
"projects/problematic-project/dist",
],
...
} |
So you have a copy of the package.json nested in dist too right? You have both:
AND
...for the same package? Is |
Hey @JamesHenry thanks for your response! I am working on the same project as @JanHeinemeyer88. Yes indeed, there's another package.json nested in dist, but it's not an exact copy but rather a modified version of it. But as @JanHeinemeyer88 already mentioned before, we have other projects - also angular libraries - in the workspace with a similar setup and we don't face any issues there. |
@pweyrich thanks, but is this the only library where the dist is not ignored by git OR where the dist is referenced by the workspaces config? That would explain the difference I think if so (I am just trying to confirm the minimal repro first) |
@JamesHenry All the libraries are setup that way and their dist directories are not ignored by git. |
This is a brief summary of our workspace setup and directory structure:
As you can see, we have multiple libraries located in a projects directory and our main application is located in a src/app directory. In the package.json in the root of our workspace the workspaces are then setup as follows:
Hope this helps! |
We have a monorepo in our project setup, similar to the others, where Nx is not utilized. However, due to the integration of Angular-eslint, Nx has become a required dependency. Since our recent upgrade to Angular 17, we are encountering an error in one specific project within the monorepo, indicating that the name must be unique. This error arises because, for unknown reasons, the dist folder is being considered, leading to the duplicate identification within the dist directory.
Additionally, we are seeking clarification on why Nx is being shipped with the package. This situation is somewhat inconvenient as it results in the inclusion of numerous dependencies in our project that we do not utilize.
The above-mentioned project is set up similarly to others in our monorepo, yet it is the only one leading to this error. Renaming the project resolves the error, but this is not a feasible solution.
The error message when we try to lint any project:
Versions
@angular-eslint/builder
17.3.0
ESLint
8.57.0
node
18.19.0
ng version
output per the instructions given here.The text was updated successfully, but these errors were encountered: