Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint glob (**) does not recursively search all directories #9330

Closed
am80l opened this issue Sep 19, 2017 · 3 comments
Closed

Eslint glob (**) does not recursively search all directories #9330

am80l opened this issue Sep 19, 2017 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@am80l
Copy link

am80l commented Sep 19, 2017

My project uses Lerna so my directory structure looks something like this:

└── packages
|  ├── package1
|  ├── package2
|  |  ├── dist
|  |  ├── examples
|  |  ├── images
|  |  ├── src
|  |  ├── templates
|  |  └── test

Eslint v4.7.1
Node v6.3
npm 3.10.3

Parser: babel-eslint

Configuration
{
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module",
    "ecmaFeatures": {
      "ecmaFeatures": true,
      "arrowFunctions": true,
      "classes": true,
      "sourceType": "module",
      "templateStrings": true,
      "jsx": true,
      "blockBindings": true
    },
    "ecmaVersion": 6
  },
  "extends": "eslint:recommended",
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "rules": {
    "key-spacing": [1, { "afterColon": true }],
    "semi": [2, "always"],
    "comma-dangle": [2, "always-multiline"],
    "indent": [2, 2],
    "jsx-quotes": [2, "prefer-single"],
    "no-console": 1,
    "no-unreachable": 2,
    "valid-typeof": 2,
    "quotes": [2, "single", "avoid-escape"],
    "curly": [2, "multi-or-nest", "consistent"],
    "no-var": 2,
    "object-curly-spacing": [2, "always"],
    "space-before-blocks": [2, "always"],
    "react/jsx-boolean-value": 1,
    "react/jsx-closing-bracket-location": 1,
    "react/jsx-curly-spacing": [2, "never"],
    "react/jsx-max-props-per-line": [1, { "maximum" : 2 }],
    "react/jsx-no-duplicate-props": 1,
    "react/jsx-no-undef": 1,
    "react/jsx-sort-props": 1,
    "react/jsx-uses-react": 1,
    "react/jsx-uses-vars": 1,
    "react/jsx-wrap-multilines": 1,
    "react/no-did-mount-set-state": 1,
    "react/no-did-update-set-state": 1,
    "react/no-multi-comp": 1,
    "react/no-unknown-property": 1,
    "react/prop-types": 1,
    "react/react-in-jsx-scope": 1,
    "react/self-closing-comp": 1,
    "react/sort-comp": 1,
    "react/sort-prop-types": 1
  },
  "plugins": [
    "react"
  ]
}

From the package root (above packages), this command does not catch all .js files
eslint packages/**/*.js
Specifically, my .js files in templates are not linted.

However, with this:
eslint packages/**/**/*.js
All files are linted as was expected with the original command.

My expectation is that ** would traverse the full directory depth without requiring **/**

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Sep 19, 2017
@gyandeeps
Copy link
Member

Can you share how do you run this command?
Using npm scripts or directly on CLI? Can you share how you do it.

@platinumazure
Copy link
Member

If you don't quote your glob patterns, your shell can intercept them and then we can't guarantee the results. If you quote your glob patterns such that they are not intercepted by the shell, then ESLint can expand the globs in the way you expect.

Not 100% sure that there isn't something else going on, but that's where I would start from the information so far.

@am80l
Copy link
Author

am80l commented Sep 20, 2017

@gyandeeps Yes this is run as an npm script i.e.

        "eslint": "eslint packages/**/**/*.js",

@platinumazure I had not considered quoting the glob pattern. I gave it a go and am seeing a lot of new files being linted. This was almost certainly the issue, thank you!

@am80l am80l closed this as completed Sep 20, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 20, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

4 participants