Comments (11)
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.info
s 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?
from prettier-eslint-cli.
Hmmm... That's weird. Does it not work if you exclude the --ignore
? As you see here so long as you're not explicitly trying to format node_modules
, it will be ignored.
Could you dig a little deeper?
from prettier-eslint-cli.
Not sure how it was happening but whenever I use \"./**/*.js\"
it will always include the node_modules folder.
I just explicitly included all the folders I wanted to format.
from prettier-eslint-cli.
Ok, feel free to dig deeper to see if there really is a bug.
from prettier-eslint-cli.
This is definitely not expected behavior. Due to this (specifically globOptions.ignore
), those files should never be included in the array of files that are processed. If you could figure out why those are included, that would be helpful.
from prettier-eslint-cli.
I have to imagine its due to getNearestEslintignorePath(filePath)
Based on the name of the function, it would make sense that, given a path deep inside node_modules
, that it would find the nearest .eslintlignore
and use it. I would imagine that the intention of getNearestEslintignorePath
is to find an .eslintignore
file in the root of the project or above (not below).
At first thought, a good place to start would be to restrict this method from going down into project sub-paths. However, in something like a lerna repo, I supposed it would be possible to have many .eslintignore
files in a single project. So on second thought, getNearestEslintignorePath
should itself be prevented from ever looking into node_modules
... maybe?
from prettier-eslint-cli.
Thanks for chipping in @dlindahl. The fact is that due to the code I linked to before, those file paths should never even reach getNearestEslintignorePath
. They shouldn't be included in the map
called on rxGlob
because they should be ignored via globOptions
. So what we need to figure out is why those files are being matched by the glob. A good place to start would be to add a console.log({fileGlob, globOptions})
above this line
from prettier-eslint-cli.
The output of getFilesFromGlob
is:
{ fileGlob: './**/*.js',
globOptions: { ignore: [ '**/node_modules/**' ] } }
from prettier-eslint-cli.
Ok, so based on that we shouldn't be seeing anything from node_modules included. Can anyone investigate why we are?
from prettier-eslint-cli.
@kentcdodds, perhaps you want to reopen this issue?
from prettier-eslint-cli.
It's unclear this is an issue with the package. Feel free to investigate further.
from prettier-eslint-cli.
Related Issues (20)
- support directory as argument HOT 3
- Is it possible to provide a `--check` option like prettier? HOT 2
- I have problem about this package, HOT 1
- eslint error: Configuration for rule "import/order" is invalid HOT 1
- What different beween use prettier-eslint-cli and use prettier and eslint step by step? HOT 3
- Can an error be reported when the error cannot be resolved? HOT 1
- `--list-different` doesn't exclude node_modules HOT 1
- `--list-different` from script fails HOT 1
- Error: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '' HOT 4
- Error after updating eslint to 8.1.0 HOT 8
- Still reports "jsxBracketSameLine is deprecated." even when option is not used HOT 1
- Option to fix only `layout` issues HOT 1
- Add --cache option HOT 1
- incompatibility with Next eslint config HOT 11
- [v7] bump dependencies HOT 1
- Maintainace: replace `semantic-release` with `changesets` HOT 12
- Support Yarn Plug n Play HOT 1
- Failed to load plugin 'react-hooks' declared in 'CLIOptions' HOT 1
- Support for Prettier 3 (TypeError: Expected `input` to be a `string`, got `object`) HOT 1
- Allow prettier-eslint-cli to write eslint errors/warnings to stderr? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-eslint-cli.