Skip to content

Commit

Permalink
build: integrate prettier code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and mgechev committed Jun 20, 2019
1 parent a1402d9 commit c0eadbe
Show file tree
Hide file tree
Showing 6 changed files with 324 additions and 72 deletions.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ jobs:
<<: *defaults
steps:
- attach_workspace: *attach_options
- run: yarn validate -- --ci
- run: yarn validate --ci
- run:
name: Validate Code Formatting
command: |
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
npx prettier --check ".prettierrc" $(git log $CIRCLE_BRANCH --name-only --diff-filter=ACM --pretty="format:" --not $(git for-each-ref --format='%(refname)' refs/heads/ | grep -v "refs/heads/$CIRCLE_BRANCH") -- "*.js" "*.ts")
fi
test:
<<: *defaults
Expand Down
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{js,ts}": ["prettier --write", "git add"]
}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"debug": "^4.1.1",
"glob": "^7.0.3",
"node-fetch": "^2.2.0",
"prettier": "^1.16.4",
"puppeteer": "1.12.2",
"quicktype-core": "^6.0.15",
"temp": "^0.9.0",
Expand Down Expand Up @@ -121,6 +122,7 @@
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"license-checker": "^20.1.0",
"lint-staged": "^8.1.5",
"minimatch": "^3.0.4",
"minimist": "^1.2.0",
"npm-registry-client": "8.6.0",
Expand All @@ -142,6 +144,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "node ./bin/devkit-admin hooks/pre-push"
}
}
Expand Down
59 changes: 0 additions & 59 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"defocus": true,
"import-groups": true,
"no-global-tslint-disable": true,
"single-eof-line": true,
// ==================================================================================================
// tslint-sonarts rules. See https://github.com/SonarSource/SonarTS
// These rules are part of the bug detection section of tslint-sonarts
Expand Down Expand Up @@ -52,45 +51,21 @@
"no-floating-promises": true,
"no-implicit-dependencies": true,
"no-import-side-effect": [true, {"ignore-module": "^(?!rxjs\/)"}],
"align": [
true,
"elements",
"members",
"parameters",
"statements"
],
"max-line-length": [true, 100],
"no-inferrable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"eofline": true,
"import-spacing": true,
"match-default-export-name": true,
"newline-before-return": true,
"no-consecutive-blank-lines": [true, 2],
"no-duplicate-variable": true,
"no-eval": true,
"no-any": true,
"no-arg": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-var-keyword": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace"
],
"ordered-imports": [
true,
{
Expand All @@ -99,29 +74,6 @@
}
],
"prefer-const": true,
"quotemark": [
true,
"single",
"avoid-escape"
],
"semicolon": [true, "always"],
"trailing-comma": [
true,
{
"multiline": "always",
"singleline": "never"
}
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"curly": true,
"file-header": [
true,
Expand All @@ -133,17 +85,6 @@
"check-format",
"allow-leading-underscore",
"allow-pascal-case"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-module",
"check-preblock",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
}
}
Loading

0 comments on commit c0eadbe

Please sign in to comment.