diff --git a/eslint/.eslintrc.js b/eslint/.eslintrc.js index bfca875b2..1e68993d0 100644 --- a/eslint/.eslintrc.js +++ b/eslint/.eslintrc.js @@ -54,6 +54,9 @@ module.exports = { // Custom rule for ensuring that images and text use scenery node 'no-html-constructors': 2, + // enforce one true brace style + 'brace-style': [ 'error', 'stroustrup', { allowSingleLine: true } ], + // Custom rule for avoiding instanceof Array. 'no-instanceof-array': 2, @@ -267,6 +270,14 @@ module.exports = { // require or disallow space before blocks 'space-before-blocks': 'error', + // require or disallow space before function opening parenthesis + // https://eslint.org/docs/rules/space-before-function-paren + 'space-before-function-paren': [ 'error', { + anonymous: 'never', + named: 'never', + asyncArrow: 'always' + } ], + // require or disallow spaces inside parentheses 'space-in-parens': [ 'error', 'always' ], diff --git a/eslint/format_eslintrc.js b/eslint/format_eslintrc.js index 615b2940a..a16f28588 100644 --- a/eslint/format_eslintrc.js +++ b/eslint/format_eslintrc.js @@ -36,13 +36,9 @@ module.exports = { // enforce spacing inside single-line blocks // https://eslint.org/docs/rules/block-spacing - 'block-spacing': [ 'error', 'always' ], - - // enforce one true brace style - 'brace-style': [ 'error', 'stroustrup', { allowSingleLine: true } ], - - // require camel case names - camelcase: [ 'error', { properties: 'never', ignoreDestructuring: false } ], + // Leave it off because Webstorm doesn't add spacing to `() => {this.pLDChanged = true;}` to make it `() => { this.pLDChanged = true; } + // TODO: perhaps update webstorm rules, https://github.com/phetsims/phet-info/issues/150 + // 'block-spacing': [ 'error', 'always' ], // enforce or disallow capitalization of the first letter of a comment // https://eslint.org/docs/rules/capitalized-comments @@ -60,7 +56,8 @@ module.exports = { } ], // enforce newline at the end of file, with no multiple empty lines - 'eol-last': [ 'error', 'never' ], + // TODO: add to knit picky rules, https://github.com/phetsims/phet-info/issues/150 + // 'eol-last': [ 'error', 'never' ], // requires function names to match the name of the variable or property to which they are // assigned @@ -346,10 +343,6 @@ module.exports = { // TODO: enable, semver-major when eslint 5 is dropped 'prefer-exponentiation-operator': 'off', - // Prefer use of an object spread over Object.assign - // https://eslint.org/docs/rules/prefer-object-spread - 'prefer-object-spread': 'error', - // do not require jsdoc // https://eslint.org/docs/rules/require-jsdoc 'require-jsdoc': 'off', @@ -360,14 +353,6 @@ module.exports = { // sort variables within the same declaration block 'sort-vars': 'off', - // require or disallow space before function opening parenthesis - // https://eslint.org/docs/rules/space-before-function-paren - 'space-before-function-paren': [ 'error', { - anonymous: 'never', - named: 'never', - asyncArrow: 'always' - } ], - // require or disallow a space immediately following the // or /* in a comment // https://eslint.org/docs/rules/spaced-comment // TODO: https://github.com/phetsims/phet-info/issues/150