-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Option to exclude project specs in parserOptions (e.g. node_modules) #1771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe most npm packages do not include tsconfigs in their output. It'd be interesting to see how many npm packages you have installed actually have them. You can do this via the following snippet: const {sync} = require('glob');
console.log(sync("./**/tsconfig.json")); What does your project structure look like? See issue on OOMs: #1192 OOMs happen because typescript isn't overly optimised for our usecase, nor is our codebase overly optimised yet. As mentioned, NPM packages should have a tsconfig that matches zero files, so their impact on memory should be negligible. Your projects would be 99%+++ of the memory usage. |
See https://github.com/tkalliom/monorepo-typescript-linting-example/ for an example of a project where the wider glob catches enough node modules for the memory to run out |
Your example doesn't cause memory to run out for me, but it does show that I'm wrong, and there are many package maintainers that are lazy, and do not exclude the source files from their packages.
A few of those contain non-trivial ts sourcecode in their package, like In that case, I think that it makes sense to add a new option to ignore certain folders from the glob, defaulting to |
Repro
For a monorepo of apps looking something like
category-a/operation-1/
,category-a/operation-2
,category-b/operation-1
etc., independent of each other, we still want to enforce a common set of style rules. We had this in our.eslintrc.js
at the root:Expected Result
The linting runs successfully.
Actual Result
After adding enough sub-applications, linting starts to fail with
Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
. I suspect this is due to the glob catching also TypeScript libraries under variousnode_modules
directories.Additional Info
It would be nice if there was a way to leave out
node_modules
from the pre-parse after specifying a generic glob. One way to do this might be an option likeparserOptions.projectExcludes
. Another would be to respect.eslintignore
also for theproject
specification – but maybe it’s better to keep.eslintignore
for a single purpose?Wwe worked around this by specifying
"project": ["category-a/*/tsconfig.json", "category-b/*/tsconfig.json"]
.Versions
@typescript-eslint/parser
2.23.0
TypeScript
2.9.2
ESLint
6.8.0
node
10.15.2
npm
6.14.1
The text was updated successfully, but these errors were encountered: