Skip to content

Commit

Permalink
chore(docs & linting): Add linting & update docs & scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
codinronan committed Jun 12, 2018
1 parent 757d78a commit ed426d7
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 13 deletions.
74 changes: 74 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
(shamelessly copied from Stencil's fantastic template).

# Contributing

Thanks for your interest in contributing to Stencil Lift! :tada:


## Creating an Issue

* If you have a question about using Stencil, please ask in the [Stencil Worldwide Slack](https://stencil-worldwide.herokuapp.com/) group.

* It is required that you clearly describe the steps necessary to reproduce the issue you are running into. Although we would love to help our users as much as possible, diagnosing issues without clear reproduction steps is extremely time-consuming and simply not sustainable.

* The issue list of this repository is exclusively for bug reports and feature requests. Non-conforming issues will be closed immediately.

* Issues with no clear steps to reproduce will not be triaged. If an issue is labeled with "needs reply" and receives no further replies from the author of the issue for more than 5 days, it will be closed.

* If you think you have found a bug, or have a new feature idea, please start by making sure it hasn't already been [reported](https://github.com/engineerapart/stencil-lift/issues?utf8=%E2%9C%93&q=is%3Aissue). You can search through existing issues to see if there is a similar one reported. Include closed issues as it may have been closed with a solution.

* Next, [create a new issue](https://github.com/engineerapart/stencil-lift/issues/new) that thoroughly explains the problem. Please fill out the populated issue form before submitting the issue.


## Creating a Pull Request

* We appreciate you taking the time to contribute! Before submitting a pull request, we ask that you please [create an issue](#creating-an-issue) that explains the bug or feature request and let us know that you plan on creating a pull request for it. If an issue already exists, please comment on that issue letting us know you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.

* Looking for an issue to fix? Make sure to look through our issues with the [help wanted](https://github.com/engineerapart/stencil-lift/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) label!

### Setup

1. Fork the repo.
2. Clone your fork.
3. Make a branch for your change.
4. Run `npm install` (make sure you have [node](https://nodejs.org/en/) and [npm](http://blog.npmjs.org/post/85484771375/how-to-install-npm) installed first)


#### Updates

1. Unit test. Unit test. Unit test. Please take a look at how other unit tests are written, and you can't write too many tests.
2. If there is a `*.spec.ts` file located in the `test/` folder, update it to include a test for your change, if needed. If this file doesn't exist, please notify us.
3. Run `npm run test` or `npm run test.watch` to make sure all tests are working, regardless if a test was added.


## Commit Message Format

We have very precise rules over how our git commit messages should be formatted. This leads to readable messages that are easy to follow when looking through the project history. We also use the git commit messages to generate our changelog. (Ok you got us, it's basically Angular's commit message format).

`type(scope): subject`

#### Type
Must be one of the following:

* **feat**: A new feature
* **fix**: A bug fix
* **docs**: Documentation only changes
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **perf**: A code change that improves performance
* **test**: Adding missing tests
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation

#### Scope
The scope can be anything specifying place of the commit change. For example `renderer`, `compiler`, etc.

#### Subject
The subject contains succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* do not capitalize first letter
* do not place a period `.` at the end
* entire length of the commit message must not go over 50 characters
* describe what the commit does, not what issue it relates to or fixes
* **be brief, yet descriptive** - we should have a good understanding of what the commit does by reading the subject

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<a name="0.1.6"></a>
## 0.1.6 (2018-06-12)

* Initial (squash) commit
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"serve": "stencil-dev-server",
"start": "npm run dev",
"start:ssr": "npm run build && NODE_ENV=production node server.js",
"test": "jest",
"test": "npm run lint && jest",
"test.watch": "jest --watch",
"deploy": "npm run build && yarn publish --access public --patch"
"lint": "tslint --project ./tsconfig.json",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"deploy": "npm run build && npm run changelog && yarn publish --access public --patch"
},
"dependencies": {
"redux": "^4.0.0"
Expand All @@ -28,8 +30,11 @@
"@stencil/utils": "latest",
"@types/jest": "^23.0.0",
"compression": "^1.7.2",
"conventional-changelog-cli": "^2.0.1",
"express": "^4.16.3",
"jest": "^23.1.0"
"jest": "^23.1.0",
"tslint": "^5.10.0",
"tslint-ionic-rules": "^0.0.16"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/services/lift.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function Lift(options: LiftComponentOptions): ClassDecorator {
return function LiftDecorator(constructor: Function) {
const original = constructor.prototype.componentWillLoad;

constructor.prototype.componentWillLoad = async function () {
constructor.prototype.componentWillLoad = async function() {
// On client, use the singleton export.
let LiftInstance: LiftService = ClientLiftService;
// On server, we need an instance per request so that requests do not share state.
Expand Down
6 changes: 3 additions & 3 deletions src/services/lift.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ export class LiftService {
const { isServer, deleteOnClientLoad, initialState, mergeState, win } = options;
this._isServer = isServer;

let preloadedState = (<any>win)[__LIFT_STATE_KEY] || {};
let preloadedState = (win as any)[__LIFT_STATE_KEY] || {};
if (deleteOnClientLoad && !this.isServer && document) {
const elm = document.querySelector(`#${__LIFT_STATE_KEY}`);
if (elm) { elm.remove(); } // Stencil polyfills this so it is ok.
delete (<any>win)[__LIFT_STATE_KEY];
delete (win as any)[__LIFT_STATE_KEY];
}

if (initialState) {
preloadedState = mergeState ? { ...preloadedState, ...initialState } : initialState || {};
}

// const devToolsEnhancer = (<any>win).__REDUX_DEVTOOLS_EXTENSION__ && (<any>win).__REDUX_DEVTOOLS_EXTENSION__();
const composeEnhancers = isServer ? compose : ((<any>window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose);
const composeEnhancers = isServer ? compose : ((window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose);
this._store = createStore(
combinedReducers,
{ lift_state: preloadedState.lift_state || preloadedState },
Expand Down
16 changes: 10 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"declaration": false,
"declaration": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"jsxFactory": "h",
"lib": [
"dom",
"es2015"
"es2017"
],
"module": "esnext",
"moduleResolution": "node",
"module": "es2015",
"target": "es2015",
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"jsx": "react",
"jsxFactory": "h"
"pretty": true,
"target": "es2017"
},
"include": [
"src",
Expand Down
13 changes: 13 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "tslint-ionic-rules",
"rules": {
"ban-types": false,
"ban-comma-operator": false,
"no-empty": [ true, "allow-empty-catch" ],
"no-floating-promises": true,
"no-import-side-effect": false,
"no-var-keyword": false,
"no-var-requires": false,
"prefer-conditional-expression": false
}
}

0 comments on commit ed426d7

Please sign in to comment.