manuelbieh / react-ssr-setup

React Starter Project with Webpack 4, Babel 7, TypeScript, CSS Modules, Server Side Rendering, i18n and some more niceties

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with running eslint command

RomanBON opened this issue Β· comments

Hello! Thank you for your work!

This command from package.json not correctly working for me:

...
"lint:js": "eslint src/**/*.{js,ts,tsx}",
...

But if I add quotes - working fine.

...
"lint:js": "eslint \"src/**/*.{js,ts,tsx}\"",
...

Could you check it, please?

Can't confirm.

Yarn:

$ yarn lint:js
yarn run v1.19.1
$ eslint src/**/*.{js,jsx,ts,tsx}
Done in 6.04s

npm:

$ npm run lint:js

> react-ssr-setup@5.0.0-beta.1 lint:js C:\htdocs\_git\react-ssr-setup
> eslint src/**/*.{js,jsx,ts,tsx}

Can you run npx envinfo and post the output here?

@manuelbieh
Yes, command running, but if I make some mistake in my code and run eslint src/**/*.{js,jsx,ts,tsx} I don't get an error about it in the console. And if I run eslint "src/**/*.{js,jsx,ts,tsx}" everything is fine.
I don't know how it working πŸ˜ƒ

Romans-MacBook-Pro:react-ssr-setup roman$ ./node_modules/.bin/eslint src/**/*.{js,jsx,ts,tsx}

Oops! Something went wrong! :(

ESLint: 6.6.0.

No files matching the pattern "src/**/*.jsx" were found.
Please check for typing mistakes in the pattern.

And it is working.

Romans-MacBook-Pro:react-ssr-setup roman$ ./node_modules/.bin/eslint "src/**/*.{js,jsx,ts,tsx}"

envinfo

Romans-MacBook-Pro:react-ssr-setup roman$ npx envinfo
npx: installed 1 in 1.251s

  System:
    OS: macOS 10.15.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 357.23 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.10.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  Managers:
    Homebrew: 2.1.13 - /usr/local/bin/brew
    RubyGems: 3.0.3 - /usr/bin/gem
  Utilities:
    Git: 2.23.0 - /usr/local/bin/git
  Servers:
    Apache: 2.4.41 - /usr/sbin/apachectl
  Virtualization:
    Docker: 19.03.4 - /usr/local/bin/docker
  IDEs:
    Nano: 2.0.6 - /usr/bin/nano
    PhpStorm: 2019.2.4
    Vim: 8.1 - /usr/bin/vim
    WebStorm: 2019.2.4
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Perl: 5.18.4 - /usr/bin/perl
    PHP: 7.3.9 - /usr/bin/php
    Python: 2.7.16 - /usr/bin/python
    Ruby: 2.6.3 - /usr/bin/ruby
  Databases:
    SQLite: 3.28.0 - /usr/bin/sqlite3
  Browsers:
    Chrome: 78.0.3904.87
    Safari: 13.0.3

What happens when you instead try the following:

"lint:js": "eslint --ext .js,.jsx,.ts,.tsx src/",

Looks like there are differences in how bash syntax ({js,jsx,ts,tsx}) is parsed in npm scripts.

src/**/*.{js,jsx,ts,tsx} gets expanded while 'src/**/*.{js,jsx,ts,tsx}' (in quotes) does not.

What happens when you instead try the following:

"lint:js": "eslint --ext .js,.jsx,.ts,.tsx src/",

Working fine!)

Looks like there are differences in how bash syntax ({js,jsx,ts,tsx}) is parsed in npm scripts.

src/**/*.{js,jsx,ts,tsx} gets expanded while 'src/**/*.{js,jsx,ts,tsx}' (in quotes) does not.

I don't know, but for me, it's not working in npm script (repository cloned from master):

Romans-MacBook-Pro:demo-react-ssr-setup roman$ yarn lint:js
yarn run v1.17.3
$ eslint src/**/*.{js,jsx,ts,tsx}

Oops! Something went wrong! :(

ESLint: 6.6.0.

No files matching the pattern "src/**/*.js" were found.
Please check for typing mistakes in the pattern.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

yarn lint:js is technically running something that's called an "npm script". You can alternatively run them using npm run-script lint:js (or short npm run lint:js). That's where the name is coming from πŸ˜‰

yarn lint:js is technically running something that's called an "npm script". You can alternatively run them using npm run-script lint:js (or short npm run lint:js). That's where the name is coming from πŸ˜‰

Thank you for your work πŸ‘