Skip to content

Commit

Permalink
style: update style
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Aug 2, 2019
1 parent f14b0d1 commit 481b1c8
Show file tree
Hide file tree
Showing 92 changed files with 2,537 additions and 2,537 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"eslint-config-canonical": "^17.3.2",
"gitdown": "^3.1.1",
"glob": "^7.1.4",
"husky": "^3.0.1",
"husky": "^3.0.2",
"jsonlint": "^1.6.3",
"mocha": "^6.2.0",
"semantic-release": "^15.13.18"
"semantic-release": "^15.13.19"
},
"engines": {
"node": ">=4"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/addAssertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const getAssertions = () => {

return {
invalid: _.map(codes.invalid, formatCodeSnippet),
valid: _.map(codes.valid, formatCodeSnippet)
valid: _.map(codes.valid, formatCodeSnippet),
};
});

Expand Down
2 changes: 1 addition & 1 deletion src/bin/checkDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fs from 'fs';
import path from 'path';
import {
getRules,
isFile
isFile,
} from './utilities';

const windows = (array, size) => {
Expand Down
4 changes: 2 additions & 2 deletions src/bin/checkTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs';
import path from 'path';
import {
getRules,
isFile
isFile,
} from './utilities';

const getTestIndexRules = () => {
Expand All @@ -24,7 +24,7 @@ const getTestIndexRules = () => {
return acc;
}, {
inRulesArray: false,
rules: []
rules: [],
});

const rules = result.rules;
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ const rules = {
'type-import-style': typeImportStyle,
'union-intersection-spacing': unionIntersectionSpacing,
'use-flow-type': useFlowType,
'valid-syntax': validSyntax
'valid-syntax': validSyntax,
};

export default {
configs: {
recommended
recommended,
},
rules: _.mapValues(rules, (rule, key) => {
if (key === 'no-types-missing-file-annotation') {
Expand All @@ -92,7 +92,7 @@ export default {

return {
...rule,
create: _.partial(checkFlowFileAnnotation, rule.create)
create: _.partial(checkFlowFileAnnotation, rule.create),
};
}),
rulesConfig: {
Expand Down Expand Up @@ -123,6 +123,6 @@ export default {
'type-import-style': 0,
'union-intersection-spacing': 0,
'use-flow-type': 0,
'valid-syntax': 0
}
'valid-syntax': 0,
},
};
16 changes: 8 additions & 8 deletions src/rules/arrayStyle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import needWrap from './needWrap';
const schema = [
{
enum: ['verbose', 'shorthand'],
type: 'string'
}
type: 'string',
},
];

const inlineType = (type) => {
Expand Down Expand Up @@ -33,13 +33,13 @@ export default (defaultConfig, simpleType) => {
context.report({
data: {
type: inlinedType,
wrappedType: wrappedInlinedType
wrappedType: wrappedInlinedType,
},
fix (fixer) {
return fixer.replaceText(node, 'Array<' + rawElementType + '>');
},
message: 'Use "Array<{{ type }}>", not "{{ wrappedType }}[]"',
node
node,
});
}
},
Expand All @@ -59,7 +59,7 @@ export default (defaultConfig, simpleType) => {
context.report({
data: {
type: inlinedType,
wrappedType: wrappedInlinedType
wrappedType: wrappedInlinedType,
},
fix (fixer) {
if (needWrap(elementTypeNode)) {
Expand All @@ -69,17 +69,17 @@ export default (defaultConfig, simpleType) => {
}
},
message: 'Use "{{ wrappedType }}[]", not "Array<{{ type }}>"',
node
node,
});
}
}
}
}
},
};
};

return {
create,
schema
schema,
};
};
2 changes: 1 addition & 1 deletion src/rules/arrayStyle/isSimpleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

const simpleTypePatterns = [
/^(?:Any|Array|Boolean|Generic|Mixed|Number|String|Void)TypeAnnotation$/,
/.+LiteralTypeAnnotation$/
/.+LiteralTypeAnnotation$/,
];

export default (node) => {
Expand Down
32 changes: 16 additions & 16 deletions src/rules/arrowParens.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const getLocation = (node) => {
return {
end: node.params[node.params.length - 1].loc.end,
start: node.params[0].loc.start
start: node.params[0].loc.start,
};
};

Expand Down Expand Up @@ -40,7 +40,7 @@ export default {

return fixer.replaceTextRange([
firstTokenOfParam.range[0],
closingParenToken.range[1]
closingParenToken.range[1],
], `${shouldAddSpaceForAsync ? ' ' : ''}${paramToken.value}`);
};

Expand Down Expand Up @@ -70,7 +70,7 @@ export default {
fix: fixParamsWithParenthesis,
loc: getLocation(node),
messageId: 'unexpectedParensInline',
node
node,
});
}

Expand All @@ -88,7 +88,7 @@ export default {
},
loc: getLocation(node),
messageId: 'expectedParensBlock',
node
node,
});
}

Expand All @@ -107,7 +107,7 @@ export default {
fix: fixParamsWithParenthesis,
loc: getLocation(node),
messageId: 'unexpectedParens',
node
node,
});
}

Expand All @@ -125,14 +125,14 @@ export default {
},
loc: getLocation(node),
messageId: 'expectedParens',
node
node,
});
}
}
};

return {
ArrowFunctionExpression: parens
ArrowFunctionExpression: parens,
};
},

Expand All @@ -141,7 +141,7 @@ export default {
category: 'ECMAScript 6',
description: 'require parentheses around arrow function arguments',
recommended: false,
url: 'https://eslint.org/docs/rules/arrow-parens'
url: 'https://eslint.org/docs/rules/arrow-parens',
},

fixable: 'code',
Expand All @@ -151,25 +151,25 @@ export default {
expectedParensBlock: 'Expected parentheses around arrow function argument having a body with curly braces.',

unexpectedParens: 'Unexpected parentheses around single function argument.',
unexpectedParensInline: 'Unexpected parentheses around single function argument having a body with no curly braces.'
unexpectedParensInline: 'Unexpected parentheses around single function argument having a body with no curly braces.',
},

type: 'layout'
type: 'layout',
},

schema: [
{
enum: ['always', 'as-needed']
enum: ['always', 'as-needed'],
},
{
additionalProperties: false,
properties: {
requireForBlockBody: {
default: false,
type: 'boolean'
}
type: 'boolean',
},
},
type: 'object'
}
]
type: 'object',
},
],
};
12 changes: 6 additions & 6 deletions src/rules/booleanStyle.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const schema = [
{
enum: ['bool', 'boolean'],
type: 'string'
}
type: 'string',
},
];

const create = (context) => {
Expand All @@ -18,7 +18,7 @@ const create = (context) => {
return fixer.replaceText(node, 'boolean');
},
message: 'Use "boolean", not "bool"',
node
node,
});
}

Expand All @@ -28,14 +28,14 @@ const create = (context) => {
return fixer.replaceText(node, 'bool');
},
message: 'Use "bool", not "boolean"',
node
node,
});
}
}
},
};
};

export default {
create,
schema
schema,
};
4 changes: 2 additions & 2 deletions src/rules/defineFlowType.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ const create = (context) => {
node.params.forEach((param) => {
makeDefined(param);
});
}
},
};
};

export default {
create,
schema
schema,
};
14 changes: 7 additions & 7 deletions src/rules/delimiterDangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import _ from 'lodash';
const schema = [
{
enum: ['always', 'always-multiline', 'only-multiline', 'never'],
type: 'string'
type: 'string',
},
{
enum: ['always', 'always-multiline', 'only-multiline', 'never'],
type: 'string'
}
type: 'string',
},
];

const create = (context) => {
Expand All @@ -21,7 +21,7 @@ const create = (context) => {
context.report({
fix,
message,
node
node,
});
};
};
Expand All @@ -33,7 +33,7 @@ const create = (context) => {
}),
noDangle: reporter(node, 'Missing trailing delimiter', (fixer) => {
return fixer.insertTextAfter(tokenToFix, ',');
})
}),
};
};

Expand Down Expand Up @@ -111,11 +111,11 @@ const create = (context) => {

TupleTypeAnnotation (node) {
evaluate(node, _.last(node.types));
}
},
};
};

export default {
create,
schema
schema,
};
Loading

0 comments on commit 481b1c8

Please sign in to comment.