Is there a way to establish multiple lint-staged 'scripts'?
See original GitHub issueDescription
I am using lint-staged to lint JS and SCSS files in our project, but I also have multiple ESLint configs depending on the context. One that runs as part of a build process that is less strict and allows things like console.logs. Then a more strict config that gets run on pre-commit hooks.
As it stands right now I can call lint-staged for the pre-commit hooks but have to lint all files on my build process.
I’m wondering if there is a way to have something like:
"lint-staged": {
"src/main/webpack/**/*.js": "eslint --fix",
"src/main/webpack/**/*.scss": "stylelint --fix"
},
"lint-staged-build": {
"src/main/webpack/**/*.js": "eslint --fix -c .eslintconfig-build.json",
"src/main/webpack/**/*.scss": "stylelint --fix"
}
OR
"lint-staged": {
"pre-commit": {
"src/main/webpack/**/*.js": "eslint --fix",
"src/main/webpack/**/*.scss": "stylelint --fix"
},
"build": {
"src/main/webpack/**/*.js": "eslint --fix -c .eslintconfig-build.json",
"src/main/webpack/**/*.scss": "stylelint --fix"
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
okonet/lint-staged: — Run linters on git staged files - GitHub
Ignoring files. The concept of lint-staged is to run configured linter tasks (or other tasks) on files that are staged in git.
Read more >Is this a right way to use husky + lint-staged? - Stack Overflow
Run npm install --save-dev husky lint-staged and create a .lintstagedrc and as well as an .huskyrc at root. Example setup for some scripts...
Read more >Diving into Husky and Lint-staged | Laurie on Tech
The first tool to talk about is lint-staged. ... In many cases, you'll want more than one command, which lint-staged supports.
Read more >Getting started with Husky and Lint-staged for pre-commit hooks
The next step is to install lint-staged. Lint-staged has been created with the purpose of linting only staged files. Lint-staged has very well-defined...
Read more >Automate and Keep Your Code Consistent Using ESLint ...
Lint-Staged — is used to run linter to staged git files and prevent from committing the buggy code. Husky — is a tool...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alternatively, pass a different config:
lint-staged -c lint-staged.build.json
Sorry but I don’t think we want go this route. The provided solution solves the problem and to me addition CLI flags isn’t worth the complexity considering same can be achieved with a different syntax ATM. I’ll close this since I consider it’s resolved. Feel free to re-open if I’m mistaken.