Ignore or Resolve "Parsing error: Assigning to rvalue"
See original GitHub issueTell 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:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I haven’t written any myself, but you could take a look at the tests for some popular processors like
eslint-plugin-markdown
oreslint-plugin-html
.@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 😃