-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Glob pattern issues in 1.7.1 #2908
Comments
I'm unable to reproduce; could you provide more info? What node version are you using? |
I cannot reproduce, this is how I tested: mkdir test && cd test && yarn --init && yarn add prettier && node_modules/.bin/prettier --parser json --write package.json Can you share steps to reproduce? |
Interestingly, making a new repo and testing there works fine. However, on my existing repo, 1.7.0 works fine while 1.7.1 fails. I'm trying to figure out what the difference is, but so far I can only think that there must be a dependency getting pulled in with a slightly different version that must be mucking things up. |
Prettier bundled all the dependencies before publishing to npm, so that it's impossible to be affected by dependencies. https://www.npmjs.com/package/prettier: 0 dependencies |
I'm able to reproduce something like this in #2924 with single line js config: mkdir test
cd test && yarn --init
yarn add prettier
echo 'module.exports = { semi: true };' > myConfig.js
echo 'const x = 1' > index.js
node_modules/.bin/prettier --config myConfig.js index.js
try {
const filePaths = globby
.sync(patterns, { dot: true })
.map(
filePath =>
path.isAbsolute(filePath)
? path.relative(process.cwd(), filePath)
: filePath
);
if (filePaths.length === 0) {
console.error(`No matching files. Patterns tried: ${patterns.join(" ")}`);
process.exitCode = 2;
return;
}
ignorer
.filter(filePaths)
.forEach(filePath =>
callback(filePath, getOptionsForFile(argv, filePath)) // <-----------------
);
} catch (error) {
throw error;
console.error(
`Unable to expand glob patterns: ${patterns.join(" ")}\n${error}` // <-------------
);
// Don't exit the process if one pattern failed
process.exitCode = 2;
} Not sure if this is your case, can you share your config setting? |
I have the same issue, tried creating a reproducing repo and surprisingly everything works... |
Reproducible example here: The issue seems related to the existence of a "prettier" section in the package.json file. I would hazard a guess this has something to do with default options behavior. |
It seems you're using incorrect config, |
Thanks. @ikatyang Was this changed? as the no-semi option was definitely working in 1.6 |
Maybe it's caused by our original implementation, but it's never mentioned on official docs before, so it shouldn't be an issue. |
I believe @icopp's issue is something like I mentioned above, opened cosmiconfig/cosmiconfig#95 to track it. |
It's definitely the config file doing it. When I have a
When I have no such file, it works. The |
OK, I think #2929 should fix it, sorry for causing such issue, I forgot there may be some unknown options while implementing the normalization. |
Thanks @ikatyang |
Input:
Output:
Expected behavior:
Prettier runs and parses the given file
The text was updated successfully, but these errors were encountered: