-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react/jsx-curly-spacing
rule crashes ESLint 4.2.0
#1290
Comments
Running tests today also causes the same issue. At first I thought it was related to me being on a Windows machine (haven't been on a Windows machine in a while), but I guess not: 38) jsx-curly-spacing valid <App foo={42} {...bar} baz={ { 4: 2 } }>
{foo} { { bar: baz } }
</App>:
Error: rule-tester:
Configuration for rule "jsx-curly-spacing" is invalid:
refVal[2] is not a function
at validateRuleOptions (node_modules\eslint\lib\config\config-validator.js:112:15)
at Object.keys.forEach.id (node_modules\eslint\lib\config\config-validator.js:152:9)
at Array.forEach (native)
at validateRules (node_modules\eslint\lib\config\config-validator.js:151:30)
at Object.validate (node_modules\eslint\lib\config\config-validator.js:206:5)
at runRuleForItem (node_modules\eslint\lib\testers\rule-tester.js:331:23)
at testValidTemplate (node_modules\eslint\lib\testers\rule-tester.js:413:28)
at Context.RuleTester.it (node_modules\eslint\lib\testers\rule-tester.js:546:25) Looks like some issue with the An easy fix would be to not use const basicConfig = {
type: 'object',
properties: {
when: {
enum: SPACING_VALUES
},
allowMultiline: {
type: 'boolean'
},
spacing: {
type: 'object',
properties: {
objectLiterals: {
enum: SPACING_VALUES
}
}
}
}
};
const basicConfigOrBoolean = {
oneOf: [
basicConfig, {
type: 'boolean'
}]
};
module.exports = {
meta: {
docs: {
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes',
category: 'Stylistic Issues',
recommended: false
},
fixable: 'code',
schema: [{
oneOf: [{
allOf: [
basicConfig, {
type: 'object',
properties: {
attributes: basicConfigOrBoolean,
children: basicConfigOrBoolean
}
}]
}, {
enum: SPACING_VALUES
}]
}, {
type: 'object',
properties: {
allowMultiline: {
type: 'boolean'
},
spacing: {
type: 'object',
properties: {
objectLiterals: {
enum: SPACING_VALUES
}
}
}
},
additionalProperties: false
}]
}, |
Refs are great; if they stopped working within the v4 line it's a bug with eslint. |
Please file a bug with them about the breaking change, and link it here? |
Looks like someone already did - eslint/eslint#8908 |
Sorry, I forgot to link it. I asked first on Gitter (totally forgot about that) but then was also suggested to raise an issue on the eslint repo. Additionally I tried various different approaches to get the schema to pass but no luck (e.g. moving |
It seems like we should not use It should "work" again when a fix for See these discussions for more info: |
I'm not sure I understand what's wrong with the current schema. |
@ljharb see this comment: eslint/eslint#8852 (comment) The schema {
type: 'array',
items: [
obj
],
} Somehow this messes up the ESLint team fixed a similar issue for the I made a PR with a similar change for |
so how is that not an eslint bug? it seemed to work fine before. |
It was working in the sense that the validation error was being ignored. (which means that users could pass an incorrect configuration, and ESLint would accept it as valid) It should have been the same with the new validator, but there is a bug with it that @epoberezkin will fix: eslint/eslint#8908 (comment) But in the end, it seems better to not have any errors that are being (silently) ignored, right? |
Closed in #1292. |
Can a new build get released with this PR included? |
Seriously, this was closed nearly a month ago. Is a patch release too much to ask? |
Yes, currently waiting on this if possible |
@yannickcr sorry to mention you but just in case you aren't aware of people waiting for a release, if you can manage one soon, it would be appreciated, thanks |
@virgofx @planttheidea @Benno007 @lukeapage Released in v7.2.0, really sorry for the delay. |
It looks like something changed (or broke) in how ESLint handles schemas between 4.1.1 and 4.2.0.
When I try to run ESLint with this rule enabled:
I get the following error:
Quick link to the
react/jsx-curly-spacing
schemaUpdate: I'm guessing eslint/eslint#8852 was the culprit.
The text was updated successfully, but these errors were encountered: