Skip to content

Instantly share code, notes, and snippets.

@MadLittleMods
Created July 30, 2015 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadLittleMods/c81e5a6ecff5652361ac to your computer and use it in GitHub Desktop.
Save MadLittleMods/c81e5a6ecff5652361ac to your computer and use it in GitHub Desktop.
The .eslintrc I put at the root directory. A little bit flexible to allow for others code that gets checked out, etc.
{
"env": {
"browser": 1,
"es6": true,
"amd": true,
"node": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"spread": true,
"templateStrings": true,
"unicodeCodePointEscapes": true,
"jsx": true
},
"plugins": [
"react"
],
"rules": {
//
//Possible Errors
//
"comma-dangle": 2, // disallow or enforce trailing commas
"no-dupe-args": 2, // disallow duplicate arguments in functions
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
"no-extra-semi": 2, // disallow unnecessary semicolons
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
// Best Practices
//
"complexity": [1, 4],
"max-depth": [2, 3],
"no-extra-bind": 1, // disallow unnecessary function binding
"default-case": 2, // require default case in switch statements (off by default)
"dot-notation": 2, // encourages use of dot notation whenever possible
"eqeqeq": 2, // require the use of === and !==
"no-alert": 2, // disallow the use of alert, confirm, and prompt
"no-eval": 2, // disallow use of eval()
"no-implied-eval": 2, // disallow use of eval()-like methods
"no-loop-func": 1, // disallow creation of functions within loops
"no-redeclare": 2, // disallow declaring the same variable more then once
"no-return-assign": 2, // disallow use of assignment in return statement
"no-sequences": 2, // disallow use of comma operator
"no-with": 2, // disallow use of the with statement
"radix": 2, // require use of the second argument for parseInt() (off by default)
"wrap-iife": [2, "inside"], // require immediate function invocation to be wrapped in parentheses (off by default)
"yoda": 2, // require or disallow Yoda conditions
// Variables
//
"no-delete-var": 2, // disallow deletion of variables
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
// Style
//
"camelcase": 1,
"indent": [1, "tab"],
"comma-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after comma
"comma-style": [1, "last"],
"consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default)
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
"key-spacing": [1, {"beforeColon": false, "afterColon": true}], // enforces spacing between keys and values in object literal properties
"new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments
"no-lonely-if": 1, // disallow if as the only statement in an else block (off by default)
"no-nested-ternary": 1, // disallow nested ternary expressions (off by default)
"no-spaced-func": 1, // disallow space between function identifier and application
"no-trailing-spaces": [1, { skipBlankLines: true }], // disallow trailing whitespace at the end of lines
"no-underscore-dangle": 1, // disallow dangling underscores in identifiers
"operator-assignment": [2, "always"],
"operator-linebreak": [2, "after"],
"quote-props": [1, "as-needed"], // require quotes around object literal property names (off by default)
"quotes": [2, "single"],
"semi": [1, "always"], // require or disallow use of semicolons instead of ASI
"semi-spacing": [2, {"before": false, "after": true}],
"space-infix-ops": 1, // require spaces around operators
"space-return-throw-case": 1, // require a space after return, throw, and case
"space-unary-ops": [1, {"words": true, "nonwords": false}], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"wrap-regex": 2,
"react/jsx-boolean-value": 1,
"react/jsx-no-undef": 1,
"react/jsx-quotes": [2, "double", "avoid-escape"], // Enforce quote style for JSX attributes
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment