shellcheck vscode "shellcheck.ignorePatterns" for all files with no extension

561 Views Asked by At

I am using the shellcheck vscode extension and I would like shellcheck to ignore files everywhere that do not have a file extension. I have tried many different glob patterns and nothing works.

The closest I got was:

  "shellcheck.ignorePatterns": {
      "*[!(.)]/**": true
  }

But it really wasn't close.

Does anyone know the magic sauce?

1

There are 1 best solutions below

0
apena On

It seems that an extensionless file cannot be globbed.

I ended up not using the vscode shellcheck extension and used an inclusive approach with shellcheck on the command line, offloading the task of what to include to find.

All my scripts that needed to be linted were .sh files so this worked:

find . -type d \( -name node_modules -o -name vendor -o -path /tmp \) -prune -false -o -name '*.sh' -exec shellcheck {} \;

I would have liked to keep the bash linting in vscode but I had to settle for the above solution due to the limitation of globs/vscode.