Skip to content
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

lintText and lintTextSync forcefully interact with the file system API #904

Closed
sadasant opened this issue May 31, 2017 · 4 comments · Fixed by standard/standard-engine#166

Comments

@sadasant
Copy link

Hi team!

We're planning to use standard as a formatting API tool, since we know this repo offers functions such as lintText and lintTextSync. However, our target software does heavy interactions with the file system, and we do heavily mock the file system in our unit tests. I wonder if we could optionally disallow standard to use the file system API for lintText and lintTextSync. What do you people think? 🤔❔

@Flet
Copy link
Member

Flet commented Jun 8, 2017

  • lintText calls the internal parseOpts function
  • this function uses pkg-conf to scan the filesystem for a package.json to look for additional options. This may be the filesystem calls that are happening.
  • there may also be additional calls inside executeOnText function in eslint itself (I didn't get a chance to check it thoroughly)

It may be worth using standard-engine directly (with eslint-config-standard) and passing the customParseOpts option to send a modified parseOpts function. This would be a way to avoid the file system call to read package.json. Another option is to just use eslint directly :).

Part of the philosophy of the standard tool is to avoid having lots of configuration. Dropping down to using standard-engine directly may be the fastest way to accomplish your goal.

@feross
Copy link
Member

feross commented Jun 21, 2017

@Flet Maybe we should change standard-engine so that lintText doesn't take into account the package.json settings? It seems pretty random that lintText would behave differently depending on the current working directory.

@Flet
Copy link
Member

Flet commented Jun 21, 2017

@feross yeah that makes sense!

feross added a commit to standard/standard-engine that referenced this issue Jun 21, 2017
Fixes standard/standard#904

Change standard-engine so that lintText/lintTextSync doesn't take into
account the package.json settings. lintText should not behave
differently depending on the current working directory.
@feross
Copy link
Member

feross commented Jun 21, 2017

PR sent: standard/standard-engine#166

@sadasant Can you check if using standard with that PR applied to standard-engine solves your issue?

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants