Skip to content

Commit

Permalink
Merge pull request #66 from walmartlabs/feature/update-airbnb-config
Browse files Browse the repository at this point in the history
Update airbnb congif from 2.1.1 -> 5.0.0
  • Loading branch information
baer committed Feb 10, 2016
2 parents 46f7826 + 2a2d0d9 commit 77963c9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Due to an issue with ESLint, config extension cannot be called from a globally i

- [ESLint](https://github.com/eslint/eslint) 1.10.3
- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) 3.12.0
- [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb) 2.1.1
- [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb) 5.0.0
- [eslint-config-gulp](https://github.com/gulpjs/eslint-config-gulp) 2.0.0
- [Google JavaScript Style Guide](https://github.com/google/styleguide/tree/43d738ab8bb0c797f78506945729946aacbab17d) 43d738ab8b
- [eslint-plugin-filenames](https://www.npmjs.com/package/eslint-plugin-filenames) 0.2.0
Expand Down
3 changes: 1 addition & 2 deletions configurations/airbnb/es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module.exports = {
"defaults/rules/eslint/node/airbnb",
"defaults/rules/eslint/strict/airbnb",
"defaults/rules/eslint/style/airbnb",
"defaults/rules/eslint/variables/airbnb",
"defaults/rules/react/airbnb"
"defaults/rules/eslint/variables/airbnb"
],
"parser": "babel-eslint",
"env": {
Expand Down
4 changes: 2 additions & 2 deletions rules/eslint/best-practices/airbnb.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
// disallow use of arguments.caller or arguments.callee
"no-caller": 2,
// disallow lexical declarations in case clauses
"no-case-declarations": 0,
"no-case-declarations": 2,
// disallow division operators explicitly at beginning of regular expression
"no-div-regex": 0,
// disallow else after a return in an if
Expand Down Expand Up @@ -116,7 +116,7 @@ module.exports = {
// requires to declare all vars on top of their containing scope
"vars-on-top": 2,
// require immediate function invocation to be wrapped in parentheses
"wrap-iife": [2, "any"],
"wrap-iife": [2, "outside"],
// require or disallow Yoda conditions
"yoda": 2
}
Expand Down
6 changes: 3 additions & 3 deletions rules/eslint/es6/airbnb.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
},
"rules": {
// require braces in arrow function body
"arrow-body-style": 0,
"arrow-body-style": [2, "as-needed"],
// require parens in arrow function arguments
"arrow-parens": 0,
// require space before/after arrow function's arrow
Expand All @@ -49,15 +49,15 @@ module.exports = {
// require method and property shorthand syntax for object literals
"object-shorthand": [2, "always"],
// suggest using arrow functions as callbacks
"prefer-arrow-callback": 0,
"prefer-arrow-callback": 2,
// suggest using of const declaration for variables that are never modified after declared
"prefer-const": 2,
// suggest using Reflect methods where applicable
"prefer-reflect": 0,
// suggest using the spread operator instead of .apply()
"prefer-spread": 0,
// suggest using template literals instead of strings concatenation
"prefer-template": 0,
"prefer-template": 2,
// disallow generator functions that do not have yield
"require-yield": 0
}
Expand Down
9 changes: 6 additions & 3 deletions rules/eslint/style/airbnb.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ module.exports = {
// specify the maximum depth that blocks can be nested
"max-depth": [0, 4],
// specify the maximum length of a line in your program
"max-len": [0, 80, 4],
"max-len": [2, 100, 2, {
"ignoreUrls": true,
"ignoreComments": false
}],
// specify the maximum depth callbacks can be nested
"max-nested-callbacks": 0,
// limits the number of parameters that can be used in the function declaration.
Expand Down Expand Up @@ -87,7 +90,7 @@ module.exports = {
// disallow dangling underscores in identifiers
"no-underscore-dangle": 0,
// disallow the use of Boolean literals in conditional expressions
"no-unneeded-ternary": 0,
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
// require or disallow padding inside curly braces
"object-curly-spacing": [2, "always"],
// allow just one var statement per function
Expand All @@ -99,7 +102,7 @@ module.exports = {
// enforce padding within blocks
"padded-blocks": [2, "never"],
// require quotes around object literal property names
"quote-props": 0,
"quote-props": [2, "as-needed", { "keywords": false, "unnecessary": true, "numbers": false }],
// specify whether double or single quotes should be used
"quotes": [2, "single", "avoid-escape"],
// Require JSDoc comment
Expand Down
35 changes: 22 additions & 13 deletions rules/react/airbnb.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,30 @@ module.exports = {
},
"rules": {
// Prevent missing displayName in a React component definition
"react/display-name": 0,
"react/display-name": [0, { "acceptTranspilerName": false }],
// Forbid certain propTypes
"react/forbid-prop-types": 0,
"react/forbid-prop-types": [0, { "forbid": ["any", "array", "object"] }],
// Enforce boolean attributes notation in JSX
"react/jsx-boolean-value": [2, "never"],
// Validate closing bracket location in JSX
"react/jsx-closing-bracket-location": [2, "line-aligned"],
// Enforce or disallow spaces inside of curly braces in JSX attributes
"react/jsx-curly-spacing": 0,
"react/jsx-curly-spacing": [0, "never", { "allowMultiline": true }],
// Enforce event handler naming conventions in JSX
"react/jsx-handler-names": 0,
"react/jsx-handler-names": [0, {
"eventHandlerPrefix": "handle",
"eventHandlerPropPrefix": "on"
}],
// Validate props indentation in JSX
"react/jsx-indent-props": [2, 2],
// Validate JSX has key prop when in array or iterator
"react/jsx-key": 0,
// Limit maximum of props on a single line in JSX
"react/jsx-max-props-per-line": 0,
"react/jsx-max-props-per-line": [0, { "maximum": 1 }],
// Prevent usage of .bind() and arrow functions in JSX props
"react/jsx-no-bind": 2,
// Prevent duplicate props in JSX
"react/jsx-no-duplicate-props": 0,
"react/jsx-no-duplicate-props": [0, { "ignoreCase": false }],
// Prevent usage of isMounted
"react/no-is-mounted": 2,
// Prevent usage of unwrapped JSX strings
Expand All @@ -42,25 +45,31 @@ module.exports = {
// Enforce quote style for JSX attributes
"react/jsx-quotes": 0,
// Enforce propTypes declarations alphabetical sorting
"react/jsx-sort-prop-types": 0,
"react/jsx-sort-prop-types": [0, {
"ignoreCase": false,
"callbacksLast": false
}],
// Enforce props alphabetical sorting
"react/jsx-sort-props": 0,
"react/jsx-sort-props": [0, {
"ignoreCase": false,
"callbacksLast": false
}],
// Prevent React to be incorrectly marked as unused
"react/jsx-uses-react": 2,
"react/jsx-uses-react": [2, { "pragma": "React" }],
// Prevent variables used in JSX to be incorrectly marked as unused
"react/jsx-uses-vars": 2,
// Prevent usage of dangerous JSX properties
"react/no-danger": 0,
// Prevent usage of deprecated methods
"react/no-deprecated": 0,
"react/no-deprecated": [1, { "react": "0.14.0" }],
// Prevent usage of setState in componentDidMount
"react/no-did-mount-set-state": [2, "allow-in-func"],
// Prevent usage of setState in componentDidUpdate
"react/no-did-update-set-state": [2, "allow-in-func"],
// Prevent direct mutation of this.state
"react/no-direct-mutation-state": 0,
// Prevent multiple component definition per file
"react/no-multi-comp": 2,
"react/no-multi-comp": [2, { "ignoreStateless": true }],
// Prevent usage of setState
"react/no-set-state": 0,
// Prevent using string references in ref attribute.
Expand All @@ -70,11 +79,11 @@ module.exports = {
// Enforce ES5 or ES6 class for React Components
"react/prefer-es6-class": [2, "always"],
// Prevent missing props validation in a React component definition
"react/prop-types": 2,
"react/prop-types": [2, { "ignore": [], "customValidators": [] }],
// Prevent missing React when using JSX
"react/react-in-jsx-scope": 2,
// Restrict file extensions that may be required
"react/require-extension": 0,
"react/require-extension": [0, { "extensions": [".jsx"] }],
// Prevent extra closing tags for components without children
"react/self-closing-comp": 2,
// Enforce component methods order
Expand Down

0 comments on commit 77963c9

Please sign in to comment.