You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use lint-staged to enforce lint rules with a pre-commit hook. To speed that up, we're invoking eslint directly on the files that are changed (instead of invoking the lint target on affected projects).
If we have a commit with multiple package.json files, the lint rule assumes ALL packages use the dependencies of the first package. This means when it scans the second, third package.json file, it believes there are dependencies missing from those projects, even if the package.json files are correct.
The auto-fixer will end up adding duplicated dependencies to subsequent the package.json files (adding dependencies when it was already specified in the package.json)
We currently work around this issue by committing the package.json files one at a time.
Expected Behavior
The rule should work across multiple package.json files in a single eslint run.
The rule should emit the same errors regardless of the order the files are specified in.
Current Behavior
We use
lint-staged
to enforce lint rules with a pre-commit hook. To speed that up, we're invokingeslint
directly on the files that are changed (instead of invoking the lint target on affected projects).If we have a commit with multiple
package.json
files, the lint rule assumes ALL packages use the dependencies of the first package. This means when it scans the second, thirdpackage.json
file, it believes there are dependencies missing from those projects, even if thepackage.json
files are correct.The auto-fixer will end up adding duplicated dependencies to subsequent the
package.json
files (adding dependencies when it was already specified in thepackage.json
)We currently work around this issue by committing the
package.json
files one at a time.Expected Behavior
The rule should work across multiple package.json files in a single eslint run.
The rule should emit the same errors regardless of the order the files are specified in.
The auto-fixer should not add
GitHub Repo
https://github.com/ComradeCow/nx-deps-lint-error
Steps to Reproduce
Clone the sample repo - run
npm install
Run
npx eslint packages/project1/package.json packages/project2/package.json
The lint rule fails complaining pad-right is missing from project2
Run
npx eslint packages/project1/package.json
No errors
Run
npx eslint packages/project2/package.json
No errors
Run
npx eslint packages/project2/package.json packages/project1/package.json
The lint rule fails, but pad-left is missing from project1
Run
npx eslint packages/project2/package.json packages/project1/package.json --fix
pad-left
will be added to project1's package.json a second time.Nx Report
Failure Logs
No response
Package Manager Version
10.1.0
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: