Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
Last active August 5, 2019 16:39
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 cferdinandi/821b217edcf9fcbf01859c75704a314f to your computer and use it in GitHub Desktop.
Save cferdinandi/821b217edcf9fcbf01859c75704a314f to your computer and use it in GitHub Desktop.
My ESLint config (work-in-progress)
module.exports = exports = {
"env": {
"browser": true,
"es6": true,
},
"plugins": ["es"],
"extends": "eslint:recommended",
"rules": {
// Use tabs for indentation
"indent": ["warn", "tab", {
"ignoredNodes": ["TemplateLiteral *"]
}],
// Allow object.hasOwnKey() property
"no-prototype-builtins": ["off"],
// Enforce single quotes
"quotes": ["error", "single", {
"allowTemplateLiterals": true
}],
// Require semicolons
"semi": ["error", "always"],
"semi-style": ["error", "last"],
// Require strict equality tests
"eqeqeq": ["error", "always"],
// Require dot notation when possible
"dot-notation": ["error"],
// Disallow spaces in parentheses, arrays, and objects
// Also disallow spaces between function calls
"space-in-parens": ["error", "never"],
"object-curly-spacing": ["error", "never"],
"array-bracket-spacing": ["error", "never"],
"computed-property-spacing": ["error", "never"],
"func-call-spacing": ["error", "never"],
"function-paren-newline": ["error", "consistent"],
"object-curly-newline": ["error", {"consistent": true}],
"no-trailing-spaces": "error",
"no-irregular-whitespace": ["error", { "skipComments": true }],
"no-multi-spaces": "error",
// Require spacing after blocks, commas, and keywords
"block-spacing": "error",
"space-before-blocks": "error",
"comma-spacing": ["error", {"before": false, "after": true}],
"keyword-spacing": ["error", {"before": true, "after": true}],
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
"semi-spacing": ["error", {"before": false, "after": true}],
"space-before-function-paren": "error",
"space-infix-ops": ["error", {"int32Hint": false}],
"spaced-comment": ["error", "always", {"block": {"markers": ["!"], "balanced": true}}],
"switch-colon-spacing": "error",
// Enforce "1 true style" if/else statements
"brace-style": "error",
// Require commas after items in arrays
"comma-style": ["error", "last"],
// Disallow lonely if statements
"no-lonely-if": "error",
// Disallow variable mutli-assignment
"no-multi-assign": "error",
// Disallow ternary operators when nested
// or when simpler options exist
"no-nested-ternary": "error",
"no-unneeded-ternary": "error",
// No fat arrow functions
"es/no-arrow-functions": "error",
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment