Skip to content

Commit

Permalink
Switch from number rule settings to string
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze committed Nov 6, 2016
1 parent a33ea2b commit b17ffb4
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module.exports = {
rules: {
// require the use of === and !==
// http://eslint.org/docs/rules/eqeqeq
eqeqeq: 2,
eqeqeq: 'error',
// Blacklist certain identifiers to prevent them being used
// http://eslint.org/docs/rules/id-blacklist
'id-blacklist': [ 2,
'id-blacklist': [ 'error',
'callback',
'cb',
'data',
Expand All @@ -14,6 +14,6 @@ module.exports = {
],
// disallow unmodified conditions of loops
// http://eslint.org/docs/rules/no-unmodified-loop-condition
'no-unmodified-loop-condition': 2,
'no-unmodified-loop-condition': 'error',
},
}
22 changes: 11 additions & 11 deletions rules/es6.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
module.exports = {
rules: {
// require parens in arrow function arguments
'arrow-parens': [ 2, 'as-needed' ],
'arrow-parens': [ 'error', 'as-needed' ],
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 2,
'import/default': 'error',
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
'import/imports-first': [ 2, '' ],
'import/imports-first': [ 'error', '' ],
// 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
'import/named': 2,
'import/named': 'error',
// ensure new line after last import/require in group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
'import/newline-after-import': 2,
'import/newline-after-import': 'error',
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 2,
'import/no-duplicates': 'error',
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
'import/no-extraneous-dependencies': [ 2, { devDependencies: true }],
'import/no-extraneous-dependencies': [ 'error', { devDependencies: true }],
// disallow arrow functions where they could be confused with comparisons
// http://eslint.org/docs/rules/no-confusing-arrow
'no-confusing-arrow': 0,
'no-confusing-arrow': 'off',
// suggest using the spread operator instead of .apply()
'prefer-spread': 2,
'prefer-spread': 'error',
// enforce usage of spacing in template strings
// http://eslint.org/docs/rules/template-curly-spacing
'template-curly-spacing': [ 2, 'never' ],
'template-curly-spacing': [ 'error', 'never' ],
// import sorting
// http://eslint.org/docs/rules/sort-imports
// disabled in favor of `wyze/sort-imports`
'sort-imports': 0,
'sort-imports': 'off',
},
}
18 changes: 9 additions & 9 deletions rules/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ module.exports = {
rules: {
// same as comma-dangle from ESLint
// https://github.com/gajus/eslint-plugin-flowtype#delimiter-dangle
'flowtype/delimiter-dangle': [ 2, 'always-multiline' ],
'flowtype/delimiter-dangle': [ 'error', 'always-multiline' ],
// disallow duplicate keys in types
// https://github.com/gajus/eslint-plugin-flowtype#no-dupe-keys
'flowtype/no-dupe-keys': 2,
'flowtype/no-dupe-keys': 'error',
// better to be specific, but only warn
// https://github.com/gajus/eslint-plugin-flowtype#no-weak-types
'flowtype/no-weak-types': 1,
'flowtype/no-weak-types': 'warn',
// only use commas in object types
// https://github.com/gajus/eslint-plugin-flowtype#object-type-delimiter
'flowtype/object-type-delimiter': [ 2, 'comma' ],
'flowtype/object-type-delimiter': [ 'error', 'comma' ],
// type all the functions!
// https://github.com/gajus/eslint-plugin-flowtype#require-parameter-type
'flowtype/require-parameter-type': 2,
'flowtype/require-parameter-type': 'error',
// just warn about missing return types
// https://github.com/gajus/eslint-plugin-flowtype#require-return-type
'flowtype/require-return-type': 1,
'flowtype/require-return-type': 'warn',
// warn when a file isn't typed
// https://github.com/gajus/eslint-plugin-flowtype#require-valid-file-annotation
'flowtype/require-valid-file-annotation': 1,
'flowtype/require-valid-file-annotation': 'warn',
// ew, semicolons
// https://github.com/gajus/eslint-plugin-flowtype#semi
'flowtype/semi': [ 2, 'never' ],
'flowtype/semi': [ 'error', 'never' ],
// enforce type names to begin with uppercase letter
// https://github.com/gajus/eslint-plugin-flowtype#type-id-match
'flowtype/type-id-match': [ 2, '^[A-Z].*$' ],
'flowtype/type-id-match': [ 'error', '^[A-Z].*$' ],
},
}
2 changes: 1 addition & 1 deletion rules/legacy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
rules: {
// specify the maximum number of statement allowed in a function
'max-statements': [ 2, 20 ],
'max-statements': [ 'error', 20 ],
},
}
2 changes: 1 addition & 1 deletion rules/preact.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
rules: {
// Maybe revisit this and write custom rules for Preact
'react/no-deprecated': [ 0 ],
'react/no-deprecated': [ 'off' ],
},
}
28 changes: 14 additions & 14 deletions rules/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@ module.exports = {
rules: {
// 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': 2,
'react/display-name': 'error',
// 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': [ 2, { forbid: [ 'any', 'array', 'object' ] }],
'react/forbid-prop-types': [ 'error', { forbid: [ 'any', 'array', 'object' ] }],
// 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': [ 'error', 'never', { allowMultiline: true }],
// Enforce or disallow spaces around equal signs in JSX attributes
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
'react/jsx-equals-spacing': [ 2, 'never' ],
'react/jsx-equals-spacing': [ 'error', 'never' ],
// Validate JSX indentation
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
'react/jsx-indent': [ 2, 2 ],
'react/jsx-indent': [ 'error', 2 ],
// Validate JSX has key prop when in array or iterator
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
'react/jsx-key': 2,
'react/jsx-key': 'error',
// 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': 2,
'react/jsx-no-duplicate-props': 'error',
// Enforce props alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-props': [ 2, {
'react/jsx-sort-props': [ 'error', {
callbacksLast: true,
shorthandFirst: true,
}],
// Validate spacing before closing bracket in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
'react/jsx-space-before-closing': [ 2, 'always' ],
'react/jsx-space-before-closing': [ 'error', 'always' ],
// Prevent usage of dangerous JSX properties
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
'react/no-danger': 2,
'react/no-danger': 'error',
// Prevent direct mutation of this.state
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
'react/no-direct-mutation-state': 2,
'react/no-direct-mutation-state': 'error',
// Prevent usage of setState
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
'react/no-set-state': 1,
'react/no-set-state': 'warn',
// Prevent using string references
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
'react/no-string-refs': 2,
'react/no-string-refs': 'error',
// Enforce propTypes declarations alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
'react/sort-prop-types': [ 2, {
'react/sort-prop-types': [ 'error', {
requiredFirst: true,
}],
},
Expand Down
14 changes: 7 additions & 7 deletions rules/style.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
module.exports = {
rules: {
// enforce spacing inside array brackets
'array-bracket-spacing': [ 2, 'always', {
'array-bracket-spacing': [ 'error', 'always', {
objectsInArrays: false,
arraysInArrays: false,
}],
// specify the maximum length of a line in your program
// https://github.com/eslint/eslint/blob/master/docs/rules/max-len.md
'max-len': [ 2, 80, 2, {
'max-len': [ 'error', 80, 2, {
ignoreUrls: true,
ignoreComments: false,
}],
// allow/disallow an empty newline after var statement
// https://github.com/eslint/eslint/blob/master/docs/rules/newline-after-var.md
'newline-after-var': [ 2, 'always' ],
'newline-after-var': [ 'error', 'always' ],
// Require newline before return statement
// https://github.com/eslint/eslint/tree/master/docs/rules/newline-before-return.md
'newline-before-return': 2,
'newline-before-return': 'error',
// disallow multiple empty lines and only one newline at the end
// https://github.com/eslint/eslint/blob/master/docs/rules/no-multiple-empty-lines.md
'no-multiple-empty-lines': [ 2, { max: 2, maxBOF: 0, maxEOF: 1 }],
'no-multiple-empty-lines': [ 'error', { max: 2, maxBOF: 0, maxEOF: 1 }],
// require or disallow use of semicolons instead of ASI
// I use Babel, it takes care of this for me
semi: [ 2, 'never' ],
semi: [ 'error', 'never' ],
// require or disallow spaces inside parentheses
// disabled, because this rule is strange
// TODO: write and implement a better rule
'space-in-parens': 0,
'space-in-parens': 'off',
},
}
4 changes: 2 additions & 2 deletions rules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module.exports = {
rules: {
// disallow var and named functions in global scope
// http://eslint.org/docs/rules/no-implicit-globals
'no-implicit-globals': 2,
'no-implicit-globals': 'error',
// disallow use of variables before they are defined
'no-use-before-define': [ 2, 'nofunc' ],
'no-use-before-define': [ 'error', 'nofunc' ],
},
}

0 comments on commit b17ffb4

Please sign in to comment.