Skip to content

Commit

Permalink
Update prettier (#125)
Browse files Browse the repository at this point in the history
* update prettier package

* apply prettier

* reverting back to trailingComma all

* removing unneeded options
  • Loading branch information
JordanBoltonMN authored Apr 8, 2020
1 parent 6c4a983 commit 9a1d69a
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 37 deletions.
9 changes: 4 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"tabWidth": 4,
"trailingComma": "all",
"parser": "typescript",
"arrowParens": "avoid",
"endOfLine": "auto",
"printWidth": 120,
"semi": true,
"singleQuote": false
"tabWidth": 4,
"trailingComma": "all"
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"mocha-junit-reporter": "^1.23.1",
"mocha-multi-reporters": "^1.1.7",
"performance-now": "^2.1.0",
"prettier": "^1.19.1",
"prettier": "^2.0.4",
"ts-loader": "^6.2.0",
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
Expand Down
1 change: 1 addition & 0 deletions src/common/patterns.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/inspection/activeNode/activeNodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function maybeActiveNode(
position: Position,
): ActiveNode | undefined {
const astSearch: AstNodeSearch = positionAstSearch(nodeIdMapCollection, leafNodeIds, position);
const maybeContextSearch: ParseContext.Node | undefined = positionContextSearch(astSearch, nodeIdMapCollection);
const maybeContextSearch: ParseContext.Node | undefined = positionContextSearch(nodeIdMapCollection, astSearch);

let maybeLeaf: TXorNode | undefined;
if (astSearch.maybeShiftedNode !== undefined) {
Expand All @@ -59,7 +59,7 @@ export function maybeActiveNode(
return {
position,
ancestry: NodeIdMapIterator.expectAncestry(nodeIdMapCollection, leaf.node.id),
maybeIdentifierUnderPosition: maybeIdentifierUnderPosition(nodeIdMapCollection, leaf, position),
maybeIdentifierUnderPosition: maybeIdentifierUnderPosition(nodeIdMapCollection, position, leaf),
};
}

Expand Down Expand Up @@ -220,8 +220,8 @@ function positionAstSearch(
}

function positionContextSearch(
astNodeSearch: AstNodeSearch,
nodeIdMapCollection: NodeIdMap.Collection,
astNodeSearch: AstNodeSearch,
): ParseContext.Node | undefined {
if (astNodeSearch.maybeNode === undefined) {
return undefined;
Expand All @@ -246,8 +246,8 @@ function positionContextSearch(

function maybeIdentifierUnderPosition(
nodeIdMapCollection: NodeIdMap.Collection,
leaf: TXorNode,
position: Position,
leaf: TXorNode,
): Ast.Identifier | Ast.GeneralizedIdentifier | undefined {
if (leaf.kind !== XorNodeKind.Ast) {
return undefined;
Expand Down
1 change: 0 additions & 1 deletion src/inspection/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ function traverseAncestors(
maybeInspected = autocompleteKeywordConstant(activeNode, child, maybeMappedKeywordKind);
}
}
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/inspection/invokeExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function tryInvokeExpression(
}

const inspected: InspectedInvokeExpression = {
xorNode: xorNode,
xorNode,
maybeName: maybeInvokeExpressionName(nodeIdMapCollection, xorNode.node.id),
maybeArguments: inspectInvokeExpressionArguments(nodeIdMapCollection, activeNode, ancestryIndex),
};
Expand Down
1 change: 0 additions & 1 deletion src/inspection/scope/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ function inspectNode(state: ScopeInspectionState, xorNode: TXorNode): void {

default:
getOrCreateScope(state, xorNode.node.id, undefined);
break;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/parser/parsers/naive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const GeneralizedIdentifierTerminatorTokenKinds: ReadonlyArray<TokenKind> = [
TokenKind.RightBracket,
];

// -------------------------------------------
// ---------- // 12.1.6 Identifiers ----------
// -------------------------------------------
// ----------------------------------------
// ---------- 12.1.6 Identifiers ----------
// ----------------------------------------

export function readIdentifier<S = IParserState>(
state: IParserState,
Expand Down
94 changes: 76 additions & 18 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,44 @@
"no-angle-bracket-type-assertion": true,
"no-internal-module": true,
"no-namespace": true,
"object-literal-shorthand": true,
"prettier": true,

// Internal
"blank-lines-between-switch-cases": true,
"deprecated-reason": true,
"format-imports": true,
"format-string-resources": true,
"format-todos": true,
"no-jsx-element": true,
"no-methods-in-interfaces": true,
"no-partial-default-props": true,
"no-redux-combine-reducer": true,
"safe-members-for-props": true,
"sort-string-resources": true,
"use-create-error-with-stack": true,
"validate-imports": true,
// tslint-microsoft-contrib rules we use with some configuration
"comment-format": [true, "check-space"],
/*
"file-header": [
true,
{
"match": "TODO",
"allow-single-line-comments": true
}
],
*/
"function-name": [
true,
{
// default
"method-regex": "^[a-z][\\w\\d]+$",

// default
"private-method-regex": "^[a-z][\\w\\d]+$",

// default
"protected-method-regex": "^[a-z][\\w\\d]+$",

// changed from uppercase to lowercase
"static-method-regex": "^[a-z][\\w\\d]+$",

// changed from lowercase to also allow uppercase (functional components)
"function-regex": "^([a-z]|[A-Z])[\\w\\d]+$"
}
Expand Down Expand Up @@ -55,9 +74,16 @@
]
}
],
"no-implicit-dependencies": [true, "dev"],
"no-import-side-effect": [true, { "ignore-module": "mocha" }],
"no-import-side-effect": [
true,
{
"ignore-module": "mocha"
}
],
"no-restricted-globals": [true, "name", "length", "event"],
"no-void-expression": [true, "ignore-arrow-function-shorthand"],
"one-variable-per-declaration": [true, "ignore-for-loop"],
"triple-equals": [true, "allow-undefined-check"],
"typedef": [
true,
"member-variable-declaration",
Expand All @@ -66,36 +92,68 @@
"call-signature",
"parameter"
],
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case", "allow-leading-underscore"],

"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-pascal-case",
"allow-snake-case",
"allow-leading-underscore"
],
// tslint-microsoft-contrib rules we don't use
"binary-expression-operand-order": false,
"completed-docs": false,
"cyclomatic-complexity": false,
"encoding": false,
"export-name": false,
"import-name": false,
"import-spacing": false,
"interface-name": false,
"match-default-export-name": false,
"max-classes-per-file": false,
"max-func-body-length": false,
"missing-jsdoc": false, // this will also be deprecated in tslint-microsoft-contrib 5.2.1
"mocha-no-side-effect-code": false,
"newline-before-return": false,
"no-redundant-jsdoc": false,
"no-any": false,
"no-cookies": false,
"no-duplicate-imports": false,
"no-increment-decrement": false,
"no-parameter-properties": false,
"no-reserved-keywords": false,
"no-suspicious-comment": false,
"no-use-before-declare": false,
"ordered-imports": false,
"prefer-for-of": false,
"prefer-type-cast": false,
"prefer-method-signature": false,
// tslint-microsoft-contrib rules we're temporarily disabling
"await-promise": false,
"cyclomatic-complexity": false,
"import-spacing": false,
"insecure-random": false,
"match-default-export-name": false,
"no-backbone-get-set-outside-model": false,
"no-empty-interface": false,
"no-floating-promises": false,
"no-for-in": false,
"no-function-expression": false,
"no-invalid-template-strings": false,
"no-invalid-this": false,
"no-non-null-assertion": false,
"no-object-literal-type-assertion": false,
"no-parameter-properties": false,
"no-parameter-reassignment": false,
"no-relative-imports": false,
"no-single-line-block-comment": false,
"no-suspicious-comment": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-initializer": false,
"no-unnecessary-local-variable": false,
"no-unnecessary-type-assertion": false,
"no-unsafe-any": false,
"no-use-before-declare": false,
"prefer-method-signature": false,
"prefer-type-cast": false,
"only-arrow-functions": false,
"prefer-template": false,
"promise-function-async": false,
"restrict-plus-operands": false,
"strict-boolean-expressions": false,
"switch-final-break": false,
"type-literal-delimiter": false,
"use-default-type-parameter": false
},
Expand Down

0 comments on commit 9a1d69a

Please sign in to comment.