Socket
Socket
Sign inDemoInstall

eslint-plugin-react

Package Overview
Dependencies
Maintainers
1
Versions
210
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.11.3 to 3.12.0

lib/rules/no-deprecated.js

27

CHANGELOG.md

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

## [3.12.0] - 2015-12-20
### Added
* Add `no-deprecated` rule ([#356][] @graue)
* Add `no-is-mounted` rule ([#37][] @lencioni)
* Add `never` option to `prefer-es6-class` rule ([#359][] @pwmckenna)
### Fixed
* Fix `jsx-pascal-case` to stop checking lower cased components ([#329][])
* Fix crash in component detection class ([#364][])
### Changed
* Add link to [eslint-plugin-react-native](https://github.com/Intellicode/eslint-plugin-react-native) in Readme
* Update dependencies
[3.12.0]: https://github.com/yannickcr/eslint-plugin-react/compare/v3.11.3...v3.12.0
[#356]: https://github.com/yannickcr/eslint-plugin-react/pull/356
[#37]: https://github.com/yannickcr/eslint-plugin-react/issues/37
[#359]: https://github.com/yannickcr/eslint-plugin-react/pull/359
[#329]: https://github.com/yannickcr/eslint-plugin-react/issues/329
[#364]: https://github.com/yannickcr/eslint-plugin-react/issues/364
## [3.11.3] - 2015-12-05

@@ -150,4 +171,4 @@ ### Fixed

### Fixed
* Fix `display-name` for stateless components ([#256][])
* Fix `prop-types` props validation in constructor ([#259][])
* Fix `display-name` for stateless components ([#256][])
* Fix `prop-types` props validation in constructor ([#259][])
* Fix typo in README ([#261][] @chiedojohn)

@@ -663,3 +684,3 @@

* Add `jsx-no-undef` rule
* Add `jsx-quotes` rule ([#12][])
* Add `jsx-quotes` rule ([#12][])
* Add `@jsx` pragma support ([#23][])

@@ -666,0 +687,0 @@

@@ -13,2 +13,4 @@ 'use strict';

'no-set-state': require('./lib/rules/no-set-state'),
'no-is-mounted': require('./lib/rules/no-is-mounted'),
'no-deprecated': require('./lib/rules/no-deprecated'),
'no-did-mount-set-state': require('./lib/rules/no-did-mount-set-state'),

@@ -47,4 +49,6 @@ 'no-did-update-set-state': require('./lib/rules/no-did-update-set-state'),

'self-closing-comp': 0,
'no-deprecated': 0,
'no-danger': 0,
'no-set-state': 0,
'no-is-mounted': 0,
'no-did-mount-set-state': 0,

@@ -51,0 +55,0 @@ 'no-did-update-set-state': 0,

9

lib/rules/jsx-pascal-case.js

@@ -8,4 +8,2 @@ /**

var variableUtil = require('../util/variable');
// ------------------------------------------------------------------------------

@@ -16,2 +14,3 @@ // Constants

var PASCAL_CASE_REGEX = /^[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*$/;
var COMPAT_TAG_REGEX = /^[a-z]|\-/;

@@ -26,4 +25,2 @@ // ------------------------------------------------------------------------------

JSXOpeningElement: function(node) {
var variables = variableUtil.variablesInScope(context);
switch (node.name.type) {

@@ -43,6 +40,6 @@ case 'JSXIdentifier':

var isImportedVariable = variableUtil.findVariable(variables, node.name);
var isPascalCase = PASCAL_CASE_REGEX.test(node.name);
var isCompatTag = COMPAT_TAG_REGEX.test(node.name);
if (isImportedVariable && !isPascalCase) {
if (!isPascalCase && !isCompatTag) {
context.report(node, 'Imported JSX component ' + node.name + ' must be in PascalCase');

@@ -49,0 +46,0 @@ }

@@ -14,7 +14,10 @@ /**

module.exports = Components.detect(function(context, components, utils) {
var configuration = context.options[0] || 'always';
return {
ObjectExpression: function(node) {
if (utils.isES5Component(node)) {
if (utils.isES5Component(node) && configuration === 'always') {
context.report(node, 'Component should use es6 class instead of createClass');
} else if (utils.isES6Component(node) && configuration === 'never') {
context.report(node, 'Component should use createClass instead of es6 class');
}

@@ -21,0 +24,0 @@ }

@@ -370,2 +370,3 @@ /**

}
return void 0;
}

@@ -372,0 +373,0 @@

@@ -289,3 +289,3 @@ /**

}
if (!defInScope) {
if (!defInScope || !defInScope.node) {
return null;

@@ -292,0 +292,0 @@ }

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

@@ -26,5 +26,5 @@ "description": "React specific linting rules for ESLint",

"devDependencies": {
"babel-eslint": "5.0.0-beta4",
"coveralls": "2.11.4",
"eslint": "1.10.2",
"babel-eslint": "5.0.0-beta6",
"coveralls": "2.11.6",
"eslint": "2.0.0-alpha-1",
"istanbul": "0.4.1",

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

@@ -36,2 +36,4 @@ ESLint-plugin-React

With ESLint 1.x.x:
```json

@@ -45,2 +47,14 @@ {

With ESLint 2.x.x:
```json
{
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
}
```
Finally, enable all of the rules that you would like to use.

@@ -62,2 +76,3 @@

"react/jsx-no-duplicate-props": 1,
"react/jsx-no-is-mounted": 1,
"react/jsx-no-literals": 1,

@@ -72,2 +87,3 @@ "react/jsx-no-undef": 1,

"react/no-danger": 1,
"react/no-deprecated": 1,
"react/no-did-mount-set-state": 1,

@@ -112,5 +128,7 @@ "react/no-did-update-set-state": 1,

* [no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties
* [no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods
* [no-did-mount-set-state](docs/rules/no-did-mount-set-state.md): Prevent usage of `setState` in `componentDidMount`
* [no-did-update-set-state](docs/rules/no-did-update-set-state.md): Prevent usage of `setState` in `componentDidUpdate`
* [no-direct-mutation-state](docs/rules/no-direct-mutation-state.md): Prevent direct mutation of `this.state`
* [no-is-mounted](docs/rules/no-is-mounted.md): Prevent usage of `isMounted`
* [no-multi-comp](docs/rules/no-multi-comp.md): Prevent multiple component definition per file

@@ -127,12 +145,6 @@ * [no-set-state](docs/rules/no-set-state.md): Prevent usage of `setState`

## To Do
## React Native
* no-deprecated: Prevent usage of deprecated methods ([React 0.12 Updated API](http://facebook.github.io/react/blog/2014/10/28/react-v0.12.html#new-terminology-amp-updated-apis))
* no-classic: Prevent usage of "classic" methods ([#2700](https://github.com/facebook/react/pull/2700))
* [Implement relevant rules from David Chang's React Style Guide](https://reactjsnews.com/react-style-guide-patterns-i-like)
* [Implement relevant rules from John Cobb's best practices and conventions](http://web-design-weekly.com/2015/01/29/opinionated-guide-react-js-best-practices-conventions/)
* [Implement relevant rules from Alexander Early's tips and best practices](http://aeflash.com/2015-02/react-tips-and-best-practices.html)
If you're searching for React Native specific linting rules, check out [eslint-plugin-react-native](https://github.com/Intellicode/eslint-plugin-react-native).
[Any rule idea is welcome !](https://github.com/yannickcr/eslint-plugin-react/issues)
# License

@@ -139,0 +151,0 @@

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