Eslint-plugin-react: How to pass JSX files to eslint correctly?

Created on 26 Mar 2015  路  2Comments  路  Source: yannickcr/eslint-plugin-react

I'm not sure if this is the right place (might be more of a core question). Anyway, is there a neat way to pass jsx files to eslint? Now I'm doing something like eslint lib/*.jsx. Globstar (*_/_) doesn't appear to be supported and this crashes if no jsx files are found. Is it possible to set .eslintrc to look for certain formats for instance? How do you deal with this problem?

eslint question

Most helpful comment

You have a few options to pass your JSX files to ESLint:

  • eslint lib/*.jsx : check all .jsx files in lib, excluding subdirectories
  • eslint lib/**/*.jsx : check all .jsx files in lib, including subdirectories
  • eslint lib : check all .js files in lib, including subdirectories
  • eslint --ext .jsx lib : check all .jsx files in lib, including subdirectories
  • eslint --ext .js --ext .jsx lib : check all .js and .jsx files in lib, including subdirectories

You can find more informations in the ESLint Command line Interface documentation.

All 2 comments

You have a few options to pass your JSX files to ESLint:

  • eslint lib/*.jsx : check all .jsx files in lib, excluding subdirectories
  • eslint lib/**/*.jsx : check all .jsx files in lib, including subdirectories
  • eslint lib : check all .js files in lib, including subdirectories
  • eslint --ext .jsx lib : check all .jsx files in lib, including subdirectories
  • eslint --ext .js --ext .jsx lib : check all .js and .jsx files in lib, including subdirectories

You can find more informations in the ESLint Command line Interface documentation.

@yannickcr Thanks a lot! I ended up using a combination of .eslintignore and eslint --ext .jsx --ext .js.

Was this page helpful?
0 / 5 - 0 ratings