Closed elquimista closed 6 years ago
There are several other issues and even some docs about configuring eslint.
@ForbesLindesay Can you give me more specific information (e.g., link)? I already tried search but could not find - that's why I opened this issue here.
Perhaps I was not clear enough in my description. I'm getting no-undef
eslint error for looping variable (not for pug
indicator).
Line 25: 'child' is not defined no-undef
Line 44: 'i' is not defined no-undef
Ah, you shouldn't get that. Are you linting the code before compiling, or after? Are you using eslint-plugin-react-pug? I wonder if it could be a bug in https://github.com/ezhlobo/pug-uses-variables (If so, you could try and narrow it down to a test case and open an issue there)
Yes, I'm using eslint-plugin-react-pug. Not sure if the linting occurs before/after compilation. I don't use pug-uses-variable (and don't know how to use that).
Here are my dot files.
.babelrc
{
"presets": [
"react-app"
],
"plugins": [
"transform-decorators-legacy",
"transform-react-pug"
]
}
.eslintrc
{
"extends": ["airbnb-base", "plugin:react-pug/all", "prettier"],
"plugins": ["prettier", "react-pug"],
"env": {
"browser": true
},
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true
}
],
"class-methods-use-this": "off"
},
"settings": {
"import/resolver": {
"webpack": {
"config": {
"resolve": {
"modules": ["src"]
}
}
}
}
}
}
@ezhlobo do you have any suggestions here?
Give me few hours to reproduce that
//CC @artificis @ForbesLindesay
@artificis
This is intermittent - it happens sometimes and doesn't happen other times.
This makes my investigation almost impossible. I was not able to reproduce such behavior, and I have no idea how it can happen :(.
It would be great if you could set up a sample project with the same behavior, so I'll be able to debug.
PS. What do you think about creating a separate issue for this in ezhlobo/eslint-plugin-react-pug, because it's more likely related to prettier and eslint than to this babel-plugin.
Will do
With regular React JSX syntax, I write like this:
With pug syntax, I write like this:
For me, pug syntax looks better in terms of legibility, but I get eslint error
no-undef
for iterator variable (child
).For now, I should disable eslint temporarily using
/* eslint-disable no-undef */
right beforereturn
statement inrender
function.Can we make it pass eslint without this extra line of disabling eslint rule?
UPDATE: This is intermittent - it happens sometimes and doesn't happen other times.