diff --git a/.editorconfig b/.editorconfig index b73dd195a..90aa6e045 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,6 +8,9 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +[*.md] +indent_size = unset + [*.{html,js,md}] block_comment_start = /** block_comment = * diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 000000000..df0c79855 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,8 @@ +{ + "line-length": { + "line_length": -1 + }, + "no-trailing-punctuation": { + "punctuation": ".,;:!。,;:!" + } +} diff --git a/.prettierignore b/.prettierignore index 404abb221..c883a29ae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ coverage/ +CHANGELOG.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09baa9aa9..42270324b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,10 +3,12 @@ Check out ways to contribute to Lion Web Components: ## Existing components: we love pull requests ♥ + Help out the whole lion community by sending your merge requests and issues. Check out how to set it up: Setup: + ```bash # Clone the repo: git clone https://github.com/ing-bank/lion.git @@ -20,6 +22,7 @@ git checkout -b fix/buttonSize ``` Make sure everything works as expected: + ```bash # Linting npm run lint @@ -32,7 +35,9 @@ npm run storybook ``` Create a Pull Request: -- At https://github.com/ing-bank/lion click on fork (at the right top) + +- At click on fork (at the right top) + ```bash # add fork to your remotes git remote add fork git@github.com:/lion.git @@ -40,9 +45,10 @@ git remote add fork git@github.com:/lion.git # push new branch to your fork git push -u fork fix/buttonSize ``` + - Go to your fork and create a Pull Request :) Some things that will increase the chance that your merge request is accepted: -* Write tests. -* Write a [good commit message](https://www.conventionalcommits.org/). +- Write tests. +- Write a [good commit message](https://www.conventionalcommits.org/). diff --git a/README.md b/README.md index 70c30c4e1..764335619 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Lion Web Components + > ## 🛠 Status: Pilot Phase > > Lion Web Components are still in an early alpha stage; they should not be considered production ready yet. @@ -8,9 +10,7 @@ > - not publicly promote or link us yet: (no tweets, blog posts or other forms of communication about Lion Web Components) > - not publicly promote or link products derived from/based on Lion Web Components > -> As soon as Pilot Phase ends we will let you know (feel free to subscribe to this issue https://github.com/ing-bank/lion/issues/1) - -# Lion Web Components +> As soon as Pilot Phase ends we will let you know (feel free to subscribe to this issue ) Lion web components is a set of highly performant, accessible and flexible Web Components. They provide an unopinionated, white label layer that can be extended to your own layer of components. diff --git a/package.json b/package.json index 3aabf448a..7e5f1c4ad 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "husky": "^1.0.0", "lerna": "3.4.3", "lint-staged": "^8.0.0", + "markdownlint-cli": "^0.17.0", "npm-run-all": "^4.1.5", "sinon": "^7.2.2", "webpack-merge": "^4.1.5", @@ -46,9 +47,10 @@ "lint:eclint": "git ls-files | xargs eclint check", "lint:eslint": "eslint --ext .js,.html .", "lint:prettier": "prettier \"**/*.js\" --list-different || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)", + "lint:markdownlint": "git ls-files '*.md' | xargs markdownlint --ignore '**/CHANGELOG.md'", "format": "npm run format:eslint && npm run format:prettier", "format:eslint": "eslint --ext .js,.html . --fix", - "format:prettier": "prettier \"**/*.js\" --write" + "format:prettier": "prettier \"**/*.{js,md}\" --write" }, "lint-staged": { "*": [ @@ -60,6 +62,11 @@ "prettier --write", "git add" ], + "*.md": [ + "prettier --write", + "markdownlint", + "git add" + ], "yarn.lock": [ "node ./scripts/yarn-lock-scan.js" ] diff --git a/packages/ajax/README.md b/packages/ajax/README.md index e347e7cd6..17d1ffd72 100644 --- a/packages/ajax/README.md +++ b/packages/ajax/README.md @@ -6,27 +6,30 @@ It is a promise based system for fetching data, based on [axios](https://github.com/axios/axios) ## Features + - only JS functions, no (unnecessarily expensive) web components - supports GET, POST, PUT, DELETE, REQUEST, PATCH and HEAD methods - can be used with or without XSRF token - ## How to use ### Installation + ```sh npm i --save @lion/ajax ``` ### Example + ```js import { ajax } from '@lion/ajax'; -ajax.get('data.json') - .then((response) => { +ajax + .get('data.json') + .then(response => { console.log(response); }) - .catch((error) => { + .catch(error => { console.log(error); }); ``` @@ -34,15 +37,17 @@ ajax.get('data.json') ### Create own instances for custom options #### Cancel + ```js import { AjaxClass } from '@lion/ajax'; const myAjax = AjaxClass.getNewInstance({ cancelable: true }); -myAjax.get('data.json') - .then((response) => { +myAjax + .get('data.json') + .then(response => { document.querySelector('#canceled').innerHTML = JSON.stringify(response.data); }) - .catch((error) => { + .catch(error => { document.querySelector('#canceled').innerHTML = `I got cancelled: ${error.message}`; }); setTimeout(() => { @@ -51,22 +56,25 @@ setTimeout(() => { ``` #### Cancel previous on new request + ```js -import { AjaxClass } from '@lion/ajax' +import { AjaxClass } from '@lion/ajax'; const myAjax = AjaxClass.getNewInstance({ cancelPreviousOnNewRequest: true }); -myAjax.get('data.json') - .then((response) => { +myAjax + .get('data.json') + .then(response => { document.querySelector('#request1').innerHTML = 'Request 1: ' + JSON.stringify(response.data); }) - .catch((error) => { + .catch(error => { document.querySelector('#request1').innerHTML = `Request 1: I got cancelled: ${error.message}`; }); -myAjax.get('data2.json') - .then((response) => { +myAjax + .get('data2.json') + .then(response => { document.querySelector('#request2').innerHTML = 'Request 2: ' + JSON.stringify(response.data); }) - .catch((error) => { + .catch(error => { document.querySelector('#request2').innerHTML = `Request 2: I got cancelled: ${error.message}`; }); ``` diff --git a/packages/button/README.md b/packages/button/README.md index ca693cc02..a19ca1bf9 100644 --- a/packages/button/README.md +++ b/packages/button/README.md @@ -7,12 +7,14 @@ ## Features ### Disabled + You can also set a button as disabled with the `disabled` property. ## How to use ### Installation -``` + +```sh npm i --save @lion/button ``` diff --git a/packages/checkbox-group/README.md b/packages/checkbox-group/README.md index a84ebb0c7..928b1e068 100644 --- a/packages/checkbox-group/README.md +++ b/packages/checkbox-group/README.md @@ -7,12 +7,14 @@ You should use [lion-checkbox](../checkbox/)'s inside this element. ## Features + Since it extends from [lion-fieldset](../fieldset/), it has all the features a fieldset has. ## How to use ### Installation -``` + +```sh npm i --save @lion/checkbox @lion/checkbox-group ``` diff --git a/packages/checkbox/README.md b/packages/checkbox/README.md index ab306e11a..afce4ff6e 100644 --- a/packages/checkbox/README.md +++ b/packages/checkbox/README.md @@ -5,6 +5,7 @@ `lion-checkbox` component is a sub-element to be used in [lion-checkbox-group](../checkbox-group/) elements. Its purpose is to provide a way for users to check **multiple** options amongst a set of choices, or to function as a single toggle. ## Features + - Get or set the checked state (boolean) - `choiceChecked()` - Get or set the value of the choice - `choiceValue()` - Pre-select an option by setting the `checked` boolean attribute @@ -12,8 +13,9 @@ ## How to use ### Installation -``` -npm i --save @lion/checkbox; + +```sh +npm i --save @lion/checkbox ``` ```js diff --git a/packages/core/README.md b/packages/core/README.md index 9e85d366a..d5b606fd7 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -28,7 +28,7 @@ The more generic the mixin is, the higher the chance of being appliend more than This is an example of how to make a conventional ES mixin deduping. -```javascript +```js const BaseMixin = dedupeMixin((superClass) => { return class extends superClass { ... }; }); diff --git a/packages/field/README.md b/packages/field/README.md index eff4c3399..7e31b2641 100644 --- a/packages/field/README.md +++ b/packages/field/README.md @@ -1,4 +1,3 @@ - # Form Fundaments [//]: # 'AUTO INSERT HEADER PREPUBLISH' @@ -34,7 +33,7 @@ On top of this, they feature: Whenever a native form control doesn't exist or is not sufficient, a [custom form field](./docs/CustomFieldsTutorial.md) should be created. One could think of components - like: +like: - slider - combobox @@ -56,9 +55,11 @@ Fieldsets are the basis for: + - [Model Value](./docs/ModelValue.md) - [Formatting and parsing](./docs/FormattingAndParsing.md) - [Interaction states](./docs/InteractionStates.md) - [Validation System](../validate/docs/ValidationSystem.md) - [Custom Fields](./docs/CustomFieldsTutorial.md) + diff --git a/packages/field/docs/CustomFieldsTutorial.md b/packages/field/docs/CustomFieldsTutorial.md index c7172d1e2..6591ab799 100644 --- a/packages/field/docs/CustomFieldsTutorial.md +++ b/packages/field/docs/CustomFieldsTutorial.md @@ -1,9 +1,11 @@ # Creating a custom field + Custom fields can be created in just a few steps. All you need is an interaction element (like for instance a slider, a listbox or a combobox) and connect it to the [Field](../README.md) functionality. ## Prerequisite: an interaction element + An interaction element provides the means for the end user to enter a certain value, just like native elements provide in this (think of ``, `