This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added tsc, tslint, prettier, and a test source file
- Loading branch information
1 parent
76a96f9
commit 4b92be1
Showing
8 changed files
with
413 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Dependencies | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"proseWrap": "always" | ||
"proseWrap": "always", | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "workflow-parser-js", | ||
"version": "1.0.0", | ||
"description": "A fast compact parser for GitHub workflows.", | ||
"repository": "https://github.com/OmarTawfik/workflow-parser-js", | ||
"author": "Omar Tawfik <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"prettier": "1.16.4", | ||
"tslint": "^5.12.1", | ||
"tslint-config-prettier": "1.18.0", | ||
"typescript": "3.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
* Copyright 2019 Omar Tawfik. Please see LICENSE file at the root of this repository. | ||
*/ | ||
|
||
import { TokenType } from "./scanning/tokens"; | ||
|
||
export class Compilation { | ||
public static create(text: string): Compilation { | ||
if ((text as unknown) === TokenType.Missing) { | ||
throw new Error("testing infrastructure"); | ||
} | ||
|
||
return { | ||
member: 1, | ||
}; | ||
} | ||
|
||
public readonly member = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*! | ||
* Copyright 2019 Omar Tawfik. Please see LICENSE file at the root of this repository. | ||
*/ | ||
|
||
export const enum TokenType { | ||
// Top-level keywords | ||
VersionKeyword = 1, | ||
WorkflowKeyword = 2, | ||
ActionKeyword = 3, | ||
|
||
// Bottom-level keywords | ||
OnKeyword = 4, | ||
ResolvesKeyword = 5, | ||
UsesKeyword = 6, | ||
NeedsKeyword = 7, | ||
RunsKeyword = 8, | ||
ArgsKeyword = 9, | ||
EnvKeyword = 10, | ||
SecretsKeyword = 11, | ||
|
||
// Punctuators | ||
Equal = 12, | ||
Comma = 13, | ||
|
||
// Brackets | ||
LeftCurlyBracket = 14, | ||
RightCurlyBracket = 15, | ||
LeftSquareBracket = 16, | ||
RightSquareBracket = 17, | ||
|
||
// Misc | ||
Identifier = 18, | ||
Comment = 19, | ||
|
||
// Literals | ||
IntegerLiteral = 20, | ||
StringLiteral = 21, | ||
|
||
// Generated | ||
Missing = 22, | ||
Unrecognized = 23, | ||
} | ||
|
||
export interface Token { | ||
readonly length: number; | ||
readonly position: number; | ||
readonly type: TokenType; | ||
} | ||
|
||
export namespace TokenUtils { | ||
export const getContents = (text: string, token: Token): string => text.substr(token.position, token.length); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
// Compilation options | ||
"target": "es2015", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"typeRoots": ["./types"], | ||
|
||
// Output files | ||
"declaration": true, | ||
"sourceMap": true, | ||
"inlineSources": true, | ||
|
||
// Diagnostics | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"defaultSeverity": "error", | ||
"extends": ["tslint:all", "tslint-config-prettier"], | ||
"rules": { | ||
"ban": [ | ||
true, | ||
{ "name": ["eval"], "message": "eval() is not type-safe." }, | ||
{ "name": ["*", "forEach"], "message": "Use a regular for loop instead." } | ||
], | ||
"completed-docs": false, | ||
"file-header": [ | ||
true, | ||
"Copyright 2019 Omar Tawfik\\. Please see LICENSE file at the root of this repository\\.\\n", | ||
"Copyright 2019 Omar Tawfik. Please see LICENSE file at the root of this repository." | ||
], | ||
"interface-name": false, | ||
"no-invalid-this": [true, "check-function-in-method"], | ||
"no-namespace": false, | ||
"typedef": false, | ||
"typeof-compare": true | ||
} | ||
} |
Oops, something went wrong.