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.

Bug: pnpm exec eslint didn't work on Mac os

See original GitHub issue

Environment

Environment Info:

Node version: v16.17.0 npm version: v8.15.0 pnpm version: v7.9.5 Local ESLint version: v8.23.0 (Currently used) Global ESLint version: Not found Operating System: darwin 21.6.0

What parser are you using?

Default (Espree)

What did you do?

Configuration
//eslint.config.js
export default [
  {
    rules: {
      semi: "warn",
      "prefer-const": "error",
    },
  },
];
//Missing semicolon
Vue.use(PiniaVuePlugin)

What did you expect to happen?

config script in package.json

"lint": "eslint src/**/*.js",

run pnpm run lint terminal print nothing.

run pnpm exec eslint src/**/*.js, output:


/Users/zhanglolo/Documents/vscodeProjects/vue2-vite-pinia-vitest-demo/src/main.js
  9:24  warning  Missing semicolon  semi

✖ 1 problem (0 errors, 1 warning)
  0 errors and 1 warning potentially fixable with the `--fix` option.

What actually happened?

It seem like eslint didn’t work by using package.json script.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mdjermanoviccommented, Aug 30, 2022

Does it work as expected now (i.e. does it report the semi warning in src/main.js when you run the package.json lint script)?

Yes! but, what makes me confuses is pnpm run lint (npm run lint) get different out put eslint:cli CLI args: [...] from pnpm exec eslint src/**/*.js(npx eslint src/**/*.js).

Then I think we can close this issue since eslint correctly resolves the glob when the glob is passed into eslint. The difference between the lists of files to which the glob is expanded before calling eslint might be a good question for npm/pnpm, as eslint has no control over it. ESLint’s Command Line Interface documentation suggests using quotes for consistent behavior:

Please note that when passing a glob as a parameter, it will be expanded by your shell. The results of the expansion can vary depending on your shell, and its configuration. If you want to use node glob syntax, you have to quote your parameter (using double quotes if you need it to run in Windows), as follows

0reactions
zhanglolocommented, Aug 30, 2022

Does it work as expected now (i.e. does it report the semi warning in src/main.js when you run the package.json lint script)?

Yes! but, what makes me confuses is pnpm run lint (npm run lint) get different out put eslint:cli CLI args: [...] from pnpm exec eslint src/**/*.js(npx eslint src/**/*.js).

May be npm have do something stuff.🤨

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extension fails with pnpm command not found #148903 - GitHub
Hello, here the problem is with eslint. When I try to save any file I get an error. When I run the same...
Read more >
ESLint not working in VSCode? Help build a troubleshooting ...
Open the command palette ( Ctrl / Cmd + Shift + P ) and select ESLint: Manage Library Execution to open the dialog...
Read more >
Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
pnpm/pnpm - Gitter
i'm having a problem with dependencies of dependencies in a workspace. i'm using typescript (not sure whether that matters).
Read more >
How to run eslint --fix from npm script - Stack Overflow
You can run below command: npm run lint -- --fix.
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