Skip to content

bug caused by shelljs modifying the String.prototype  #7316

@jonschlinkert

Description

@jonschlinkert
  • ESLint Version: 3.6.1
  • Node Version: 6.7
  • npm Version:: 2.15.8

tldr: I've confirmed that this bug is fixed by updating to the latest version of shelljs.

What parser (default, Babel-ESLint, etc.) are you using?

I'm using gulp-eslint, but the bug is caused by shelljs 0.6.0, a dependency of eslint.

What's happening

I don't know why this is happening, but I can explain what is happening and what is causing it.

When I run gulp mocha, even though gulp eslint is never called, since shelljs v6.0.0 modifies the String.prototype AND it's exported at the top level (e.g. regardless of whether or not shelljs is used, the String.prototype is modified), something is happening that is causing test results to be mutated.

As you can see in the attached gist, only tests with a .. in the expected result are being modified. It appears that .. is being replaced with function from shelljs, so .toString() is probably being called somewhere.

I don't know where the replacement is happening specifically, but I tracked the root cause to this code in shelljs.

Also, for completeness, the mocha task in gulpfile.js consists of this code:

gulp.task('test', function() {
  return gulp.src('test/*.js')
    .pipe(mocha({reporter: 'spec'}))
});

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 incorrectlyinfrastructureRelates to the tools used in the ESLint development process

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions