question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore or Resolve "Parsing error: Assigning to rvalue"

See original GitHub issue

Tell us about your environment

  • ESLint Version: ^4.11.0
  • Node Version: v6.10.0
  • npm Version: 3.10.10 (I yarn installed eslint though)

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

Please show your full configuration:

Configuration
env:
  browser: true
  commonjs: true
  es6: true
extends: 'eslint:recommended'
parserOptions:
  sourceType: module
rules:
  indent:
    - error
    - 2
  linebreak-style:
    - error
    - unix
  quotes:
    - error
    - single
  no-console:
    - 1    
  no-empty:
    - 1
  no-return-assign:
    - 0

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

"./node_modules/eslint/bin/eslint.js -c './assets/config/.eslintrc.yml' assets/js/"
---
process: true
---

const archiveTemplate = require('../../templates/archive-template.html');
const newsTemplate = require('../../templates/news-template.html');

export const renderArchive = (target, items) => {
  document.querySelector(target).innerHTML = archiveTemplate({
    items: items,
    baseurl: '{{ site.baseurl }}'
  });
}

export const renderNews = (target, items) => {
  document.querySelector(target).innerHTML = newsTemplate({
    items: items,
    baseurl: '{{ site.baseurl }}'
  });
}
"./node_modules/eslint/bin/eslint.js -c './assets/config/.eslintrc.yml' assets/js/"

What did you expect to happen?

I’m using eslint to process some JavaScript that contains “YAML front matter” used by a Jekyll static site generator. [The first three lines in the js file above are the YAML front matter for the given JS file]. Basically Jekyll requires that front matter so we can declare that a given file should be parsed by the Jekyll engine. When Jekyll processes a file with YAML front matter, it removes the front matter and replaces any values between double curly braces with values specified elsewhere. The output JS file does not have the YAML front matter (and thus begins on line 4 of the sample JS above).

When I run eslint on files with this YAML front matter, however, I get 1:3 error Parsing error: Assigning to rvalue. I’d like to resolve or ignore this error if possible. Is there any way for me to do so?

It’s worth noting that folks in this situation could use eslint against the files after Jekyll processes them, as Jekyll removes the front matter from processed files, as noted above. However, this would require one to build my site each time I want to lint the JS, and large Jekyll sites can take many seconds to build, so this would be suboptimal.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Nov 17, 2017

I haven’t written any myself, but you could take a look at the tests for some popular processors like eslint-plugin-markdown or eslint-plugin-html.

0reactions
duhaimecommented, Jan 28, 2018

@john-kurkowski amen! Thanks to @not-an-aardvark we’re using that package on a new Jekyll site for Yale University’s Digital Humanities Lab 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get SyntaxError: Assigning to rvalue? - Stack Overflow
You get rvalue error, when you use = instead of == in a condition checking block.
Read more >
Eslint returns Assigning to rvalue for ES6 functions
ESlint: Parsing error: Assigning to rvalue. But, my code runs without problems. Can someone explain what this error means and what am I...
Read more >
Why I get Error: assigning to rvalue? - CodeCombat Discourse
Hello all! I have the code like above and get the error “assigning to rvalue”. Why? Use == instead of = on the...
Read more >
7 SWIG and C++11
SWIG correctly parses the rvalue reference syntax '&&', for example the typical ... assignment operators as well as move assignment operators are ignored...
Read more >
Developing Process Engine - Client Error Listings - IBM
are errors that may have originated from the server side. ... Description: Step Post-Assignment[{0}], RValue (expected type is {1}), syntax error: {2}.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found