eslint-plugin-react
Advanced tools
Comparing version 3.3.2 to 3.4.0
@@ -6,2 +6,15 @@ # Change Log | ||
## [3.4.0] - 2015-09-16 | ||
### Added | ||
* Add namespaced JSX support to `jsx-no-undef` ([#219][] @zertosh) | ||
* Add option to `jsx-closing-bracket-location` to configure different styles for self-closing and non-empty tags ([#208][] @evocateur) | ||
### Deprecated | ||
* Deprecate `jsx-quotes` rule, will now trigger a warning if used ([#217][]) | ||
[3.4.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.3.2...v3.4.0 | ||
[#219]: https://github.com/yannickcr/eslint-plugin-react/pull/219 | ||
[#208]: https://github.com/yannickcr/eslint-plugin-react/pull/208 | ||
[#217]: https://github.com/yannickcr/eslint-plugin-react/issues/217 | ||
## [3.3.2] - 2015-09-10 | ||
@@ -8,0 +21,0 @@ ### Changed |
@@ -19,3 +19,30 @@ /** | ||
}; | ||
var DEFAULT_LOCATION = 'tag-aligned'; | ||
var config = context.options[0]; | ||
var options = { | ||
nonEmpty: DEFAULT_LOCATION, | ||
selfClosing: DEFAULT_LOCATION | ||
}; | ||
if (typeof config === 'string') { | ||
// simple shorthand [1, 'something'] | ||
options.nonEmpty = config; | ||
options.selfClosing = config; | ||
} else if (typeof config === 'object') { | ||
// [1, {location: 'something'}] (back-compat) | ||
if (config.hasOwnProperty('location') && typeof config.location === 'string') { | ||
options.nonEmpty = config.location; | ||
options.selfClosing = config.location; | ||
} | ||
// [1, {nonEmpty: 'something'}] | ||
if (config.hasOwnProperty('nonEmpty') && typeof config.nonEmpty === 'string') { | ||
options.nonEmpty = config.nonEmpty; | ||
} | ||
// [1, {selfClosing: 'something'}] | ||
if (config.hasOwnProperty('selfClosing') && typeof config.selfClosing === 'string') { | ||
options.selfClosing = config.selfClosing; | ||
} | ||
} | ||
/** | ||
@@ -34,5 +61,5 @@ * Get expected location for the closing bracket | ||
location = 'after-props'; | ||
// Else use configuration, or default value | ||
// Else use configuration dependent on selfClosing property | ||
} else { | ||
location = context.options[0] && context.options[0].location || 'tag-aligned'; | ||
location = tokens.selfClosing ? options.selfClosing : options.nonEmpty; | ||
} | ||
@@ -84,3 +111,4 @@ return location; | ||
closing: closing, | ||
lastProp: lastProp | ||
lastProp: lastProp, | ||
selfClosing: node.selfClosing | ||
}; | ||
@@ -105,8 +133,27 @@ } | ||
module.exports.schema = [{ | ||
type: 'object', | ||
properties: { | ||
location: { | ||
oneOf: [ | ||
{ | ||
enum: ['after-props', 'props-aligned', 'tag-aligned'] | ||
}, | ||
{ | ||
type: 'object', | ||
properties: { | ||
location: { | ||
enum: ['after-props', 'props-aligned', 'tag-aligned'] | ||
} | ||
}, | ||
additionalProperties: false | ||
}, { | ||
type: 'object', | ||
properties: { | ||
nonEmpty: { | ||
enum: ['after-props', 'props-aligned', 'tag-aligned'] | ||
}, | ||
selfClosing: { | ||
enum: ['after-props', 'props-aligned', 'tag-aligned'] | ||
} | ||
}, | ||
additionalProperties: false | ||
} | ||
} | ||
] | ||
}]; |
@@ -65,2 +65,5 @@ /** | ||
break; | ||
case 'JSXNamespacedName': | ||
node = node.name.namespace; | ||
break; | ||
default: | ||
@@ -67,0 +70,0 @@ break; |
@@ -45,3 +45,8 @@ /** | ||
Program: function(node) { | ||
context.report(node, 'The react/jsx-quotes rule is deprecated. Please use the jsx-quotes rule instead.'); | ||
}, | ||
Literal: function(node) { | ||
if (node.parent.type !== 'JSXAttribute') { | ||
@@ -48,0 +53,0 @@ return; |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "3.3.2", | ||
"version": "3.4.0", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -26,7 +26,7 @@ "description": "React specific linting rules for ESLint", | ||
"devDependencies": { | ||
"babel-eslint": "4.1.1", | ||
"babel-eslint": "4.1.2", | ||
"coveralls": "2.11.4", | ||
"eslint": "1.3.1", | ||
"istanbul": "0.3.19", | ||
"mocha": "2.3.0" | ||
"eslint": "1.4.3", | ||
"istanbul": "0.3.20", | ||
"mocha": "2.3.2" | ||
}, | ||
@@ -33,0 +33,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121302
2844