Skip to content

Commit

Permalink
chore: prettier (#24)
Browse files Browse the repository at this point in the history
Add prettier settings for code style.
  • Loading branch information
Dan Ziv authored Jul 16, 2018
1 parent e461745 commit ad63326
Show file tree
Hide file tree
Showing 17 changed files with 1,106 additions and 215 deletions.
20 changes: 5 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended"
],
"plugins": [
"import",
"flowtype",
"mocha-no-only"
],
"extends": ["eslint:recommended", "plugin:flowtype/recommended"],
"plugins": ["prettier", "import", "flowtype", "mocha-no-only"],
"env": {
"browser": true,
"es6": true,
Expand All @@ -23,12 +16,9 @@
"__NAME__": true
},
"rules": {
"prettier/prettier": "error",
"mocha-no-only/mocha-no-only": "off",
"require-jsdoc": [
"error"
],
"valid-jsdoc": [
"error"
]
"require-jsdoc": ["error"],
"valid-jsdoc": ["error"]
}
}
3 changes: 1 addition & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[ignore]
.*/node_modules/conventional-changelog-core/test/fixtures/_malformation.json
.*/node_modules/playkit-js/src/
.*/node_modules
[include]
[libs]
node_modules/playkit-js/flow-typed/
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/dist
/src/index.html
CHANGELOG.md
yarn.lock
yarn-error.log
LICENSE
/samples
src/youbora.lib.min.js
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 150,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "preserve"
}
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# PlayKit JS Youbora - [Youbora analytics SDK] plugin for the [PlayKit JS Player]

[![Build Status](https://travis-ci.org/kaltura/playkit-js-youbora.svg?branch=master)](https://travis-ci.org/kaltura/playkit-js-youbora)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

PlayKit JS Youbora plugin integrates [Youbora analytics SDK] with the [PlayKit JS Player].

PlayKit JS Youbora is written in [ECMAScript6], statically analysed using [Flow] and transpiled in ECMAScript5 using [Babel].

[Youbora analytics SDK]: https://nicepeopleatwork.com/youbora/
[NPAW developer portal]: http://developer.nicepeopleatwork.com/
[Flow]: https://flow.org/
[ECMAScript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials
[Babel]: https://babeljs.io
[youbora analytics sdk]: https://nicepeopleatwork.com/youbora/
[npaw developer portal]: http://developer.nicepeopleatwork.com/
[flow]: https://flow.org/
[ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials
[babel]: https://babeljs.io

## Getting Started

### Prerequisites

The plugin requires [PlayKit JS Player] to be loaded first.

The plugin uses the [Youbora analytics SDK] for HTML5.

[Playkit JS Player]: https://github.com/kaltura/playkit-js
[playkit js player]: https://github.com/kaltura/playkit-js

### Installing

Expand Down Expand Up @@ -77,12 +79,14 @@ For full Youbora options see: http://developer.nicepeopleatwork.com/apidocs/js/$

Tests can be run locally via [Karma], which will run on Chrome, Firefox and Safari

[Karma]: https://karma-runner.github.io/1.0/index.html
[karma]: https://karma-runner.github.io/1.0/index.html

```
yarn run test
```

You can test individual browsers:

```
yarn run test:chrome
yarn run test:firefox
Expand All @@ -97,7 +101,6 @@ See [ESLint config](.eslintrc.json) for full configuration.

We also use [.editorconfig](.editorconfig) to maintain consistent coding styles and settings, please make sure you comply with the styling.


## Compatibility

TBD
Expand All @@ -108,7 +111,7 @@ Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c6

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/kaltura/playkit-js-youbora/tags).
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/kaltura/playkit-js-youbora/tags).

## License

Expand Down
4 changes: 4 additions & 0 deletions flow-typed/modules/playkit-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @flow
declare module 'playkit-js' {
declare module.exports: any;
}
33 changes: 9 additions & 24 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,26 @@ const customLaunchers = {
}
};

module.exports = function (config) {
module.exports = function(config) {
let karmaConf = {
logLevel: config.LOG_INFO,
browsers: [
'Chrome',
'Firefox'
],
browsers: ['Chrome', 'Firefox'],
concurrency: 1,
singleRun: true,
colors: true,
frameworks: [
'mocha'
],
frameworks: ['mocha'],
files: [
'test/setup/karma.js', {
'test/setup/karma.js',
{
pattern: 'src/assets/audios.mp4',
included: false
}
],
preprocessors: {
'src/**/*.js': [
'webpack',
'sourcemap'
],
'test/setup/karma.js': [
'webpack',
'sourcemap'
]
'src/**/*.js': ['webpack', 'sourcemap'],
'test/setup/karma.js': ['webpack', 'sourcemap']
},
reporters: [
'progress',
'coverage'
],
reporters: ['progress', 'coverage'],
webpack: webpackConfig,
webpackServer: {
noInfo: true
Expand All @@ -61,9 +48,7 @@ module.exports = function (config) {

if (process.env.TRAVIS) {
karmaConf.customLaunchers = customLaunchers;
karmaConf.browsers = [
'Chrome_travis_ci'
];
karmaConf.browsers = ['Chrome_travis_ci'];
} else {
if (isWindows) {
karmaConf.browsers.push('IE');
Expand Down
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playkit-js-youbora",
"version": "0.4.2",
"version": "0.4.3",
"main": "dist/playkit-youbora.js",
"scripts": {
"clean": "rm -rf ./dist",
Expand All @@ -13,7 +13,18 @@
"publish": "git push --follow-tags --no-verify origin master",
"eslint": "eslint . --color",
"flow": "flow check",
"commit:dist": "git add --force --all dist && (git commit -m 'chore: update dist' || exit 0)"
"commit:dist": "git add --force --all dist && (git commit -m 'chore: update dist' || exit 0)",
"precommit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"git add"
],
"*.{json,md,scss}": [
"prettier --write",
"git add"
]
},
"standard-version": {
"scripts": {
Expand All @@ -34,11 +45,14 @@
"cross-env": "^3.1.4",
"css-loader": "^0.28.4",
"eslint": "^3.10.0",
"eslint-config-prettier": "^2.9.0",
"eslint-loader": "^1.6.1",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-mocha-no-only": "^0.0.5",
"eslint-plugin-prettier": "^2.6.2",
"flow-bin": "latest",
"husky": "^0.14.3",
"istanbul": "^0.4.5",
"karma": "^1.5.0",
"karma-chai": "^0.1.0",
Expand All @@ -51,10 +65,11 @@
"karma-safari-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.2",
"lint-staged": "^7.2.0",
"mocha": "^3.2.0",
"mocha-cli": "^1.0.1",
"playkit-js": "https://github.com/kaltura/playkit-js.git#v0.31.2",
"pre-push": "^0.1.1",
"prettier": "^1.13.7",
"sinon": "^2.0.0",
"sinon-chai": "^2.8.0",
"standard-version": "^4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion samples/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as Playkit from 'playkit-js'
import * as Playkit from 'playkit-js';

window.Playkit = Playkit;
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import {registerPlugin} from 'playkit-js'
import Youbora from './youbora'
import {registerPlugin} from 'playkit-js';
import Youbora from './youbora';

declare var __VERSION__: string;
declare var __NAME__: string;
Expand All @@ -13,9 +13,8 @@ export {__VERSION__ as VERSION, __NAME__ as NAME};
* @type {string}
* @const
*/
const pluginName = "youbora";
const pluginName = 'youbora';
/**
* Register the plugin in player's registry.
*/
registerPlugin(pluginName, Youbora);

Loading

0 comments on commit ad63326

Please sign in to comment.