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.

Aura linting doesn't support glob wildcard when run by an npm script

See original GitHub issue

Summary

The following command works fine when entered in a terminal: sfdx force:lightning:lint **/aura However, the same command doesn’t pick up files when run in the context of an npm script like npm run lint:aura. The ** glob prefix isn’t working in that context.

Steps To Reproduce:

  1. Clone the e-bikes sample app repo git clone git@github.com:trailheadapps/ebikes-lwc.git
  2. Edit package.json and set the lint:aura script to sfdx force:lightning:lint **/aura
  3. Install dependencies npm install
  4. Run the Aura linting npm script npm run lint:aura

Expected result

Script should run on 8 files:

'Search for "**/*.js" in folder "**/aura/"'
' -> Ignoring: **/node_modules/**,**/jsdoc/**,**/htdocs/**,**/invalidTest/**,**/purposelyInvalid/**,**/invalidTestData/**,**/validationTest/**,**/lintTest/**,**/target/**,**/parseError/**,**/*.junk.js,**/*_mock?.js'
Found 8 matching files.

Actual result

No files are linted:

'Search for "**/*.js" in folder "**/aura/"'
' -> Ignoring: **/node_modules/**,**/jsdoc/**,**/htdocs/**,**/invalidTest/**,**/purposelyInvalid/**,**/invalidTestData/**,**/validationTest/**,**/lintTest/**,**/target/**,**/parseError/**,**/*.junk.js,**/*_mock?.js'
 ▸    Did not find matching files.

Additional information

SFDX CLI Version: sfdx-cli/7.27.0-714f62f9c1 darwin-x64 node-v10.15.3

SFDX plugin Version

salesforcedx 47.0.7 (pre-release)
├─ force-language-services 47.0.2
└─ salesforce-alm 47.0.7

OS and version: MacOS Mojave

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
KrisGraySFDCcommented, Oct 18, 2019

We have this bug already filed.

@W-6746941 near the top of our backlog, we should be able to get this fixed soon.

0reactions
pozilcommented, Nov 14, 2019

@AdamTReineke I confirm that the issue is fixed with the current CLI version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why you should always quote your globs in NPM scripts.
NPM run-scripts don't use the shell of the user who runs the command. ... Windows command shell also doesn't support wildcard expansion.
Read more >
Why same wildcards behave differently in shell and npm script?
run npm run test . But now only files like ./src/pah1/a.js are matched. I don't know why same wildcards behave differently.
Read more >
npm-run-all
A CLI tool to run multiple npm-scripts in parallel or sequential. ⤴️ Motivation. Simplify. The official npm run-script command cannot run ...
Read more >
Make the Most of Your DX Projects With Built-in Node.js Scripts :
In order to lint your Aura components and LWC, simply execute npm run lint . ESLint scans all of the JS files that...
Read more >
Run a set of similar npm scripts with a wildcard | egghead.io
In this lesson we will run a set of scripts that are grouped together with a wildcard using the npm-run-all node package. Using...
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