We recently transitioned to a monorepo structure and are currently in the process of setting everything up. Our setup involves TypeScript, ESLint, and Prettier. Here's an overview of our project structure:
root
- common
- folder_a
- file_a.ts
- build_scripts
- script_a.js
- project_a
- components
- component_a
- Component.tsx
- tsconfig.json
- .eslintrc.json
- node_modules
- package.json
- .prettierignore
- .prettierrc.yml
- .eslintignore
- .eslintrc.base.json
- tsconfig.base.json
- node_modules
- package.json
- Makefile
- webpack.config.js
- .pre-commit-config.yaml
The common
directory contains shared code used across multiple projects and is not considered a standalone project (hence no tsconfig.json). Each sub-project with its own tsconfig.json and .eslintrc.json files extends the base configurations. For example:
tsconfig.base.json
{
"compilerOptions": {
"lib": ["ES2017", "DOM"],
...
},
...
}
.eslintrc.base.json (abbreviated rules)
{
"env": {
"es2020": true,
...
},
...
}
And so on for the other configuration files like .eslintignore, .pre-commit-config.yaml, package.json, etc.
In general, our linting and bundling processes work well without errors. However, we encountered an issue when trying to stage and commit changes within project_a
where a specific parsing error related to TypeScript-eslint was thrown. This error seems to be triggered only during pre-commit hook linting despite having all necessary configurations set up correctly.
This unexpected behavior could potentially be linked to additional include directives in certain configuration files that might cause conflicts or issues during linting, especially when working with different projects simultaneously. We're actively investigating this issue to identify a resolution.