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
{{ message }}
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
Here's another option to use lint-staged at the project root, but still calling linters at package-level. This respects the linter and formatter configs/ignore files of each package.
constpackage=require('./package.json');const{ workspaces }=package;// or manually define workspaces as ['package-a', 'package-b']constpattern='**/*.{js,jsx,ts,tsx}';constlinter='node_modules/.bin/eslint --fix';construles=Object.fromEntries(workspaces.map(workspace=>[`${workspace}/${pattern}`,`./${workspace}/${linter}`]))module.exports={// results into...// 'package-a/**/*.{js,jsx,ts,tsx}': 'package-a/node_modules/.bin/eslint --fix',// 'package-b/**/*.{js,jsx,ts,tsx}': 'package-b/node_modules/.bin/eslint --fix'
...rules}
What do you think?
The text was updated successfully, but these errors were encountered:
zirkelc
changed the title
Example without Lerna and global lintter/formatter
Example without Lerna and global linter/formatter
Sep 16, 2021
How does this compare to configuring it directly in the package.json? Saves having to configure repetitively for each new workspace, right? Adding a workspace folder should be a rare activity so not sure about the value provided by this approach.
I'm used to having dev dependencies like ESLint and Prettier (and their respective configs) at the package level instead of at the root level. However, some dependencies like Husky must be installed at project level. I wanted to keep lint-staged and its config next to Husky, but still call the package-level dependencies and respect their configs. Another option would be to cd into each package directory and the call the npm script for lint/format.
I think it's common to have multiple packages (or workspaces) in one project. Instead of specifiying them directly in the .js file, I added a workspace property to the project level package.json. But it's just convenience.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here's another option to use lint-staged at the project root, but still calling linters at package-level. This respects the linter and formatter configs/ignore files of each package.
What do you think?
The text was updated successfully, but these errors were encountered: