Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
🔧 Require spacing inside of curly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
jamieconnolly committed Oct 12, 2017
1 parent f7160cc commit 77dda72
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
const eslint = require('eslint');
const isPlainObj = require('is-plain-obj');

it('should export an object', function() {
it('should export an object', () => {
const config = require('../index');

expect(isPlainObj(config)).toBe(true);
expect(config.extends).toBeTruthy();
expect(config.parser).toBeTruthy();
});

it('should not contain invalid rules', function() {
it('should not contain invalid rules', () => {
const cli = new eslint.CLIEngine({
configFile: 'index.js',
useEslintrc: false,
Expand Down
2 changes: 1 addition & 1 deletion rules/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
],
rules: {
// require constructor names to begin with a capital letter (ignores decorators)
'babel/new-cap': ['error', {capIsNew: false, newIsCap: true}],
'babel/new-cap': ['error', { capIsNew: false, newIsCap: true }],

// disallow this keywords outside of classes or class-like objects (includes class properties)
'babel/no-invalid-this': 'error',
Expand Down
4 changes: 2 additions & 2 deletions rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
'no-else-return': 'error',

// disallow empty functions
'no-empty-function': ['error', {allow: ['arrowFunctions', 'functions', 'methods']}],
'no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }],

// disallow empty destructuring patterns
'no-empty-pattern': 'error',
Expand Down Expand Up @@ -209,7 +209,7 @@ module.exports = {
'no-with': 'error',

// require using Error objects as Promise rejection reasons
'prefer-promise-reject-errors': ['error', {allowEmptyReject: true}],
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],

// enforce the consistent use of the radix argument when using parseInt()
'radix': 'error',
Expand Down
6 changes: 3 additions & 3 deletions rules/ecmascript-6.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
'no-class-assign': 'error',

// disallow arrow functions where they could be confused with comparisons
'no-confusing-arrow': ['error', {allowParens: true}],
'no-confusing-arrow': ['error', { allowParens: true }],

// disallow reassigning const variables
'no-const-assign': 'error',
Expand Down Expand Up @@ -64,10 +64,10 @@ module.exports = {
'no-var': 'error',

// require or disallow method and property shorthand syntax for object literals
'object-shorthand': ['error', 'always', {avoidQuotes: true}],
'object-shorthand': ['error', 'always', { avoidQuotes: true }],

// require arrow functions as callbacks
'prefer-arrow-callback': ['error', {allowNamedFunctions: true}],
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],

// require const declarations for variables that are never reassigned after declared
'prefer-const': 'error',
Expand Down
2 changes: 1 addition & 1 deletion rules/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'import/export': 'error',

// ensure consistent use of file extension within the import path
'import/extensions': ['error', {js: 'never', json: 'always'}],
'import/extensions': ['error', { js: 'never', json: 'always' }],

// ensure all imports appear before other statements
'import/first': ['error', 'absolute-first'],
Expand Down
4 changes: 2 additions & 2 deletions rules/possible-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
'for-direction': 'error',

// enforce return statements in getters
'getter-return': ['error', {allowImplicit: true}],
'getter-return': ['error', { allowImplicit: true }],

// disallow await inside of loops
'no-await-in-loop': 'error',
Expand Down Expand Up @@ -102,6 +102,6 @@ module.exports = {
'valid-jsdoc': 'off',

// enforce comparing typeof expressions against valid strings
'valid-typeof': ['error', {requireStringLiterals: true}],
'valid-typeof': ['error', { requireStringLiterals: true }],
},
};
24 changes: 14 additions & 10 deletions rules/stylistic-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
module.exports = {
rules: {
// enforce linebreaks after opening and before closing array brackets
'array-bracket-newline': ['error', {minItems: 3, multiline: true}],
'array-bracket-newline': ['error', { minItems: 3, multiline: true }],

// enforce consistent spacing inside array brackets
'array-bracket-spacing': 'error',

// enforce line breaks after each array element
'array-element-newline': ['error', {minItems: 3, multiline: true}],
'array-element-newline': ['error', { minItems: 3, multiline: true }],

// enforce consistent spacing inside single-line blocks
'block-spacing': 'error',
Expand Down Expand Up @@ -57,13 +57,17 @@ module.exports = {
'id-blacklist': 'off',

// enforce minimum and maximum identifier lengths
'id-length': ['error', {exceptions: ['x', 'y', 'i', 'j', 't', '_', '$']}],
'id-length': ['error', { exceptions: ['x', 'y', 'i', 'j', 't', '_', '$'] }],

// require identifiers to match a specified regular expression
'id-match': 'off',

// enforce consistent indentation
'indent': ['error', 2, {MemberExpression: 1, SwitchCase: 1, VariableDeclarator: {const: 3, let: 2, var: 2}}],
'indent': ['error', 2, {
MemberExpression: 1,
SwitchCase: 1,
VariableDeclarator: { const: 3, let: 2, var: 2 },
}],

// enforce the consistent use of either double or single quotes in JSX attributes
'jsx-quotes': 'error',
Expand All @@ -87,10 +91,10 @@ module.exports = {
'max-depth': 'error',

// enforce a maximum line length
'max-len': ['error', 119, 2, {ignoreComments: false, ignoreUrls: true}],
'max-len': ['error', 119, 2, { ignoreComments: false, ignoreUrls: true }],

// enforce a maximum number of lines per file
'max-lines': ['error', {skipBlankLines: true, skipComments: true}],
'max-lines': ['error', { skipBlankLines: true, skipComments: true }],

// enforce a maximum depth that callbacks can be nested
'max-nested-callbacks': ['error', 3],
Expand Down Expand Up @@ -141,7 +145,7 @@ module.exports = {
'no-multi-assign': 'error',

// disallow multiple empty lines
'no-multiple-empty-lines': ['error', {max: 2, maxEOF: 1}],
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],

// disallow negated conditions
'no-negated-condition': 'error',
Expand Down Expand Up @@ -183,10 +187,10 @@ module.exports = {
'object-curly-newline': 'off',

// enforce consistent spacing inside braces
'object-curly-spacing': 'off',
'object-curly-spacing': ['error', 'always', { arraysInObjects: true, objectsInObjects: false }],

// enforce placing object properties on separate lines
'object-property-newline': ['error', {allowMultiplePropertiesPerLine: true}],
'object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],

// enforce variables to be declared either together or separately in functions
'one-var': ['error', 'never'],
Expand Down Expand Up @@ -230,7 +234,7 @@ module.exports = {
'quote-props': ['error', 'consistent-as-needed'],

// enforce the consistent use of either backticks, double, or single quotes
'quotes': ['error', 'single', {avoidEscape: true}],
'quotes': ['error', 'single', { avoidEscape: true }],

// require JSDoc comments
'require-jsdoc': 'off',
Expand Down

0 comments on commit 77dda72

Please sign in to comment.