mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 00:28:25 -05:00
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"quote-props": 0
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
'rules': {
|
||||
rules: {
|
||||
// enforces getter/setter pairs in objects
|
||||
'accessor-pairs': 0,
|
||||
|
||||
@@ -11,26 +11,26 @@ module.exports = {
|
||||
'block-scoped-var': 2,
|
||||
|
||||
// specify the maximum cyclomatic complexity allowed in a program
|
||||
'complexity': [0, 11],
|
||||
complexity: [0, 11],
|
||||
|
||||
// require return statements to either always or never specify values
|
||||
'consistent-return': 2,
|
||||
|
||||
// specify curly brace conventions for all control statements
|
||||
'curly': [2, 'multi-line'],
|
||||
curly: [2, 'multi-line'],
|
||||
|
||||
// require default case in switch statements
|
||||
'default-case': [2, { 'commentPattern': '^no default$' }],
|
||||
'default-case': [2, { commentPattern: '^no default$' }],
|
||||
|
||||
// encourages use of dot notation whenever possible
|
||||
'dot-notation': [2, { 'allowKeywords': true }],
|
||||
'dot-notation': [2, { allowKeywords: true }],
|
||||
|
||||
// enforces consistent newlines before or after dots
|
||||
'dot-location': 0,
|
||||
|
||||
// require the use of === and !==
|
||||
// http://eslint.org/docs/rules/eqeqeq
|
||||
'eqeqeq': [2, 'allow-null'],
|
||||
eqeqeq: [2, 'allow-null'],
|
||||
|
||||
// make sure for-in loops have an if statement
|
||||
'guard-for-in': 2,
|
||||
@@ -54,7 +54,7 @@ module.exports = {
|
||||
// disallow empty functions, except for standalone funcs/arrows
|
||||
// http://eslint.org/docs/rules/no-empty-function
|
||||
'no-empty-function': [2, {
|
||||
'allow': [
|
||||
allow: [
|
||||
'arrowFunctions',
|
||||
'functions',
|
||||
'methods',
|
||||
@@ -104,7 +104,7 @@ module.exports = {
|
||||
'no-iterator': 2,
|
||||
|
||||
// disallow use of labels for anything other then loops and switches
|
||||
'no-labels': [2, { 'allowLoop': false, 'allowSwitch': false }],
|
||||
'no-labels': [2, { allowLoop: false, allowSwitch: false }],
|
||||
|
||||
// disallow unnecessary nested blocks
|
||||
'no-lone-blocks': 2,
|
||||
@@ -115,10 +115,10 @@ module.exports = {
|
||||
// disallow magic numbers
|
||||
// http://eslint.org/docs/rules/no-magic-numbers
|
||||
'no-magic-numbers': [0, {
|
||||
'ignore': [],
|
||||
'ignoreArrayIndexes': true,
|
||||
'enforceConst': true,
|
||||
'detectObjects': false,
|
||||
ignore: [],
|
||||
ignoreArrayIndexes: true,
|
||||
enforceConst: true,
|
||||
detectObjects: false,
|
||||
}],
|
||||
|
||||
// disallow use of multiple spaces
|
||||
@@ -149,7 +149,7 @@ module.exports = {
|
||||
// disallow reassignment of function parameters
|
||||
// disallow parameter object manipulation
|
||||
// rule: http://eslint.org/docs/rules/no-param-reassign.html
|
||||
'no-param-reassign': [2, { 'props': true }],
|
||||
'no-param-reassign': [2, { props: true }],
|
||||
|
||||
// disallow usage of __proto__ property
|
||||
'no-proto': 2,
|
||||
@@ -202,13 +202,13 @@ module.exports = {
|
||||
'no-void': 0,
|
||||
|
||||
// disallow usage of configurable warning terms in comments: e.g. todo
|
||||
'no-warning-comments': [0, { 'terms': ['todo', 'fixme', 'xxx'], 'location': 'start' }],
|
||||
'no-warning-comments': [0, { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
|
||||
|
||||
// disallow use of the with statement
|
||||
'no-with': 2,
|
||||
|
||||
// require use of the second argument for parseInt()
|
||||
'radix': 2,
|
||||
radix: 2,
|
||||
|
||||
// requires to declare all vars on top of their containing scope
|
||||
'vars-on-top': 2,
|
||||
@@ -218,6 +218,6 @@ module.exports = {
|
||||
'wrap-iife': [2, 'outside'],
|
||||
|
||||
// require or disallow Yoda conditions
|
||||
'yoda': 2
|
||||
yoda: 2
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
'rules': {
|
||||
rules: {
|
||||
// require trailing commas in multiline object literals
|
||||
'comma-dangle': [2, 'always-multiline'],
|
||||
|
||||
@@ -42,9 +42,9 @@ module.exports = {
|
||||
// disallow unnecessary parentheses
|
||||
// http://eslint.org/docs/rules/no-extra-parens
|
||||
'no-extra-parens': [0, 'all', {
|
||||
'conditionalAssign': true,
|
||||
'nestedBinaryExpressions': false,
|
||||
'returnAssign': false,
|
||||
conditionalAssign: true,
|
||||
nestedBinaryExpressions: false,
|
||||
returnAssign: false,
|
||||
}],
|
||||
|
||||
// disallow unnecessary semicolons
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
module.exports = {
|
||||
'env': {
|
||||
'es6': true
|
||||
env: {
|
||||
es6: true
|
||||
},
|
||||
'parserOptions': {
|
||||
'ecmaVersion': 6,
|
||||
'sourceType': 'module',
|
||||
'ecmaFeatures': {
|
||||
'generators': false,
|
||||
'objectLiteralDuplicateProperties': false
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
generators: false,
|
||||
objectLiteralDuplicateProperties: false
|
||||
}
|
||||
},
|
||||
|
||||
'rules': {
|
||||
rules: {
|
||||
// enforces no braces where they can be omitted
|
||||
// http://eslint.org/docs/rules/arrow-body-style
|
||||
'arrow-body-style': [2, 'as-needed'],
|
||||
@@ -21,14 +21,14 @@ module.exports = {
|
||||
|
||||
// require space before/after arrow function's arrow
|
||||
// http://eslint.org/docs/rules/arrow-spacing
|
||||
'arrow-spacing': [2, { 'before': true, 'after': true }],
|
||||
'arrow-spacing': [2, { before: true, after: true }],
|
||||
|
||||
// verify super() callings in constructors
|
||||
'constructor-super': 0,
|
||||
|
||||
// enforce the spacing around the * in generator functions
|
||||
// http://eslint.org/docs/rules/generator-star-spacing
|
||||
'generator-star-spacing': [2, { 'before': false, 'after': true }],
|
||||
'generator-star-spacing': [2, { before: false, after: true }],
|
||||
|
||||
// disallow modifying variables of class declarations
|
||||
// http://eslint.org/docs/rules/no-class-assign
|
||||
@@ -37,7 +37,7 @@ module.exports = {
|
||||
// disallow arrow functions where they could be confused with comparisons
|
||||
// http://eslint.org/docs/rules/no-confusing-arrow
|
||||
'no-confusing-arrow': [2, {
|
||||
'allowParens': true,
|
||||
allowParens: true,
|
||||
}],
|
||||
|
||||
// disallow modifying variables that are declared using const
|
||||
@@ -76,20 +76,20 @@ module.exports = {
|
||||
// require method and property shorthand syntax for object literals
|
||||
// http://eslint.org/docs/rules/object-shorthand
|
||||
'object-shorthand': [2, 'always', {
|
||||
'ignoreConstructors': false,
|
||||
'avoidQuotes': true,
|
||||
ignoreConstructors: false,
|
||||
avoidQuotes: true,
|
||||
}],
|
||||
|
||||
// suggest using arrow functions as callbacks
|
||||
'prefer-arrow-callback': [2, {
|
||||
'allowNamedFunctions': false,
|
||||
'allowUnboundThis': true,
|
||||
allowNamedFunctions: false,
|
||||
allowUnboundThis: true,
|
||||
}],
|
||||
|
||||
// suggest using of const declaration for variables that are never modified after declared
|
||||
'prefer-const': [2, {
|
||||
'destructuring': 'any',
|
||||
'ignoreReadBeforeAssign': true,
|
||||
destructuring: 'any',
|
||||
ignoreReadBeforeAssign: true,
|
||||
}],
|
||||
|
||||
// suggest using Reflect methods where applicable
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
module.exports = {
|
||||
'env': {
|
||||
'es6': true
|
||||
env: {
|
||||
es6: true
|
||||
},
|
||||
'parserOptions': {
|
||||
'ecmaVersion': 6,
|
||||
'sourceType': 'module'
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module'
|
||||
},
|
||||
'plugins': [
|
||||
plugins: [
|
||||
'import'
|
||||
],
|
||||
|
||||
'settings': {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
'node': {
|
||||
'extensions': ['.js', '.json']
|
||||
node: {
|
||||
extensions: ['.js', '.json']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'rules': {
|
||||
rules: {
|
||||
// Static analysis:
|
||||
|
||||
// ensure imports point to files/modules that can be resolved
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
|
||||
'import/no-unresolved': [2, { 'commonjs': true }],
|
||||
'import/no-unresolved': [2, { commonjs: true }],
|
||||
|
||||
// ensure named imports coupled with named exports
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
|
||||
@@ -60,8 +60,8 @@ module.exports = {
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
||||
// TODO: enable
|
||||
'import/no-extraneous-dependencies': [0, {
|
||||
'devDependencies': false,
|
||||
'optionalDependencies': false,
|
||||
devDependencies: false,
|
||||
optionalDependencies: false,
|
||||
}],
|
||||
|
||||
// Forbid mutable exports
|
||||
@@ -106,7 +106,7 @@ module.exports = {
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
|
||||
// TODO: enable?
|
||||
'import/order': [0, {
|
||||
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
||||
'newlines-between': 'never',
|
||||
}],
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module.exports = {
|
||||
'env': {
|
||||
'node': true
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
|
||||
'rules': {
|
||||
rules: {
|
||||
// enforce return after a callback
|
||||
'callback-return': 0,
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
'rules': {
|
||||
rules: {
|
||||
// babel inserts `'use strict';` for us
|
||||
'strict': [2, 'never']
|
||||
strict: [2, 'never']
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
'rules': {
|
||||
rules: {
|
||||
// enforce spacing inside array brackets
|
||||
'array-bracket-spacing': [2, 'never'],
|
||||
|
||||
@@ -8,13 +8,13 @@ module.exports = {
|
||||
'block-spacing': [2, 'always'],
|
||||
|
||||
// enforce one true brace style
|
||||
'brace-style': [2, '1tbs', { 'allowSingleLine': true }],
|
||||
'brace-style': [2, '1tbs', { allowSingleLine: true }],
|
||||
|
||||
// require camel case names
|
||||
'camelcase': [2, { 'properties': 'never' }],
|
||||
camelcase: [2, { properties: 'never' }],
|
||||
|
||||
// enforce spacing before and after comma
|
||||
'comma-spacing': [2, { 'before': false, 'after': true }],
|
||||
'comma-spacing': [2, { before: false, after: true }],
|
||||
|
||||
// enforce one true comma style
|
||||
'comma-style': [2, 'last'],
|
||||
@@ -47,23 +47,23 @@ module.exports = {
|
||||
|
||||
// this option sets a specific tab width for your code
|
||||
// http://eslint.org/docs/rules/indent
|
||||
'indent': [2, 2, { 'SwitchCase': 1, 'VariableDeclarator': 1 }],
|
||||
indent: [2, 2, { SwitchCase: 1, VariableDeclarator: 1 }],
|
||||
|
||||
// specify whether double or single quotes should be used in JSX attributes
|
||||
// http://eslint.org/docs/rules/jsx-quotes
|
||||
'jsx-quotes': 0,
|
||||
|
||||
// enforces spacing between keys and values in object literal properties
|
||||
'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }],
|
||||
'key-spacing': [2, { beforeColon: false, afterColon: true }],
|
||||
|
||||
// require a space before & after certain keywords
|
||||
'keyword-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true,
|
||||
'overrides': {
|
||||
'return': { 'after': true },
|
||||
'throw': { 'after': true },
|
||||
'case': { 'after': true }
|
||||
before: true,
|
||||
after: true,
|
||||
overrides: {
|
||||
return: { after: true },
|
||||
throw: { after: true },
|
||||
case: { after: true }
|
||||
}
|
||||
}],
|
||||
|
||||
@@ -79,8 +79,8 @@ module.exports = {
|
||||
// specify the maximum length of a line in your program
|
||||
// http://eslint.org/docs/rules/max-len
|
||||
'max-len': [2, 100, 2, {
|
||||
'ignoreUrls': true,
|
||||
'ignoreComments': false
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false
|
||||
}],
|
||||
|
||||
// specify the maximum depth callbacks can be nested
|
||||
@@ -94,10 +94,10 @@ module.exports = {
|
||||
|
||||
// restrict the number of statements per line
|
||||
// http://eslint.org/docs/rules/max-statements-per-line
|
||||
'max-statements-per-line': [0, { 'max': 1 }],
|
||||
'max-statements-per-line': [0, { max: 1 }],
|
||||
|
||||
// require a capital letter for constructors
|
||||
'new-cap': [2, { 'newIsCap': true }],
|
||||
'new-cap': [2, { newIsCap: true }],
|
||||
|
||||
// disallow the omission of parentheses when invoking a constructor with no arguments
|
||||
'new-parens': 0,
|
||||
@@ -111,7 +111,7 @@ module.exports = {
|
||||
// enforces new line after each method call in the chain to make it
|
||||
// more readable and easy to maintain
|
||||
// http://eslint.org/docs/rules/newline-per-chained-call
|
||||
'newline-per-chained-call': [2, { 'ignoreChainWithDepth': 3 }],
|
||||
'newline-per-chained-call': [2, { ignoreChainWithDepth: 3 }],
|
||||
|
||||
// disallow use of the Array constructor
|
||||
'no-array-constructor': 2,
|
||||
@@ -132,7 +132,7 @@ module.exports = {
|
||||
'no-mixed-spaces-and-tabs': 2,
|
||||
|
||||
// disallow multiple empty lines and only one newline at the end
|
||||
'no-multiple-empty-lines': [2, { 'max': 2, 'maxEOF': 1 }],
|
||||
'no-multiple-empty-lines': [2, { max: 2, maxEOF: 1 }],
|
||||
|
||||
// disallow negated conditions
|
||||
// http://eslint.org/docs/rules/no-negated-condition
|
||||
@@ -167,12 +167,12 @@ module.exports = {
|
||||
'no-trailing-spaces': 2,
|
||||
|
||||
// disallow dangling underscores in identifiers
|
||||
'no-underscore-dangle': [2, { 'allowAfterThis': false }],
|
||||
'no-underscore-dangle': [2, { allowAfterThis: false }],
|
||||
|
||||
// disallow the use of Boolean literals in conditional expressions
|
||||
// also, prefer `a || b` over `a ? a : b`
|
||||
// http://eslint.org/docs/rules/no-unneeded-ternary
|
||||
'no-unneeded-ternary': [2, { 'defaultAssignment': false }],
|
||||
'no-unneeded-ternary': [2, { defaultAssignment: false }],
|
||||
|
||||
// disallow whitespace before properties
|
||||
// http://eslint.org/docs/rules/no-whitespace-before-property
|
||||
@@ -185,7 +185,7 @@ module.exports = {
|
||||
// http://eslint.org/docs/rules/object-property-newline
|
||||
// TODO: enable when https://github.com/eslint/eslint/issues/5667#issuecomment-219334864 is resolved
|
||||
'object-property-newline': [0, {
|
||||
'allowMultiplePropertiesPerLine': true,
|
||||
allowMultiplePropertiesPerLine: true,
|
||||
}],
|
||||
|
||||
// allow just one var statement per function
|
||||
@@ -206,20 +206,20 @@ module.exports = {
|
||||
|
||||
// require quotes around object literal property names
|
||||
// http://eslint.org/docs/rules/quote-props.html
|
||||
'quote-props': [2, 'as-needed', { 'keywords': false, 'unnecessary': true, 'numbers': false }],
|
||||
'quote-props': [2, 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
|
||||
|
||||
// specify whether double or single quotes should be used
|
||||
'quotes': [2, 'single', { 'avoidEscape': true }],
|
||||
quotes: [2, 'single', { avoidEscape: true }],
|
||||
|
||||
// do not require jsdoc
|
||||
// http://eslint.org/docs/rules/require-jsdoc
|
||||
'require-jsdoc': 0,
|
||||
|
||||
// require or disallow use of semicolons instead of ASI
|
||||
'semi': [2, 'always'],
|
||||
semi: [2, 'always'],
|
||||
|
||||
// enforce spacing before and after semicolons
|
||||
'semi-spacing': [2, { 'before': false, 'after': true }],
|
||||
'semi-spacing': [2, { before: false, after: true }],
|
||||
|
||||
// sort variables within the same declaration block
|
||||
'sort-vars': 0,
|
||||
@@ -229,7 +229,7 @@ module.exports = {
|
||||
|
||||
// require or disallow space before function opening parenthesis
|
||||
// http://eslint.org/docs/rules/space-before-function-paren
|
||||
'space-before-function-paren': [2, { 'anonymous': 'always', 'named': 'never' }],
|
||||
'space-before-function-paren': [2, { anonymous: 'always', named: 'never' }],
|
||||
|
||||
// require or disallow spaces inside parentheses
|
||||
'space-in-parens': [2, 'never'],
|
||||
@@ -242,8 +242,8 @@ module.exports = {
|
||||
|
||||
// require or disallow a space immediately following the // or /* in a comment
|
||||
'spaced-comment': [2, 'always', {
|
||||
'exceptions': ['-', '+'],
|
||||
'markers': ['=', '!'] // space here to support sprockets directives
|
||||
exceptions: ['-', '+'],
|
||||
markers: ['=', '!'] // space here to support sprockets directives
|
||||
}],
|
||||
|
||||
// require regex literals to be wrapped in parentheses
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
'rules': {
|
||||
rules: {
|
||||
// enforce or disallow variable initializations at definition
|
||||
'init-declarations': 0,
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = {
|
||||
'no-undefined': 0,
|
||||
|
||||
// disallow declaration of variables that are not used in the code
|
||||
'no-unused-vars': [2, { 'vars': 'local', 'args': 'after-used' }],
|
||||
'no-unused-vars': [2, { vars: 'local', args: 'after-used' }],
|
||||
|
||||
// disallow use of variables before they are defined
|
||||
'no-use-before-define': 2
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"quote-props": 0
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
module.exports = {
|
||||
'plugins': [
|
||||
plugins: [
|
||||
'jsx-a11y',
|
||||
'react'
|
||||
],
|
||||
'ecmaFeatures': {
|
||||
'jsx': true
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
},
|
||||
'rules': {
|
||||
rules: {
|
||||
// Require ARIA roles to be valid and non-abstract
|
||||
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
|
||||
'jsx-a11y/aria-role': 2,
|
||||
|
||||
76
packages/eslint-config-airbnb/rules/react.js
vendored
76
packages/eslint-config-airbnb/rules/react.js
vendored
@@ -1,30 +1,30 @@
|
||||
module.exports = {
|
||||
'plugins': [
|
||||
plugins: [
|
||||
'react'
|
||||
],
|
||||
'parserOptions': {
|
||||
'ecmaFeatures': {
|
||||
'jsx': true,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
'ecmaFeatures': {
|
||||
'jsx': true
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
},
|
||||
|
||||
// View link below for react rules documentation
|
||||
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
||||
'rules': {
|
||||
rules: {
|
||||
// specify whether double or single quotes should be used in JSX attributes
|
||||
// http://eslint.org/docs/rules/jsx-quotes
|
||||
'jsx-quotes': [2, 'prefer-double'],
|
||||
|
||||
// Prevent missing displayName in a React component definition
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
||||
'react/display-name': [0, { 'ignoreTranspilerName': false }],
|
||||
'react/display-name': [0, { ignoreTranspilerName: false }],
|
||||
|
||||
// Forbid certain propTypes (any, array, object)
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
||||
'react/forbid-prop-types': [0, { 'forbid': ['any', 'array', 'object'] }],
|
||||
'react/forbid-prop-types': [0, { forbid: ['any', 'array', 'object'] }],
|
||||
|
||||
// Enforce boolean attributes notation in JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
||||
@@ -36,13 +36,13 @@ module.exports = {
|
||||
|
||||
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
||||
'react/jsx-curly-spacing': [2, 'never', { 'allowMultiline': true }],
|
||||
'react/jsx-curly-spacing': [2, 'never', { allowMultiline: true }],
|
||||
|
||||
// Enforce event handler naming conventions in JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
||||
'react/jsx-handler-names': [0, {
|
||||
'eventHandlerPrefix': 'handle',
|
||||
'eventHandlerPropPrefix': 'on',
|
||||
eventHandlerPrefix: 'handle',
|
||||
eventHandlerPropPrefix: 'on',
|
||||
}],
|
||||
|
||||
// Validate props indentation in JSX
|
||||
@@ -55,19 +55,19 @@ module.exports = {
|
||||
|
||||
// Limit maximum of props on a single line in JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
||||
'react/jsx-max-props-per-line': [0, { 'maximum': 1 }],
|
||||
'react/jsx-max-props-per-line': [0, { maximum: 1 }],
|
||||
|
||||
// Prevent usage of .bind() in JSX props
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
||||
'react/jsx-no-bind': [2, {
|
||||
'ignoreRefs': true,
|
||||
'allowArrowFunctions': true,
|
||||
'allowBind': false,
|
||||
ignoreRefs: true,
|
||||
allowArrowFunctions: true,
|
||||
allowBind: false,
|
||||
}],
|
||||
|
||||
// Prevent duplicate props in JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
||||
'react/jsx-no-duplicate-props': [0, { 'ignoreCase': false }],
|
||||
'react/jsx-no-duplicate-props': [0, { ignoreCase: false }],
|
||||
|
||||
// Prevent usage of unwrapped JSX strings
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
||||
@@ -80,15 +80,15 @@ module.exports = {
|
||||
// Enforce PascalCase for user-defined JSX components
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
||||
'react/jsx-pascal-case': [2, {
|
||||
'allowAllCaps': true,
|
||||
'ignore': [],
|
||||
allowAllCaps: true,
|
||||
ignore: [],
|
||||
}],
|
||||
|
||||
// Enforce propTypes declarations alphabetical sorting
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
||||
'react/sort-prop-types': [0, {
|
||||
'ignoreCase': false,
|
||||
'callbacksLast': false,
|
||||
ignoreCase: false,
|
||||
callbacksLast: false,
|
||||
}],
|
||||
|
||||
// deprecated in favor of react/jsx-sort-props
|
||||
@@ -97,13 +97,13 @@ module.exports = {
|
||||
// Enforce props alphabetical sorting
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
||||
'react/jsx-sort-props': [0, {
|
||||
'ignoreCase': false,
|
||||
'callbacksLast': false,
|
||||
ignoreCase: false,
|
||||
callbacksLast: false,
|
||||
}],
|
||||
|
||||
// Prevent React to be incorrectly marked as unused
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
||||
'react/jsx-uses-react': [2, { 'pragma': 'React' }],
|
||||
'react/jsx-uses-react': [2, { pragma: 'React' }],
|
||||
|
||||
// Prevent variables used in JSX to be incorrectly marked as unused
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
||||
@@ -115,7 +115,7 @@ module.exports = {
|
||||
|
||||
// Prevent usage of deprecated methods
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
||||
'react/no-deprecated': [1, { 'react': '0.14.0' }],
|
||||
'react/no-deprecated': [1, { react: '0.14.0' }],
|
||||
|
||||
// Prevent usage of setState in componentDidMount
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
||||
@@ -135,7 +135,7 @@ module.exports = {
|
||||
|
||||
// Prevent multiple component definition per file
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
||||
'react/no-multi-comp': [2, { 'ignoreStateless': true }],
|
||||
'react/no-multi-comp': [2, { ignoreStateless: true }],
|
||||
|
||||
// Prevent usage of setState
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
||||
@@ -159,7 +159,7 @@ module.exports = {
|
||||
|
||||
// Prevent missing props validation in a React component definition
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
||||
'react/prop-types': [2, { 'ignore': [], 'customValidators': [] }],
|
||||
'react/prop-types': [2, { ignore: [], customValidators: [] }],
|
||||
|
||||
// Prevent missing React when using JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
||||
@@ -167,7 +167,7 @@ module.exports = {
|
||||
|
||||
// Restrict file extensions that may be required
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
|
||||
'react/require-extension': [0, { 'extensions': ['.jsx'] }],
|
||||
'react/require-extension': [0, { extensions: ['.jsx'] }],
|
||||
|
||||
// Require render() methods to return something
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
||||
@@ -184,7 +184,7 @@ module.exports = {
|
||||
// Enforce component methods order
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
|
||||
'react/sort-comp': [2, {
|
||||
'order': [
|
||||
order: [
|
||||
'static-methods',
|
||||
'lifecycle',
|
||||
'/^on.+$/',
|
||||
@@ -198,9 +198,9 @@ module.exports = {
|
||||
// Prevent missing parentheses around multilines JSX
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
|
||||
'react/wrap-multilines': [2, {
|
||||
'declaration': true,
|
||||
'assignment': true,
|
||||
'return': true
|
||||
declaration: true,
|
||||
assignment: true,
|
||||
return: true
|
||||
}],
|
||||
|
||||
// Require that the first prop in a JSX element be on a new line when the element is multiline
|
||||
@@ -221,15 +221,15 @@ module.exports = {
|
||||
'react/jsx-no-target-blank': 0
|
||||
},
|
||||
|
||||
'settings': {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
'node': {
|
||||
'extensions': ['.js', '.jsx', '.json']
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.json']
|
||||
}
|
||||
},
|
||||
'react': {
|
||||
'pragma': 'React',
|
||||
'version': '0.14'
|
||||
react: {
|
||||
pragma: 'React',
|
||||
version: '0.14'
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user