lint-trap
lint-trap copied to clipboard
smarter way to resolve indentation of current project
The current approach of resolving the indentation of the current project based on package.json:main is naive in that it does allow the linter to be run on individual files or to lint from content piped in on stdin.
Use a smarter way to determine the indentation of a project, possibly using .editorconfig settings if available or allowing the indentation to be set in the .lintrc file. Fallback to detecting indentation if the indentation is not set explicitly via either method.
Do not use the indentation of the current file as reference since it is entirely possible to lint a single file using one indent style while the rest of the project uses something else. In the case that indentation cannot be determined any way, either the indentation of the current/first file should be used or the indentation average across all the files being linted should be used (this will be slow, but a last resort. correctness is preferable to speed since this is an edgecase).
Issue https://github.com/uber/lint-trap/issues/30 is related to this and may become obsolete if a different approach is taken to determine project indentation.