Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
[eslint] enable some rules
Browse files Browse the repository at this point in the history
Additional ESLint rules: "no-multi-spaces": ["error"], "key-spacing": ["error"]
"no-multi-spaces" - Disallow multiple spaces;
"key-spacing" - Enforce consistent spacing between keys and values in object literal properties;
  • Loading branch information
KonstHardy authored and ljharb committed Nov 4, 2021
1 parent 8291c36 commit 51282ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prop-types.min.js
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
},
"rules": {
"no-console": "off",
"no-multi-spaces": ["error"],
"key-spacing": ["error"],
},
"overrides": [
{
Expand Down
7 changes: 3 additions & 4 deletions factoryWithTypeCheckers.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
) {
printWarning(
'You are manually calling a React.PropTypes validation ' +
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
Expand Down Expand Up @@ -445,8 +445,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
// We need to check all keys in case some are required but missing from props.
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
Expand All @@ -457,7 +456,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
Expand Down

0 comments on commit 51282ab

Please sign in to comment.