[SalesForce] Does SFDX force:mdapi:deploy respect .forceignore file

I'm trying to work in a github repository project that is not in Source format and is using Metadata API format structure.

The repository has stored all component code into an src folder including package.xml. I'm trying to deploy the same into Scratch Org using VS Code, but it throws me an error like this:

Error

src/lwc/jsconfig/jsconfig.js-meta.xml
Cannot find Lightning Component Bundle jsconfig.

This error comes up when I execute following command:

sfdx force:mdapi:deploy -d ./src -w -1 -u My_Scratch_Org

I've .forceignore file in root of the project with following content:

# LWC configuration files
**/jsconfig.json
**/.eslintrc.json

Can we exclude this file specifically when using mdapi:deploy?
Does mdapi:deploy command not respect .forceignore?

Also, if I delete this jsconfig.json file from lwc folder, my deployment goes without error, but every time I launch VS Code, it again pops up in my lwc folder.

Best Answer

.forceignore file works only with the source command sfdx force:source:push which is intended to be used with scratch orgs.

To be able to push this project to a scratch org, you shall to convert it first to source format:

sfdx force:mdapi:convert -r path/to/metadata -d path/to/outputdir

If you can use deploy instead of push, you can use a manifest to do this

sfdx force:source:deploy -x path/to/package.xml

More info: https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm