Skip to content

Omiting any file/dir positional parameter to CLI does not give an error #14308

@jobedom-stylesage

Description

@jobedom-stylesage
  • ESLint Version: 7.23.0
  • Node Version: 15.4.0
  • npm Version: 7.1.1
  • Operating System: linux 5.4.0-70-generic
  • Parser: @babel/eslint-parser
Configuration
module.exports = {
  root: true,
  parserOptions: {
    parser: '@babel/eslint-parser',
    ecmaVersion: 2018,
    sourceType: 'module'
  },
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],
  plugins: ['vue'],
  rules: {
    'max-len': ['warn', { code: 120 }],
    'vue/no-v-html': 'off'
  }
}

ESLint CLI usage:

eslint --cache --ext .js,.vue --max-warnings 0

What did you expect to happen?

I expected to have and error in console: 'patterns' must be a non-empty string or an array of non-empty strings.

Instead, I got no response at all (and no actual linting performed, of course).

$ eslint --cache --ext .js,.vue --max-warnings 0
Done in 0.23s.

How to replicate?

  1. Run eslint CLI with no positional parameters.
  2. No error is shown .

More details

The condition in ESLint engine code is accepting an empty list as a valid list of non empty strings. It boils down to the fact that a call to .every(...) method of an empty list is always true (see isArrayOfNonEmptyString function)

I'm more than OK to prepare a PR to fix this.

Thanks!

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyrepro:yesIssues with a reproducible example

Type

No type

Projects

Status

Complete

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions