question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is always attempting to format node_modules

See original GitHub issue

even when I try explicitly ignoring the folder

scripts: {
    "format": "prettier-eslint \"./**/*.js\" --ignore \"./node_modules/**\" --write"
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dlindahlcommented, Mar 28, 2017

I am also running into this issue. An initial poke at the source code seems to indicate that prettier-eslint-cli is honoring the .eslintignore file that is shipped with installed NPM modules. I added some console.infos inside isFilePathMatchedByEslintignore, just before the return, and here is a snippet of the output:

eslintignorePath /Users/dlindahl/Work/website/.eslintignore
eslintignoreDir /Users/dlindahl/Work/website
isIgnored? node_modules/fsevents/node_modules/punycode/punycode.js true
---
eslintignorePath /Users/dlindahl/Work/website/node_modules/fsevents/node_modules/qs/.eslintignore
eslintignoreDir /Users/dlindahl/Work/website/node_modules/fsevents/node_modules/qs
isIgnored? dist/qs.js true
---
eslintignorePath /Users/dlindahl/Work/website/node_modules/fsevents/node_modules/qs/.eslintignore
eslintignoreDir /Users/dlindahl/Work/website/node_modules/fsevents/node_modules/qs
isIgnored? lib/formats.js false

You can see when the parser is looping through punycode, it is using the project .eslintignore. But when its looping throug fsevents, it picks up the .eslintignore file contained in the fsevents module which is configured only to ignore its own dist directory.

Because fsevents isn’t ignoring node_modules on its own, prettier-eslint-cli starts to process all of the dependencies of fsevents.

I want to say that the way prettier-eslint-cli treats nested .eslintignore paths seems like a bug to me. I would think that the project settings should trump anything nested within it. Is this the expected behavior?

0reactions
kentcdoddscommented, Apr 8, 2017

It’s unclear this is an issue with the package. Feel free to investigate further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do Node modules go into .staging folder? - Stack Overflow
I have an Electron app that I'm trying to install node modules for. When I run npm install , it creates the node_modules...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
If you get this error, the solution is always in the error. The module (package) not found is always specified in the format...
Read more >
How To Use Node.js Modules with npm and package.json
The Node.js Package Manager (npm) is the default and most popular ... JSON is a standard format used for sharing, based on JavaScript ......
Read more >
CommonJS modules | Node.js v19.3.0 Documentation
When a file is run directly from Node.js, require.main is set to its module . That means that it is possible to determine...
Read more >
Documentation - ECMAScript Modules in Node.js - TypeScript
This setting controls whether .js files are interpreted as ES modules or CommonJS modules, and defaults to CommonJS when not set. When a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found