diff --git a/.eslintrc b/.eslintrc index bb76bd18e1..f299267262 100644 --- a/.eslintrc +++ b/.eslintrc @@ -34,8 +34,7 @@ rules: quotes: [2, single, avoid-escape] space-after-keywords: 2 space-before-blocks: 2 - # TODO: enable this rule after https://github.com/eslint/eslint/pull/3768 lands - space-before-keywords: 0 + space-before-keywords: 2 strict: [2, global] # JSX diff --git a/packages/react/addons.js b/packages/react/addons.js index 413ac33a4a..5b246f6f5f 100644 --- a/packages/react/addons.js +++ b/packages/react/addons.js @@ -3,11 +3,13 @@ var warning = require('fbjs/lib/warning'); warning( false, + /* eslint-disable no-useless-concat */ // Require examples in this string must be split to prevent React's // build tools from mistaking them for real requires. // Otherwise the build tools will attempt to build a 'react-addons-{addon}' module. 'require' + "('react/addons') is deprecated. " + 'Access using require' + "('react-addons-{addon}') instead." ); +/* eslint-enable no-useless-concat */ module.exports = require('./lib/ReactWithAddons'); diff --git a/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js b/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js index c9d328d061..40461186c3 100644 --- a/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js +++ b/src/renderers/dom/client/syntheticEvents/SyntheticEvent.js @@ -275,9 +275,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) { var warningCondition = false; warning( warningCondition, - 'This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re %s `%s` on a released/nullified synthetic event. %s.' + - 'If you must keep the original synthetic event around, use event.persist().' + + 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js index 2f2f7e27a0..68ac8ab75e 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js @@ -88,9 +88,9 @@ describe('SyntheticEvent', function() { expect(syntheticEvent.target).toBe(null); expect(console.error.calls.length).toBe(3); // once for each property accessed expect(console.error.argsForCall[0][0]).toBe( // assert the first warning for accessing `type` - 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re accessing the property `type` on a released/nullified synthetic event. This is set to null.' + - 'If you must keep the original synthetic event around, use event.persist().' + + 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re accessing the property `type` on a released/nullified synthetic event. This is set to null. ' + + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.' ); }); @@ -103,10 +103,10 @@ describe('SyntheticEvent', function() { expect(syntheticEvent.type = 'MouseEvent').toBe('MouseEvent'); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re setting the property `type` on a released/nullified synthetic event. This is effectively a no-op.' + - 'If you must keep the original synthetic event around, use event.persist().' + - 'See https://fb.me/react-event-pooling for more information.' + 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re setting the property `type` on a released/nullified synthetic event. This is ' + + 'effectively a no-op. If you must keep the original synthetic event around, use ' + + 'event.persist(). See https://fb.me/react-event-pooling for more information.' ); }); @@ -117,10 +117,10 @@ describe('SyntheticEvent', function() { syntheticEvent.preventDefault(); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re accessing the method `preventDefault` on a released/nullified synthetic event. This is a no-op function.' + - 'If you must keep the original synthetic event around, use event.persist().' + - 'See https://fb.me/react-event-pooling for more information.' + 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re accessing the method `preventDefault` on a released/nullified synthetic event. ' + + 'This is a no-op function. If you must keep the original synthetic event around, ' + + 'use event.persist(). See https://fb.me/react-event-pooling for more information.' ); }); @@ -131,10 +131,10 @@ describe('SyntheticEvent', function() { syntheticEvent.stopPropagation(); expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re accessing the method `stopPropagation` on a released/nullified synthetic event. This is a no-op function.' + - 'If you must keep the original synthetic event around, use event.persist().' + - 'See https://fb.me/react-event-pooling for more information.' + 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re accessing the method `stopPropagation` on a released/nullified synthetic event. ' + + 'This is a no-op function. If you must keep the original synthetic event around, ' + + 'use event.persist(). See https://fb.me/react-event-pooling for more information.' ); }); @@ -154,9 +154,9 @@ describe('SyntheticEvent', function() { expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( - 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this,' + - 'you\'re accessing the property `nativeEvent` on a released/nullified synthetic event. This is set to null.' + - 'If you must keep the original synthetic event around, use event.persist().' + + 'Warning: This synthetic event is reused for performance reasons. If you\'re seeing this, ' + + 'you\'re accessing the property `nativeEvent` on a released/nullified synthetic event. ' + + 'This is set to null. If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.' ); }); @@ -172,8 +172,7 @@ describe('SyntheticEvent', function() { expect(console.error.argsForCall[0][0]).toBe( 'Warning: This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + - 'The property is never released. See ' + - 'https://fb.me/react-event-pooling for more information.' + 'The property is never released. See https://fb.me/react-event-pooling for more information.' ); } else { expect(console.error.calls.length).toBe(0); diff --git a/src/renderers/dom/shared/DOMProperty.js b/src/renderers/dom/shared/DOMProperty.js index 0695c61a1c..814bf50454 100644 --- a/src/renderers/dom/shared/DOMProperty.js +++ b/src/renderers/dom/shared/DOMProperty.js @@ -142,7 +142,10 @@ var DOMPropertyInjection = { }, }; +/* eslint-disable max-len */ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; +/* eslint-enable max-len */ + /** * DOMProperty exports lookup objects that can be used like functions: diff --git a/src/renderers/dom/shared/DOMPropertyOperations.js b/src/renderers/dom/shared/DOMPropertyOperations.js index 2f6c41ece9..90858f03bb 100644 --- a/src/renderers/dom/shared/DOMPropertyOperations.js +++ b/src/renderers/dom/shared/DOMPropertyOperations.js @@ -18,7 +18,8 @@ var ReactPerf = require('ReactPerf'); var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser'); var warning = require('warning'); -var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); +var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); var illegalAttributeNameCache = {}; var validatedAttributeNameCache = {}; diff --git a/src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js b/src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js index bb409c30ab..8d8de3d902 100644 --- a/src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js +++ b/src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js @@ -184,7 +184,9 @@ describe('ReactMultiChildText', function() { ['', 'foo',