Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react

Package Overview
Dependencies
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react - npm Package Compare versions

Comparing version 3.9.0 to 3.10.0

lib/rules/jsx-pascal-case.js

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

## [3.10.0] - 2015-11-21
### Added
* Add `jsx-pascal-case` rule ([#306][] @jakemmarsh)
### Fixed
* Fix crash on incomplete class property declaration ([#317][] @dapetcu21)
* Fix crash with ESLint 1.10.0 ([#323][] @lukekarrys)
[3.10.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.9.0...v3.10.0
[#306]: https://github.com/yannickcr/eslint-plugin-react/pull/306
[#317]: https://github.com/yannickcr/eslint-plugin-react/issues/317
[#323]: https://github.com/yannickcr/eslint-plugin-react/issues/323
## [3.9.0] - 2015-11-17

@@ -8,0 +21,0 @@ ### Added

2

index.js

@@ -17,2 +17,3 @@ 'use strict';

'jsx-uses-vars': require('./lib/rules/jsx-uses-vars'),
'jsx-pascal-case': require('./lib/rules/jsx-pascal-case'),
'jsx-no-bind': require('./lib/rules/jsx-no-bind'),

@@ -51,2 +52,3 @@ 'jsx-no-undef': require('./lib/rules/jsx-no-undef'),

'jsx-uses-vars': 1,
'jsx-pascal-case': 0,
'jsx-no-bind': 0,

@@ -53,0 +55,0 @@ 'jsx-no-undef': 0,

4

lib/rules/display-name.js

@@ -13,3 +13,3 @@ /**

module.exports = Components.detect(function(context, components) {
module.exports = Components.detect(function(context, components, utils) {

@@ -135,3 +135,3 @@ var config = context.options[0] || {};

}
var component = context.react.getRelatedComponent(node);
var component = utils.getRelatedComponent(node);
if (!component) {

@@ -138,0 +138,0 @@ return;

@@ -27,6 +27,4 @@ /**

var tokens = context.getFirstTokens(node, 2);
if (tokens[0].value === 'propTypes' || tokens[1].value === 'propTypes') {
return true;
}
return false;
return (tokens[0] && tokens[0].value === 'propTypes') ||
(tokens[1] && tokens[1].value === 'propTypes');
}

@@ -33,0 +31,0 @@

@@ -13,3 +13,3 @@ /**

module.exports = Components.detect(function(context, components) {
module.exports = Components.detect(function(context, components, utils) {

@@ -55,3 +55,3 @@ /**

) {
var component = components.get(context.react.getParentComponent());
var component = components.get(utils.getParentComponent());
var mutations = component && component.mutations || [];

@@ -58,0 +58,0 @@ mutations.push(node.left.object);

@@ -13,7 +13,7 @@ /**

module.exports = Components.detect(function(context) {
module.exports = Components.detect(function(context, components, utils) {
return {
ObjectExpression: function(node) {
if (context.react.isES5Component(node)) {
if (utils.isES5Component(node)) {
context.report(node, 'Component should use es6 class instead of createClass');

@@ -20,0 +20,0 @@ }

@@ -16,3 +16,3 @@ /**

module.exports = Components.detect(function(context, components) {
module.exports = Components.detect(function(context, components, utils) {

@@ -32,3 +32,3 @@ var configuration = context.options[0] || {};

var isClassUsage = (
(context.react.getParentES6Component() || context.react.getParentES5Component()) &&
(utils.getParentES6Component() || utils.getParentES5Component()) &&
node.object.type === 'ThisExpression' && node.property.name === 'props'

@@ -333,3 +333,3 @@ );

var isDirectProp = /^props(\.|\[)/.test(context.getSource(node));
var isInClassComponent = context.react.getParentES6Component() || context.react.getParentES5Component();
var isInClassComponent = utils.getParentES6Component() || utils.getParentES5Component();
var isNotInConstructor = !inConstructor(node);

@@ -414,3 +414,3 @@ if (isDirectProp && isInClassComponent && isNotInConstructor) {

var component = components.get(context.react.getParentComponent());
var component = components.get(utils.getParentComponent());
var usedPropTypes = component && component.usedPropTypes || [];

@@ -576,3 +576,3 @@

case 'declaration':
var component = context.react.getRelatedComponent(node);
var component = utils.getRelatedComponent(node);
if (!component) {

@@ -579,0 +579,0 @@ return;

@@ -135,3 +135,3 @@ /**

var tokens = context.getFirstTokens(node, 2);
return tokens[1].type === 'Identifier' ? tokens[1].value : tokens[0].value;
return tokens[1] && tokens[1].type === 'Identifier' ? tokens[1].value : tokens[0].value;
}

@@ -138,0 +138,0 @@

@@ -111,3 +111,3 @@ /**

// Utilities for component detection
context.react = {
var utils = {

@@ -180,5 +180,5 @@ /**

return (
context.react.getParentES6Component() ||
context.react.getParentES5Component() ||
context.react.getParentStatelessComponent()
utils.getParentES6Component() ||
utils.getParentES5Component() ||
utils.getParentStatelessComponent()
);

@@ -196,3 +196,3 @@ },

var node = scope.block && scope.block.parent && scope.block.parent.parent;
if (node && context.react.isES5Component(node)) {
if (node && utils.isES5Component(node)) {
return node;

@@ -216,3 +216,3 @@ }

var node = scope && scope.block;
if (!node || !context.react.isES6Component(node)) {
if (!node || !utils.isES6Component(node)) {
return null;

@@ -323,3 +323,3 @@ }

ClassDeclaration: function(node) {
if (!context.react.isES6Component(node)) {
if (!utils.isES6Component(node)) {
return;

@@ -331,3 +331,3 @@ }

ClassProperty: function(node) {
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node) {

@@ -340,3 +340,3 @@ return;

ObjectExpression: function(node) {
if (!context.react.isES5Component(node)) {
if (!utils.isES5Component(node)) {
return;

@@ -348,3 +348,3 @@ }

FunctionExpression: function(node) {
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node) {

@@ -357,3 +357,3 @@ return;

FunctionDeclaration: function(node) {
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node) {

@@ -366,7 +366,7 @@ return;

ArrowFunctionExpression: function(node) {
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node) {
return;
}
if (node.expression && context.react.isReturningJSX(node)) {
if (node.expression && utils.isReturningJSX(node)) {
components.add(node, 2);

@@ -379,3 +379,3 @@ } else {

ThisExpression: function(node) {
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node || !/Function/.test(node.type)) {

@@ -389,6 +389,6 @@ return;

ReturnStatement: function(node) {
if (!context.react.isReturningJSX(node)) {
if (!utils.isReturningJSX(node)) {
return;
}
node = context.react.getParentComponent();
node = utils.getParentComponent();
if (!node) {

@@ -402,3 +402,3 @@ return;

// Update the provided rule instructions to add the component detection
var ruleInstructions = rule(context, components);
var ruleInstructions = rule(context, components, utils);
var updatedRuleInstructions = util._extend({}, ruleInstructions);

@@ -405,0 +405,0 @@ Object.keys(detectionInstructions).forEach(function(instruction) {

{
"name": "eslint-plugin-react",
"version": "3.9.0",
"version": "3.10.0",
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",

@@ -28,3 +28,3 @@ "description": "React specific linting rules for ESLint",

"coveralls": "2.11.4",
"eslint": "1.9.0",
"eslint": "1.10.0",
"istanbul": "0.4.0",

@@ -31,0 +31,0 @@ "mocha": "2.3.4"

@@ -98,2 +98,3 @@ ESLint-plugin-React

* [jsx-no-undef](docs/rules/jsx-no-undef.md): Disallow undeclared variables in JSX
* [jsx-pascal-case](docs/rules/jsx-pascal-case.md): Enforce PascalCase for user-defined JSX components
* [jsx-quotes](docs/rules/jsx-quotes.md): Enforce quote style for JSX attributes

@@ -100,0 +101,0 @@ * [jsx-sort-prop-types](docs/rules/jsx-sort-prop-types.md): Enforce propTypes declarations alphabetical sorting

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc