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

TypeError: Cannot create property 'context' on string #112

Closed
mattboon opened this issue Dec 16, 2016 · 2 comments
Closed

TypeError: Cannot create property 'context' on string #112

mattboon opened this issue Dec 16, 2016 · 2 comments

Comments

@mattboon
Copy link

Hi there

I have the following setup in place on a project running on node 7.2.1 and npm 3.10.10.

{
  "scripts": {
    "lint:js": "semistandard",
    "lint:fix": "semistandard --fix",
    "lint:staged": "lint-staged",
  },
  "lint-staged": {
    "*.{js,jsx}": "lint:js"
  },
  "pre-commit": {
    "run": "lint:staged",
    "colors": true,
    "silent": true
  },
  "devDependencies": {
    "lint-staged": "^3.2.3",
    "pre-commit": "^1.2.2",
    "semistandard": "^9.2.1",
  }
}

All is okay here:

$ npm run lint:js

> example@0.0.0 lint:js /Users/mberridge/Sites/example
> semistandard | snazzy

semistandard: Semicolons For All! (https://github.com/Flet/semistandard)

/Users/mberridge/Sites/example/src/index.js
  9:1  error  Parsing error: Unexpected token

✖ 1 problem

But running npm run lint:staged returns an error wrapped around the output:

$ npm run lint:staged

> example@0.0.0 lint:staged /Users/mberridge/Sites/example
> lint-staged

 ❯ Running tasks for *.{js,jsx}
   ✖ lint:js
{ TypeError: Cannot create property 'context' on string '
🚫 lint:js found some errors. Please fix them and try committing again.

semistandard: Semicolons For All! (https://github.com/Flet/semistandard)

/Users/mberridge/Sites/example/src/index.js
  9:1  error  Parsing error: Unexpected token

✖ 1 problem

'
    at tasks.then.catch.err (/Users/mberridge/Sites/example/node_modules/lint-staged/node_modules/listr/index.js:74:17)
    at process._tickCallback (internal/process/next_tick.js:103:7) context: {} }

Not the end of the world, as it's still linting and working with pre-commit too.
But have I done something wrong to cause the error?

Any help appreciated, thanks all!

@mattboon mattboon changed the title TypeError: Cannot assign to read only property 'context' TypeError: Cannot create property 'context' on string ' Dec 16, 2016
@mattboon mattboon changed the title TypeError: Cannot create property 'context' on string ' TypeError: Cannot create property 'context' on string Dec 16, 2016
@ai
Copy link
Contributor

ai commented Dec 19, 2016

I made a test project for this issue: https://github.com/ai/sort-staged-example

Just add CSS properties order and commit it:

> sort-staged-example@ precommit /home/ai/Dev/sort-staged-example/front
> lint-staged

 ❯ Running tasks for *.css
   ✔ stylelint
   ✖ postcss/sort
     cd .. && git add
{ TypeError: Cannot create property 'context' on string '
🚫 postcss/sort found some errors. Please fix them and try committing again.



'
    at tasks.then.catch.err (/home/ai/Dev/sort-staged-example/front/node_modules/listr/index.js:74:17)
    at process._tickCallback (internal/process/next_tick.js:103:7) context: {} }

If I will run postcss/sort manually everything will works:

cd front
./postcss/sort -- test.css

@okonet
Copy link
Collaborator

okonet commented Dec 19, 2016

This is a bug in SamVerschueren/listr#41. I'll wait till it is fixed and will update dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants