eslint-config-ao
Version:
AO ESLint config
58 lines (56 loc) • 4.46 kB
JavaScript
const { ERROR, WARN, OFF } = require('./eslint-consts');
module.exports = {
rules: {
//Stylistic Issues
'array-bracket-spacing': [WARN, 'never'], //require or disallow spaces inside array brackets
'brace-style': [WARN, '1tbs'], //enforce one true brace style
'block-spacing': [WARN, 'always'], // https://eslint.org/docs/rules/block-spacing
'comma-dangle': [ERROR, 'never'], //disallow trailing commas
'comma-spacing': [WARN, { before: false, after: true }], //enforce spacing before and after comma
'comma-style': [WARN, 'last'], //enforce one true comma style
'consistent-this': [ERROR, '_this'], //enforces consistent naming when capturing the current execution context
'eol-last': WARN, //enforce newline at the end of file, with no multiple empty lines
'func-call-spacing': [WARN, 'never'], //disallow space between function identifier and application
'func-names': OFF, //require function expressions to have a name
'func-style': OFF, //enforces use of function declarations or expressions
'key-spacing': [WARN, { beforeColon: false, afterColon: true }], //enforces spacing between keys and values in object literal properties
'keyword-spacing': ERROR, //require a space after return, throw, and case
'max-depth': [ERROR, 5], //specify the maximum depth that blocks can be nested
'max-len': [WARN, 120, 4, { ignoreComments: true, ignoreUrls: true, ignorePattern: '=[\'"]//[^\'"]+[\'"]' }], //specify the maximum length of a line in your program
'max-nested-callbacks': [ERROR, 5], //specify the maximum depth callbacks can be nested
'max-params': [ERROR, 5], //limits the number of parameters that can be used in the function declaration.
'max-statements': [WARN, 50], //specify the maximum number of statement allowed in a function
'new-cap': ERROR, //require a capital letter for constructors
'new-parens': ERROR, //disallow the omission of parentheses when invoking a constructor with no arguments
'no-array-constructor': ERROR, //disallow use of the Array constructor
'no-bitwise': ERROR, //disallow use of bitwise operators
'no-extra-semi': ERROR, //disallow unnecessary semicolons
'no-inline-comments': OFF, //disallow comments inline after code
'no-lonely-if': ERROR, //disallow if as the only statement in an else block
'no-mixed-spaces-and-tabs': [WARN, 'smart-tabs'], //disallow mixed spaces and tabs for indentation, but allow spaces for readability
'no-multiple-empty-lines': WARN, //disallow multiple empty lines
'no-nested-ternary': ERROR, //disallow nested ternary expressions
'no-new-object': ERROR, //disallow use of the Object constructor
'no-plusplus': OFF, //disallow use of unary operators, ++ and --
'no-ternary': OFF, //disallow the use of ternary operators
'no-trailing-spaces': WARN, //disallow trailing whitespace at the end of lines
'no-underscore-dangle': WARN, //disallow dangling underscores in identifiers
'object-curly-spacing': [WARN, 'always'], //require or disallow spaces inside braces
'one-var': OFF, //allow just one var statement per function
'operator-assignment': OFF, //require assignment operator shorthand where possible or prohibit it entirely
'padded-blocks': OFF, //enforce padding within blocks
'quote-props': [ERROR, 'as-needed'], //disallow reserved words being used as object literal keys
'semi-spacing': [WARN, { before: false, after: true }], //enforce spacing before and after semicolons
'sort-vars': OFF, //sort variables within the same declaration block
'space-before-blocks': OFF, //[1, "always"], //require or disallow space before blocks
'space-before-function-paren': [WARN, { anonymous: 'never', named: 'never' }], //require or disallow space before function parentheses
'space-in-parens': [WARN, 'never'], //require or disallow spaces inside parentheses
'space-infix-ops': WARN, //require spaces around operators
'space-unary-ops': ERROR, //require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
'wrap-regex': OFF, //require regex literals to be wrapped in parentheses
camelcase: WARN, //require camel case names
indent: [WARN, 'tab', { SwitchCase: 1 }], //this option sets a specific tab width for your code
quotes: [WARN, 'single'], //specify whether double or single quotes should be used
semi: [ERROR, 'always'] //require or disallow use of semicolons instead of ASI
}
};