Skip to content

Commit

Permalink
Merge pull request #34 from spiltcoffee/eslint-tslint
Browse files Browse the repository at this point in the history
Added tslint and eslint
  • Loading branch information
spiltcoffee authored Mar 9, 2019
2 parents 7e1b533 + 4a1e379 commit 72c71c5
Show file tree
Hide file tree
Showing 26 changed files with 588 additions and 187 deletions.
38 changes: 28 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ jobs:
- packages/@postdfm/dfm2ast/node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}

compile:
executor: node-executor
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- run: yarn compile

- persist_to_workspace:
root: packages
paths:
- ./postdfm/dist
- ./@postdfm/dfm2ast/dist

lint:
executor: node-executor
steps:
Expand All @@ -39,9 +56,12 @@ jobs:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- attach_workspace:
at: ~/repo/packages

- run: yarn lint:check

compile:
format:
executor: node-executor
steps:
- checkout
Expand All @@ -50,13 +70,8 @@ jobs:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- run: yarn compile
- run: yarn format:check

- persist_to_workspace:
root: packages
paths:
- ./postdfm/dist
- ./@postdfm/dfm2ast/dist
test:
executor: node-executor
steps:
Expand Down Expand Up @@ -93,15 +108,18 @@ workflows:
ci:
jobs:
- bootstrap
- lint:
- compile:
requires:
- bootstrap
- compile:
- lint:
requires:
- compile
- format:
requires:
- lint
- test:
requires:
- compile
- format
- release:
requires:
- test
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"eslint:recommended",
"plugin:node/recommended",
"plugin:jest/recommended",
"prettier"
]
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
dist/

# Logs
logs
*.log
Expand Down Expand Up @@ -81,6 +79,9 @@ typings/
# DynamoDB Local files
.dynamodb/

# js
dist/

# jest-junit (custom location)
test-results/

Expand Down
28 changes: 24 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"description": "Provides an API for easily transforming Delphi Forms",
"scripts": {
"bootstrap": "lerna bootstrap",
"prettier": "prettier --ignore-path .gitignore \"**/*.{js,json,ts}\"",
"lint:fix": "yarn run prettier --write",
"lint:check": "yarn run prettier --check",
"eslint": "eslint --ignore-path .gitignore \"**/*.js\"",
"tslint": "tslint \"**/*.ts\"",
"prettier": "prettier --ignore-path .gitignore \"**/*.{js,json,ts,yml}\"",
"lint:fix": "yarn eslint --fix && yarn tslint --fix",
"lint:check": "yarn eslint && yarn tslint",
"format:fix": "yarn prettier --write",
"format:check": "yarn prettier --check",
"compile": "lerna run compile",
"test": "jest",
"release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\${version}' --repositoryUrl ssh://[email protected]/spiltcoffee/postdfm.git"
Expand All @@ -20,6 +24,10 @@
"@types/nearley": "^2.11.0",
"commitlint": "^7.5.2",
"cz-lerna-changelog": "^2.0.2",
"eslint": "^5.15.1",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-jest": "^22.3.0",
"eslint-plugin-node": "^8.0.1",
"husky": "^1.3.1",
"jest": "^24.0.0",
"jest-junit": "^6.3.0",
Expand All @@ -29,6 +37,8 @@
"prettier": "^1.16.4",
"semantic-release": "~15.9.0",
"semantic-release-monorepo": "^6.1.1",
"tslint": "^5.13.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.3333"
},
"greenkeeper": {
Expand All @@ -45,7 +55,17 @@
}
},
"lint-staged": {
"*.{js,json,ts,yml}": [
"*.{json,yml}": [
"prettier --ignore-path .gitignore --write",
"git add"
],
"*.js": [
"eslint --ignore-path .gitignore",
"prettier --ignore-path .gitignore --write",
"git add"
],
"*.ts": [
"tslint",
"prettier --ignore-path .gitignore --write",
"git add"
]
Expand Down
153 changes: 0 additions & 153 deletions packages/@postdfm/dfm2ast/src/ast.ts

This file was deleted.

8 changes: 8 additions & 0 deletions packages/@postdfm/dfm2ast/src/ast/astNode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ASTType } from "./astType";

export class ASTNode {
public astType: ASTType;
constructor(astType: ASTType) {
this.astType = astType;
}
}
14 changes: 14 additions & 0 deletions packages/@postdfm/dfm2ast/src/ast/astType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export enum ASTType {
String = "string",
HexString = "hexString",
Integer = "integer",
Double = "double",
Boolean = "boolean",
Qualified = "qualified",
Item = "item",
StringList = "stringList",
QualifiedList = "qualifiedList",
ItemList = "itemList",
Property = "property",
Object = "object"
}
39 changes: 39 additions & 0 deletions packages/@postdfm/dfm2ast/src/ast/formObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ASTNode } from "./astNode";
import { ASTType } from "./astType";
import { ObjectKind } from "./objectKind";
import { Property } from "./property";

export class FormObject extends ASTNode {
public kind: ObjectKind;
public name: string;
public type: string;
public order: number;
public properties: Property[];
public children: FormObject[];

constructor(
kind: ObjectKind,
name: string,
type: string,
order: number,
properties?: Property[],
children?: FormObject[]
) {
super(ASTType.Object);
this.kind = kind;
this.name = name;
this.type = type;

if (order) {
this.order = order;
}

if (properties) {
this.properties = properties;
}

if (children) {
this.children = children;
}
}
}
23 changes: 23 additions & 0 deletions packages/@postdfm/dfm2ast/src/ast/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export { ASTType } from "./astType";
export { ASTNode } from "./astNode";

export { Value } from "./value/value";
export { StringValue } from "./value/stringValue";
export { HexStringValue } from "./value/hexStringValue";
export { IntegerValue } from "./value/integerValue";
export { DoubleValue } from "./value/doubleValue";
export { BooleanValue } from "./value/booleanValue";
export { QualifiedValue } from "./value/qualifiedValue";

export { Item } from "./item";

export { List } from "./list/list";
export { QualifiedList } from "./list/qualifiedList";
export { StringList } from "./list/stringList";
export { ItemList } from "./list/itemList";

export { Property } from "./property";

export { ObjectKind } from "./objectKind";

export { FormObject } from "./formObject";
Loading

0 comments on commit 72c71c5

Please sign in to comment.