Ticket: Help with lint-staged setup in monorepo

@cao Just created a ticket
Question: Configuring lint-staged on monorepo Has anyone used it before?
Attempted: https://www.npmjs.com/package/lint-staged#how-to-use-lint-staged-in-a-multi-package-monorepo
Working On: PR to setup eslint (lint-staged) and husky pre-commit
Using Postiz On: locally
Take it from here @Postiz
npm
lint-staged
Lint files staged by git. Latest version: 15.2.11, last published: 4 days ago. Start using lint-staged in your project by running npm i lint-staged. There are 2278 other projects in the npm registry using lint-staged.
6 Replies
cao
cao2w ago
I followed whats provided in their docs, but seems not working. also, something that happened. i added this one to package json file in the root directory :
"lint":"nx lint --project=frontend"
"lint":"nx lint --project=frontend"
added "no-used-var" on .eslintrc.json :
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/ban-ts-comment": "off",
"react/display-name": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/ban-ts-comment": "off",
"react/display-name": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
when i run it, i have 2 unused var in a component, which are not caught by this lint
cao
cao2w ago
No description
cao
cao2w ago
@Nevo David , this is how it should work ?
cao
cao2w ago
No description
cao
cao2w ago
another test now, got frontend and backend checks
Support
SupportOP2w ago
@Postiz please help @cao

Did you find this page helpful?