From aacd5a8fd4745070972ef3901d4ef06030380264 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 13:09:39 +0200 Subject: [PATCH 01/57] chore: Add .editorconfig --- .editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 0000000..972bde9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_size = 2 +indent_style = space +trim_trailing_whitespace = true From 85c584275a446a820521a1b4ea4fd7ff96cb0bf6 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 13:12:49 +0200 Subject: [PATCH 02/57] chore: Add package.json --- package.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..540eec7 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "@serverless/eslint-config", + "version": "1.0.0", + "description": "ESLint & Prettier config for Serveless projects", + "keywords": [ + "lint", + "eslint", + "prettier" + ], + "author": "serverless.com", + "repository": "serverless/eslint-config", + "license": "ISC" +} From 2d742c05bc36d5637a0f56b4979472dd8124c857 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:46:39 +0200 Subject: [PATCH 03/57] feat: Initial base ESLint config --- index.js | 8 ++++++++ node.js | 9 +++++++++ package.json | 10 ++++++++++ 3 files changed, 27 insertions(+) create mode 100644 index.js create mode 100644 node.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..270f41d --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = { + extends: "eslint:recommended", + env: { + es6: true + } +}; diff --git a/node.js b/node.js new file mode 100644 index 0000000..14a2c11 --- /dev/null +++ b/node.js @@ -0,0 +1,9 @@ +"use strict"; + +const { join } = require("path"); + +module.exports = { + // The only way to ensure that ESLint resolves expected config from any location + extends: join(__dirname, "index.js"), + env: { node: true } +}; diff --git a/package.json b/package.json index 540eec7..261b8b2 100644 --- a/package.json +++ b/package.json @@ -9,5 +9,15 @@ ], "author": "serverless.com", "repository": "serverless/eslint-config", + "eslintConfig": { + "extends": "./node.js", + "root": true + }, + "devDependencies": { + "eslint": "^5.16.0" + }, + "peerDependencies": { + "eslint": ">=5" + }, "license": "ISC" } From c36dc58d2c0b3815a9a14ffd80ee87ee8a3c3a61 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:52:00 +0200 Subject: [PATCH 04/57] chore: Configure 'lint' script --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 261b8b2..aaecf11 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,8 @@ "peerDependencies": { "eslint": ">=5" }, + "scripts": { + "lint": "eslint . --cache" + }, "license": "ISC" } From 7e053d4d722957f1a967f3e445b410794ac79dad Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:52:24 +0200 Subject: [PATCH 05/57] chore: Ensure to ignore .eslintcache --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3322b03..365c674 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/.eslintcache /node_modules npm-debug.log /package-lock.json From c3c72004180f1135bc763a7124ea71f0730c648d Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:53:41 +0200 Subject: [PATCH 06/57] chore: Configure Prettier --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index aaecf11..f8a6617 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,15 @@ "root": true }, "devDependencies": { - "eslint": "^5.16.0" + "eslint": "^5.16.0", + "prettier": "^1.18.0" }, "peerDependencies": { "eslint": ">=5" }, "scripts": { - "lint": "eslint . --cache" + "lint": "eslint . --cache", + "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" }, "license": "ISC" } From d48987ffa7ac6278fd3e42d2931fcaf2cfe06f14 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:54:18 +0200 Subject: [PATCH 07/57] feat: Configure base ECMAScript version --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 270f41d..bb84fad 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ module.exports = { extends: "eslint:recommended", - env: { - es6: true - } + env: { es6: true }, + parserOptions: { ecmaVersion: 2015 } }; From 42bd75bb7656b5d5a3ea515a4dbe03bc8611f98c Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 14:56:31 +0200 Subject: [PATCH 08/57] chore: Configure lint & prettier updated scripts --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index f8a6617..f17f96d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "devDependencies": { "eslint": "^5.16.0", + "git-list-updated": "^1.1.2", "prettier": "^1.18.0" }, "peerDependencies": { @@ -22,6 +23,8 @@ }, "scripts": { "lint": "eslint . --cache", + "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", + "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" }, "license": "ISC" From c4ebb3887149b8e7c55ceb86d6093b5602c3021d Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 7 Jun 2019 15:05:28 +0200 Subject: [PATCH 09/57] feat: Turn off rules that collide with Prettier --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index bb84fad..6b53843 100644 --- a/index.js +++ b/index.js @@ -3,5 +3,10 @@ module.exports = { extends: "eslint:recommended", env: { es6: true }, - parserOptions: { ecmaVersion: 2015 } + parserOptions: { ecmaVersion: 2015 }, + rules: { + "no-extra-semi": "off", // Handled by Prettier + "no-mixed-spaces-and-tabs": "off", // Handled by Prettier + "no-unexpected-multiline": "off" // Handled by Prettier + } }; From be5561bd70f1849aa768313bcad65e82c30dc871 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 10 Jun 2019 16:25:11 +0200 Subject: [PATCH 10/57] feat: Reflect ESLint configuration of `serverless` package - Prepare dedicated 'browser' and 'node' entry points - Ensure no environment unrelated rules are applied - Skip options that conflict with Prettier --- browser.js | 12 ++++++ index.js | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++--- node.js | 11 ++++-- 3 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 browser.js diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e2cc8bb --- /dev/null +++ b/browser.js @@ -0,0 +1,12 @@ +'use strict'; + +const { join } = require('path'); + +module.exports = { + // The only way to ensure that ESLint resolves expected config from any location + extends: join(__dirname, 'index.js'), + env: { browser: true }, + rules: { + 'no-alert': 'error', + }, +}; diff --git a/index.js b/index.js index 6b53843..81a0e42 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,114 @@ -"use strict"; +'use strict'; module.exports = { - extends: "eslint:recommended", + extends: 'eslint:recommended', env: { es6: true }, parserOptions: { ecmaVersion: 2015 }, + plugins: ['import'], rules: { - "no-extra-semi": "off", // Handled by Prettier - "no-mixed-spaces-and-tabs": "off", // Handled by Prettier - "no-unexpected-multiline": "off" // Handled by Prettier - } + 'array-callback-return': 'error', + 'block-scoped-var': 'error', + camelcase: ['error', { properties: 'never' }], + 'comma-dangle': ['error', 'always-multiline'], + 'consistent-return': 'error', + + curly: ['error', 'multi-line'], + 'default-case': ['error', { commentPattern: '^no default$' }], + 'dot-notation': ['error', { allowKeywords: true }], + eqeqeq: ['error', 'allow-null'], + 'guard-for-in': 'error', + + 'import/export': 'error', + 'import/imports-first': ['error', 'absolute-first'], + 'import/newline-after-import': 'error', + 'import/no-amd': 'error', + 'import/no-duplicates': 'error', + 'import/no-extraneous-dependencies': [ + 'error', + { devDependencies: ['**/*.test.js', '**/scripts/**', '**/tests/**'] }, + ], + 'import/no-mutable-exports': 'error', + 'import/no-named-as-default': 'error', + 'import/no-named-as-default-member': 'error', + 'import/no-unresolved': ['error', { commonjs: true }], + 'import/prefer-default-export': 'error', + + 'max-len': ['error', 100, 2, { ignoreUrls: true }], + 'new-cap': ['error', { newIsCap: true }], + 'no-array-constructor': 'error', + 'no-caller': 'error', + 'no-confusing-arrow': ['error', { allowParens: true }], + 'no-console': 'error', + 'no-duplicate-imports': 'error', + 'no-else-return': 'error', + 'no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }], + 'no-eval': 'error', + 'no-extra-bind': 'error', + 'no-extra-label': 'error', + 'no-extra-semi': 'off', // Handled by Prettier + 'no-implied-eval': 'error', + 'no-iterator': 'error', + 'no-label-var': 'error', + 'no-labels': ['error', { allowLoop: false, allowSwitch: false }], + 'no-lone-blocks': 'error', + 'no-lonely-if': 'error', + 'no-loop-func': 'error', + 'no-mixed-spaces-and-tabs': 'off', // Handled by Prettier + 'no-multi-str': 'error', + 'no-nested-ternary': 'error', + 'no-new': 'error', + 'no-new-func': 'error', + 'no-new-object': 'error', + 'no-new-require': 'error', + 'no-new-wrappers': 'error', + 'no-octal-escape': 'error', + 'no-param-reassign': ['error', { props: true }], + 'no-proto': 'error', + 'no-restricted-syntax': [ + 'error', + 'DebuggerStatement', + 'ForInStatement', + 'LabeledStatement', + 'WithStatement', + ], + 'no-return-assign': 'error', + 'no-script-url': 'error', + 'no-self-compare': 'error', + 'no-sequences': 'error', + 'no-shadow': 'error', + 'no-throw-literal': 'error', + 'no-undef-init': 'error', + 'no-underscore-dangle': ['error', { allowAfterThis: false }], + 'no-unexpected-multiline': 'off', // Handled by Prettier + 'no-unneeded-ternary': ['error', { defaultAssignment: false }], + 'no-unused-expressions': ['error', { allowShortCircuit: false, allowTernary: false }], + 'no-unused-vars': ['error', { vars: 'local', args: 'after-used' }], + 'no-useless-computed-key': 'error', + 'no-useless-concat': 'error', + 'no-useless-constructor': 'error', + 'no-useless-rename': [ + 'error', + { ignoreDestructuring: false, ignoreImport: false, ignoreExport: false }, + ], + 'no-var': 'error', + 'no-void': 'error', + 'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }], + 'one-var': ['error', 'never'], + 'operator-assignment': ['error', 'always'], + quotes: ['error', 'single', { avoidEscape: true }], + 'prefer-arrow-callback': ['error', { allowNamedFunctions: false, allowUnboundThis: true }], + 'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }], + 'prefer-rest-params': 'error', + 'prefer-spread': 'error', + 'prefer-template': 'error', + radix: 'error', + 'vars-on-top': 'error', + 'spaced-comment': ['error', 'always', { exceptions: ['-', '+'], markers: ['=', '!'] }], + strict: ['error', 'safe'], + yoda: 'error', + }, + overrides: [ + { files: ['**/*.test.js', '**/tests/**'], env: { mocha: true, jest: true } }, + { files: ['jest.setupEnvironment.js'], env: { jest: true } }, + ], }; diff --git a/node.js b/node.js index 14a2c11..dc19411 100644 --- a/node.js +++ b/node.js @@ -1,9 +1,12 @@ -"use strict"; +'use strict'; -const { join } = require("path"); +const { join } = require('path'); module.exports = { // The only way to ensure that ESLint resolves expected config from any location - extends: join(__dirname, "index.js"), - env: { node: true } + extends: join(__dirname, 'index.js'), + env: { node: true }, + rules: { + 'no-path-concat': 'error', + }, }; From 8e9e5b9d44a4a150e77fc4b8d9a852e8904b2e2d Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 10 Jun 2019 16:26:38 +0200 Subject: [PATCH 11/57] chore: Update prettier --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f17f96d..dff427c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "devDependencies": { "eslint": "^5.16.0", "git-list-updated": "^1.1.2", - "prettier": "^1.18.0" + "prettier": "^1.18.2" }, "peerDependencies": { "eslint": ">=5" From df38b232302119b85bd7b4ca5cc318e1fcdadc8b Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 10 Jun 2019 16:26:45 +0200 Subject: [PATCH 12/57] chore: Ensure needed plugin --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index dff427c..7fca1f5 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "devDependencies": { "eslint": "^5.16.0", + "eslint-plugin-import": "^2.17.3", "git-list-updated": "^1.1.2", "prettier": "^1.18.2" }, From d71e4f3697f489603f6cee2bb6504f95af95d397 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 12:17:29 +0200 Subject: [PATCH 13/57] chore: Ensure LICENSE file --- LICENSE | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..087bcbb --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2019 Serverless, Inc. http://www.serverless.com + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. From 49c6df580e4607911a4fff6e5573dc6c6dda3406 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 12:45:33 +0200 Subject: [PATCH 14/57] chore: Configure commitlint --- commitlint.config.js | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 commitlint.config.js diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..740816b --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = { + rules: { + 'body-leading-blank': [2, 'always'], + 'body-max-line-length': [2, 'always', 72], + 'footer-leading-blank': [2, 'always'], + 'footer-max-line-length': [2, 'always', 72], + 'header-max-length': [2, 'always', 72], + 'scope-case': [2, 'always', 'start-case'], + 'subject-case': [2, 'always', 'sentence-case'], + 'subject-empty': [2, 'never'], + 'subject-full-stop': [2, 'never', '.'], + 'type-case': [2, 'always', 'lower-case'], + 'type-empty': [2, 'never'], + 'type-enum': [ + 2, + 'always', + ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'style', 'test'], + ], + }, +}; diff --git a/package.json b/package.json index 7fca1f5..8ac6520 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "root": true }, "devDependencies": { + "@commitlint/cli": "^8.0.0", "eslint": "^5.16.0", "eslint-plugin-import": "^2.17.3", "git-list-updated": "^1.1.2", From 48ea1574e5d7e1c37fb993fe5c59d9c22f73ed80 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 12:54:52 +0200 Subject: [PATCH 15/57] chore: Configure commitlint command --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 8ac6520..0ce3f7d 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "scripts": { "lint": "eslint . --cache", + "commitlint": "commitlint -f HEAD@{15}", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" From 4f98d171724e35964500687d1f5a027108027d99 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 12:56:53 +0200 Subject: [PATCH 16/57] ci: Configure Travis --- .travis.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c162111 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: node_js + +git: + depth: 1 # No need for commits history + +branches: + only: master # Do not build PR branches + +stages: + - name: Test + +jobs: + include: + # To speed up Travis build, use one job per Platform + Node.js version combination + - name: "Lint, Commitlint - Node.js v12" + node_js: 12 + script: npm run lint-updated && npm run commitlint From 3df1e19dfe580a395416cf40073e8c90ffce35ea Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 14:19:19 +0200 Subject: [PATCH 17/57] docs: Initial documentation --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/README.md b/README.md index 1426b76..7b02093 100755 --- a/README.md +++ b/README.md @@ -1 +1,68 @@ # @serverless/eslint-config + +## Common ESLint, Prettier and Commitlint (experimental) configuration, for Serverless projects + +### How to setup linters in a project + +1. Install needed dependencies: + +```bash +npm i --save-dev eslint eslint-plugin-import prettier git-list-updated +``` + + +2. Configure ESLint + + +Add `eslintConfig` to package.json: + + +_For Node.js projects:_ +```json +{ + "eslintConfig": { + "extends": "@serverless/eslint-config/node", + "root": true + }, +} +``` + +_For Browser projects:_ +```json +{ + "eslintConfig": { + "extends": "@serverless/eslint-config/browser", + "root": true + }, +} +``` + +3. Configure npm scripts + +Configure following scripts in package.json: + +```json +{ + "scripts": { + "lint": "eslint . --cache", + "commitlint": "commitlint -f HEAD@{15}", + "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", + "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", + "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" + } +} +``` + +4. Ensure to validate changes in CI + +Run following validation in CI setup: + +```bash +npm run lint-updated && npm run prettier-check-updated +``` + +#### Commitlint (experimental) + +This project is also covered by [commitlint](https://commitlint.js.org/) which ensure readable and programmaticaly consumable git commit messages. + +See proposed [Commit Message Guide](https://docs.google.com/document/d/1hKUs3qt_aVp_PBI1UqvfaIqKma3jAJimEoGCRGGbOqs/edit#) From 52f60e785cca13de6fa0ba0c30bfcde3b53bfc34 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 14:44:09 +0200 Subject: [PATCH 18/57] ci: Configure dedicated CI pull request commitlint script --- .travis.yml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c162111..8d0bffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ jobs: # To speed up Travis build, use one job per Platform + Node.js version combination - name: "Lint, Commitlint - Node.js v12" node_js: 12 - script: npm run lint-updated && npm run commitlint + script: npm run lint-updated && npm run commitlint-ci-pull-request diff --git a/package.json b/package.json index 0ce3f7d..e513af3 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "scripts": { "lint": "eslint . --cache", "commitlint": "commitlint -f HEAD@{15}", + "commitlint-ci-pull-request": "commitlint -f HEAD~1", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" From 4df72d9cfdb8d78d93290fff63240ab29fa21f52 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 14:58:50 +0200 Subject: [PATCH 19/57] ci: Ensure to confirm changes with Prettier --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8d0bffb..8e7b443 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ jobs: # To speed up Travis build, use one job per Platform + Node.js version combination - name: "Lint, Commitlint - Node.js v12" node_js: 12 - script: npm run lint-updated && npm run commitlint-ci-pull-request + script: npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request From 74f6612d9adf77120ac637f530027ebb902d9f02 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 15:18:43 +0200 Subject: [PATCH 20/57] feat: Prettier configuration --- prettier.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 prettier.config.js diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..ad49949 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = { + endOfLine: 'lf', + printWidth: 100, + quoteProps: 'consistent', + singleQuote: true, + trailingComma: 'es5', +}; From 50ebc2d3d4496b83d0b971a9d93f44c70159d239 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 15:18:52 +0200 Subject: [PATCH 21/57] chore: Prettify --- .travis.yml | 2 +- README.md | 17 ++++++++--------- index.js | 14 +++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e7b443..50c33af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,6 @@ stages: jobs: include: # To speed up Travis build, use one job per Platform + Node.js version combination - - name: "Lint, Commitlint - Node.js v12" + - name: 'Lint, Commitlint - Node.js v12' node_js: 12 script: npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request diff --git a/README.md b/README.md index 7b02093..6f4010e 100755 --- a/README.md +++ b/README.md @@ -10,30 +10,29 @@ npm i --save-dev eslint eslint-plugin-import prettier git-list-updated ``` - 2. Configure ESLint - Add `eslintConfig` to package.json: - _For Node.js projects:_ + ```json { - "eslintConfig": { + "eslintConfig": { "extends": "@serverless/eslint-config/node", "root": true - }, + } } ``` _For Browser projects:_ + ```json { - "eslintConfig": { - "extends": "@serverless/eslint-config/browser", - "root": true - }, + "eslintConfig": { + "extends": "@serverless/eslint-config/browser", + "root": true + } } ``` diff --git a/index.js b/index.js index 81a0e42..33bcbf4 100644 --- a/index.js +++ b/index.js @@ -8,14 +8,14 @@ module.exports = { rules: { 'array-callback-return': 'error', 'block-scoped-var': 'error', - camelcase: ['error', { properties: 'never' }], + 'camelcase': ['error', { properties: 'never' }], 'comma-dangle': ['error', 'always-multiline'], 'consistent-return': 'error', - curly: ['error', 'multi-line'], + 'curly': ['error', 'multi-line'], 'default-case': ['error', { commentPattern: '^no default$' }], 'dot-notation': ['error', { allowKeywords: true }], - eqeqeq: ['error', 'allow-null'], + 'eqeqeq': ['error', 'allow-null'], 'guard-for-in': 'error', 'import/export': 'error', @@ -95,17 +95,17 @@ module.exports = { 'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }], 'one-var': ['error', 'never'], 'operator-assignment': ['error', 'always'], - quotes: ['error', 'single', { avoidEscape: true }], + 'quotes': ['error', 'single', { avoidEscape: true }], 'prefer-arrow-callback': ['error', { allowNamedFunctions: false, allowUnboundThis: true }], 'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }], 'prefer-rest-params': 'error', 'prefer-spread': 'error', 'prefer-template': 'error', - radix: 'error', + 'radix': 'error', 'vars-on-top': 'error', 'spaced-comment': ['error', 'always', { exceptions: ['-', '+'], markers: ['=', '!'] }], - strict: ['error', 'safe'], - yoda: 'error', + 'strict': ['error', 'safe'], + 'yoda': 'error', }, overrides: [ { files: ['**/*.test.js', '**/tests/**'], env: { mocha: true, jest: true } }, From a82d96eb4e7e8dbe9cbdd4dba4dbde98a3009017 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Tue, 11 Jun 2019 15:19:34 +0200 Subject: [PATCH 22/57] docs: Document Prettier configuration --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6f4010e..052095e 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ npm i --save-dev eslint eslint-plugin-import prettier git-list-updated ``` -2. Configure ESLint +1. Configure ESLint Add `eslintConfig` to package.json: @@ -36,7 +36,17 @@ _For Browser projects:_ } ``` -3. Configure npm scripts +1. Configure Prettier + +Add `.prettier.config.js` file with following content: + +```javascript +'use strict'; + +module.exports = require('@serverless/eslint-config/prettier.config'); +``` + +1. Configure npm scripts Configure following scripts in package.json: @@ -52,7 +62,7 @@ Configure following scripts in package.json: } ``` -4. Ensure to validate changes in CI +1. Ensure to validate changes in CI Run following validation in CI setup: From f929cd6f10e5642cb4a427b363ceaa46dd7eb385 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 09:39:28 +0200 Subject: [PATCH 23/57] docs: Improvements --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 052095e..badfbbc 100755 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ Configure following scripts in package.json: { "scripts": { "lint": "eslint . --cache", - "commitlint": "commitlint -f HEAD@{15}", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" @@ -64,7 +63,9 @@ Configure following scripts in package.json: 1. Ensure to validate changes in CI -Run following validation in CI setup: +Run following validation of PR's in CI build. + +Note: following should be run only for PR's (as `*-updated`) scripts may fail on _branch_ or _tag_ builds due to lack of existing reference to `master`) ```bash npm run lint-updated && npm run prettier-check-updated From 29235eb9f12a48afc3487b6db3c9ccd1b7ee6092 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 09:41:22 +0200 Subject: [PATCH 24/57] feat: Turn off 'no-param-reassign' rule --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 33bcbf4..45d938e 100644 --- a/index.js +++ b/index.js @@ -62,7 +62,6 @@ module.exports = { 'no-new-require': 'error', 'no-new-wrappers': 'error', 'no-octal-escape': 'error', - 'no-param-reassign': ['error', { props: true }], 'no-proto': 'error', 'no-restricted-syntax': [ 'error', From 388cee90ce0b92a25a5c821e77f52226e63cb83b Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 09:45:14 +0200 Subject: [PATCH 25/57] chore: Configure 'prettier-check' script --- README.md | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index badfbbc..ef5944c 100755 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Configure following scripts in package.json: "scripts": { "lint": "eslint . --cache", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", + "prettier-check": "prettier -c --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" } diff --git a/package.json b/package.json index e513af3..5af4d6d 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "commitlint": "commitlint -f HEAD@{15}", "commitlint-ci-pull-request": "commitlint -f HEAD~1", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", + "prettier-check": "prettier -c --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" }, From 7b9dd65c89dbad25c4877a9975e5848ed422d0dc Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 10:21:51 +0200 Subject: [PATCH 26/57] chore: Ensure scripts work on Windows --- README.md | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef5944c..9082212 100755 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ Configure following scripts in package.json: "scripts": { "lint": "eslint . --cache", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", - "prettier-check": "prettier -c --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", + "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", - "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" + "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"" } } ``` diff --git a/package.json b/package.json index 5af4d6d..ea05dde 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "commitlint": "commitlint -f HEAD@{15}", "commitlint-ci-pull-request": "commitlint -f HEAD~1", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", - "prettier-check": "prettier -c --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'", + "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", - "prettify": "prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'" + "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"" }, "license": "ISC" } From 6f39cec2e61e0aeac0e76290aff0f6a8eca9889b Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 10:49:03 +0200 Subject: [PATCH 27/57] ci: Run updated scripts only in PR's --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 50c33af..a78a3e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,11 @@ stages: jobs: include: # To speed up Travis build, use one job per Platform + Node.js version combination - - name: 'Lint, Commitlint - Node.js v12' + - name: 'Prettier check updated, Lint updated, Commitlint - Node.js v12' + if: type = pull_request node_js: 12 script: npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request + - name: 'Lint - Node.js v12' + if: type = push + node_js: 12 + script: npm run lint From 0c970d976b4c6356a6be0bb8f9f89ec6c84dc4b1 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 11:46:39 +0200 Subject: [PATCH 28/57] ci: Fine tune validation tasks --- .travis.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a78a3e8..d323cf7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,23 @@ stages: jobs: include: # To speed up Travis build, use one job per Platform + Node.js version combination + + # PR's from branches + # Ensure commit messages follow CC - name: 'Prettier check updated, Lint updated, Commitlint - Node.js v12' - if: type = pull_request + if: type = pull_request AND fork = false node_js: 12 script: npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request + + # PR's from forks + # Do not validate commit messages, + # (if user didn't ensure CC, PR should be squash merged with valid CC commit message) + - name: 'Prettier check updated, Lint updated - Node.js v12' + if: type = pull_request AND fork = true + node_js: 12 + script: npm run prettier-check-updated && npm run lint-updated + + # master branch and version tags - name: 'Lint - Node.js v12' if: type = push node_js: 12 From f4e0ac9fc18f5c19c018b628a850450e7f1864fe Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 11:57:33 +0200 Subject: [PATCH 29/57] ci: Ensure to build release tags --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d323cf7..7a934ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,9 @@ git: depth: 1 # No need for commits history branches: - only: master # Do not build PR branches + only: + - master # Do not build PR branches + - /^v\d+\.\d+\.\d+$/ # Ensure to build release tags stages: - name: Test From dcb16e19a6ff04add324999a70690a65dbed9149 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 17:37:17 +0200 Subject: [PATCH 30/57] ci: Improve comments --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7a934ed..feaf51a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ stages: jobs: include: - # To speed up Travis build, use one job per Platform + Node.js version combination + # In most cases it's best to configure one job per Platform & Node.js version combination + # (job setup takes ca 1 minute, one task ca few seconds) # PR's from branches # Ensure commit messages follow CC From abeaaeefc40fa9507b804a3977678253095b9d27 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 19 Jun 2019 17:59:27 +0200 Subject: [PATCH 31/57] chore: Configure 'prepare-release' script --- package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ea05dde..fd6ec54 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,19 @@ "extends": "./node.js", "root": true }, + "standard-version": { + "skip": { + "commit": true, + "tag": true + } + }, "devDependencies": { "@commitlint/cli": "^8.0.0", "eslint": "^5.16.0", "eslint-plugin-import": "^2.17.3", "git-list-updated": "^1.1.2", - "prettier": "^1.18.2" + "prettier": "^1.18.2", + "standard-version": "^6.0.1" }, "peerDependencies": { "eslint": ">=5" @@ -28,6 +35,7 @@ "commitlint": "commitlint -f HEAD@{15}", "commitlint-ci-pull-request": "commitlint -f HEAD~1", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", + "prepare-release": "standard-version", "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"" From 47c1c2ca5b7efd9dce7a5e045a5849f0a8560d4a Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 10:08:48 +0200 Subject: [PATCH 32/57] ci: Improve repository setup --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index feaf51a..676ec62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,11 @@ language: node_js git: - depth: 1 # No need for commits history + # Do not take whole history, but ensure to not break things: + # - Merging multiple PR's around same time may introduce scenario that it's not last merge commit + # that is to be tested, and we need to have access to it + # - At least 2 last commits need to be provided to properly detect a version switch + depth: 10 branches: only: From ae71bf193d3e2d34ed2f2910a847a048b7e2d15b Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 12:40:05 +0200 Subject: [PATCH 33/57] ci: Automate release process --- .travis.yml | 47 ++++++++++++++++++++++++++++++++++++++--------- package.json | 1 + 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 676ec62..f273ab0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ language: node_js git: # Do not take whole history, but ensure to not break things: - # - Merging multiple PR's around same time may introduce scenario that it's not last merge commit - # that is to be tested, and we need to have access to it - # - At least 2 last commits need to be provided to properly detect a version switch + # - Merging multiple PR's around same time may introduce a case where it's not + # the last merge commit that is to be tested + # - Aside of merge commit we need a previous commit to be able to detect a version switch depth: 10 branches: @@ -14,6 +14,8 @@ branches: stages: - name: Test + - name: Deploy + if: tag =~ ^v\d+\.\d+\.\d+$ jobs: include: @@ -22,10 +24,17 @@ jobs: # PR's from branches # Ensure commit messages follow CC - - name: 'Prettier check updated, Lint updated, Commitlint - Node.js v12' + - name: 'Prettier check updated, Lint updated, Commitlint, Changelog confirm (on release) - Node.js v12' if: type = pull_request AND fork = false node_js: 12 - script: npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request + script: + - | + npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request && + tagName=`git diff master package.json | grep '"version": "' | grep -oE "\d+\.\d+\.\d+"` + if [ $? -eq 0 ]; then + # If release PR, confirm we have a changelog + npx dump-release-from-cc-changelog $tagName + fi # PR's from forks # Do not validate commit messages, @@ -35,8 +44,28 @@ jobs: node_js: 12 script: npm run prettier-check-updated && npm run lint-updated - # master branch and version tags - - name: 'Lint - Node.js v12' - if: type = push + # master branch + - name: 'Lint, Tag on version bump - Node.js v12' + env: #TODO: Expose Github token at GITHUB_TOKEN + if: branch = master AND type = push node_js: 12 - script: npm run lint + script: + - | + npm run lint && + # If package version was changed with last merged PR, push tag + tagName=`git diff HEAD^ package.json | grep '"version": "' | grep -oE "\d+\.\d+\.\d+"` + if [ $? -eq 0 ]; then + git tag v$tagName && git push -q https://$GITHUB_TOKEN@github.com/serverless/eslint-config --tags + fi + + # version tag + - stage: Deploy + env: #TODO: Expose Github token at GITHUB_TOKEN + node_js: 12 + script: skip + deploy: + provider: npm + email: services@serverless.com + api_key: + secure: EgoetjrRlGfvGnmVp8A0btr1CzB0hl7owVIpbfk4zXJzhGEbHoVu0CG0IdmyLN+JlaZa7EDJTjkDCd6g3fVAh9TT7ZCeaq8YwbZDrql7mAJj7xYQAyM4eSkc95BRzcFJBx7Mxr6H90IDLxKr6ZtB+HEdiHN+59XbepKYYJeb1jHfnKn5xzOqk4BdnZo6pKfudfeO+7/BwJJ0FwlFA40bY2HS/Lp+NG/2IedNR7k3m/5W83/XH5qlWP8jhBKlxrAzks27aNo+42xHkRCVyPViJKq0mfz1hl2bfswChWHgaCuajp+0amNL39pgIX9eXxFc3bNX9Iftox5t31elEhsw06vvuAaVkKEd+VEMaDySbQ9M+irKZeREg+NFYZLnc2WiEE3Sexo6hm9eM2q2KEZ7bleN9B0CQAut1XXLRQEts80rzss4Z2Q7AZb9cOYBQlj9Wf1X0Y74UqvnDn83a4Y38a+lhx7J2q691ZeM1UFSCdO0QfeJRkB55bSyHqUqrLAqUN7eNsKGdBH0kvYIGFREgGgReEpBRAuNqWuJ/5qexp63Kbf+09raG5IvfxSIM5fJ5KE5VxSduBdRnSH0GNKfjuq296/Rg4fmm/bygZ3Yk5L6Wd41SUU8uHzlZFBwtcvxAKDTQe6s+5JU24ilqxOx6J4Ut34X3dIbLLAmoB1ogdM= + after_deploy: npx github-release-from-cc-changelog $TRAVIS_TAG diff --git a/package.json b/package.json index fd6ec54..d27afb9 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "eslint": "^5.16.0", "eslint-plugin-import": "^2.17.3", "git-list-updated": "^1.1.2", + "github-release-from-cc-changelog": "^2.2.0", "prettier": "^1.18.2", "standard-version": "^6.0.1" }, From 09b5bf71711d0a3ef76915bf5d7ec9f8958611d7 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 13:22:22 +0200 Subject: [PATCH 34/57] ci: Improve comments --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f273ab0..ec468b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,10 +20,10 @@ stages: jobs: include: # In most cases it's best to configure one job per Platform & Node.js version combination - # (job setup takes ca 1 minute, one task ca few seconds) + # (job boot & setup takes ca 1 minute, one task run lasts ca few seconds) # PR's from branches - # Ensure commit messages follow CC + # Ensure commit messages follow CC, and confirm on changelog in case of release PR's - name: 'Prettier check updated, Lint updated, Commitlint, Changelog confirm (on release) - Node.js v12' if: type = pull_request AND fork = false node_js: 12 From 0a1aab728ae8157dbeb7f0add4c18ae6519d01e2 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 13:22:30 +0200 Subject: [PATCH 35/57] docs: Document release process --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9082212..3ad210f 100755 --- a/README.md +++ b/README.md @@ -72,8 +72,20 @@ Note: following should be run only for PR's (as `*-updated`) scripts may fail on npm run lint-updated && npm run prettier-check-updated ``` -#### Commitlint (experimental) +### Commitlint and automation of release process (experimental) -This project is also covered by [commitlint](https://commitlint.js.org/) which ensure readable and programmaticaly consumable git commit messages. +Commit messages in context of this project should follow [Convention Commits Convention](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary) -See proposed [Commit Message Guide](https://docs.google.com/document/d/1hKUs3qt_aVp_PBI1UqvfaIqKma3jAJimEoGCRGGbOqs/edit#) +See proposed [Commit Message Guidelines](https://docs.google.com/document/d/1hKUs3qt_aVp_PBI1UqvfaIqKma3jAJimEoGCRGGbOqs/edit#) + +#### Release process automation with help of Travis CI + +1. Commit messages are validated (with [commitlint](https://commitlint.js.org/)) in context of PR's that are coming from local branches. + To not increase difficulty of contribution, we do not enforce that on external contributors. Still in turn PR's coming from forks (if commit messages do not follow CC), are expected to be squash merged with a valid CC commit message. +1. In Release PR by running `npm run prepare-release` command developer bumps version in `package.json` and generates the changelog entry (which can be altered if needed). +1. Release PR's are automatically detected in CI by fact of `version` in `package.json` file being changed. + In context of that build, existence of new version changelog entry (in `CHANGELOG.md`) is validated. +1. Once release PR is merged, `master` build detects that release PR was merged by fact that it covers change of `version` field in `package.json` file. In such case (after tests pass) version tag is created and pushed to the repository +1. In context fo version tag build, new version is published to npm, and release notes are retrieved from CHANGELOG.md and pushed to GitHub. +1. If needed release notes can be updated at any time afterwards. They should be updated in `CHANGELOG.md` and change can be pushed to GitHub release notes by running: + `npx github-release-from-cc-changelog ` From 4483e3703292e66d40e0d3c2bb0ba379b197b76a Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 13:38:15 +0200 Subject: [PATCH 36/57] ci: Improve comments --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec468b9..d019329 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ jobs: # PR's from forks # Do not validate commit messages, - # (if user didn't ensure CC, PR should be squash merged with valid CC commit message) + # (if user didn't ensure CC, PR should be squash merged with a valid CC commit message) - name: 'Prettier check updated, Lint updated - Node.js v12' if: type = pull_request AND fork = true node_js: 12 From 68c772389f74b8139347f2c96dc1d7ca108f8e6d Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 13:59:22 +0200 Subject: [PATCH 37/57] docs: Improve documentation --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ad210f..ce2d1f4 100755 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # @serverless/eslint-config -## Common ESLint, Prettier and Commitlint (experimental) configuration, for Serverless projects +## Common ESLint, Prettier configuration for Serverless projects -### How to setup linters in a project +### Configuration in a project 1. Install needed dependencies: @@ -48,8 +48,6 @@ module.exports = require('@serverless/eslint-config/prettier.config'); 1. Configure npm scripts -Configure following scripts in package.json: - ```json { "scripts": { @@ -72,6 +70,8 @@ Note: following should be run only for PR's (as `*-updated`) scripts may fail on npm run lint-updated && npm run prettier-check-updated ``` +--- + ### Commitlint and automation of release process (experimental) Commit messages in context of this project should follow [Convention Commits Convention](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary) From e6d3749ad61b7501a943f4cd073999889aa679d1 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 14:00:26 +0200 Subject: [PATCH 38/57] docs: Fix steps list --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ce2d1f4..bcd55aa 100755 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ ### Configuration in a project -1. Install needed dependencies: +#### 1. Install needed dependencies: ```bash npm i --save-dev eslint eslint-plugin-import prettier git-list-updated ``` -1. Configure ESLint +#### 2. Configure ESLint Add `eslintConfig` to package.json: @@ -36,7 +36,7 @@ _For Browser projects:_ } ``` -1. Configure Prettier +#### 3. Configure Prettier Add `.prettier.config.js` file with following content: @@ -46,7 +46,7 @@ Add `.prettier.config.js` file with following content: module.exports = require('@serverless/eslint-config/prettier.config'); ``` -1. Configure npm scripts +#### 4. Configure npm scripts ```json { @@ -60,7 +60,7 @@ module.exports = require('@serverless/eslint-config/prettier.config'); } ``` -1. Ensure to validate changes in CI +#### 5. Ensure to validate changes in CI Run following validation of PR's in CI build. From 2530e2fb99d31d1591ef316e7bba9e961e3b98a9 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 14:01:06 +0200 Subject: [PATCH 39/57] docs: Cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bcd55aa..6a06b09 100755 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ### Configuration in a project -#### 1. Install needed dependencies: +#### 1. Install needed dependencies ```bash npm i --save-dev eslint eslint-plugin-import prettier git-list-updated From 4bd17c91f818359a1abec91f530579def702d895 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 14:10:06 +0200 Subject: [PATCH 40/57] style: Whitespace --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 45d938e..c1318ac 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,6 @@ module.exports = { 'camelcase': ['error', { properties: 'never' }], 'comma-dangle': ['error', 'always-multiline'], 'consistent-return': 'error', - 'curly': ['error', 'multi-line'], 'default-case': ['error', { commentPattern: '^no default$' }], 'dot-notation': ['error', { allowKeywords: true }], From dd94d5d11caca43a71dc770431575e344d1aa717 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 18:18:12 +0200 Subject: [PATCH 41/57] ci: Fix CHANGELOG confirmation script --- .travis.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d019329..608f10c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,11 +30,13 @@ jobs: script: - | npm run prettier-check-updated && npm run lint-updated && npm run commitlint-ci-pull-request && - tagName=`git diff master package.json | grep '"version": "' | grep -oE "\d+\.\d+\.\d+"` - if [ $? -eq 0 ]; then + { # If release PR, confirm we have a changelog - npx dump-release-from-cc-changelog $tagName - fi + tagName=`git diff master package.json | grep '"version": "' | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` + if [ $? -eq 0 ]; then + npx dump-release-notes-from-cc-changelog $tagName + fi + } # PR's from forks # Do not validate commit messages, @@ -52,11 +54,13 @@ jobs: script: - | npm run lint && - # If package version was changed with last merged PR, push tag - tagName=`git diff HEAD^ package.json | grep '"version": "' | grep -oE "\d+\.\d+\.\d+"` - if [ $? -eq 0 ]; then - git tag v$tagName && git push -q https://$GITHUB_TOKEN@github.com/serverless/eslint-config --tags - fi + { + # If package version was changed with last merged PR, push tag + tagName=`git diff HEAD^ package.json | grep '"version": "' | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` + if [ $? -eq 0 ]; then + git tag v$tagName && git push -q https://$GITHUB_TOKEN@github.com/serverless/eslint-config --tags + fi + } # version tag - stage: Deploy From 5d5fea599b331277844733f2a353e550b43e4965 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 18:24:10 +0200 Subject: [PATCH 42/57] ci: Comment style --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 608f10c..37e5035 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ stages: jobs: include: - # In most cases it's best to configure one job per Platform & Node.js version combination + # In most cases it's best to configure one job per platform & Node.js version combination # (job boot & setup takes ca 1 minute, one task run lasts ca few seconds) # PR's from branches From aa8e1196d9d376aad0853f74821ee5f8febb9133 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 16:53:17 +0200 Subject: [PATCH 43/57] chore: Release v1.0.0 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ff4bbf4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## 1.0.0 (2019-06-20) + +### Features + +- Prettier configuration ([74f6612](https://github.com/serverless/eslint-config/commit/74f6612)) +- Reflect ESLint configuration of `serverless` package ([be5561b](https://github.com/serverless/eslint-config/commit/be5561b)) +- Turn off rules that collide with Prettier ([c4ebb38](https://github.com/serverless/eslint-config/commit/c4ebb38)) From ccce31c12826b5dd68e0fbbfd111c29a75c20591 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 18:29:28 +0200 Subject: [PATCH 44/57] chore: Ensure to prettify CHANGELOG after notes generation --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d27afb9..638ef0b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "commitlint": "commitlint -f HEAD@{15}", "commitlint-ci-pull-request": "commitlint -f HEAD~1", "lint-updated": "pipe-git-updated --ext=js -- eslint --cache", - "prepare-release": "standard-version", + "prepare-release": "standard-version && prettier --write CHANGELOG.md", "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"", "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"" From 008e5cb656285e184fa71a32e9ee0cee816842f0 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 18:30:42 +0200 Subject: [PATCH 45/57] chore: Bump dependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 638ef0b..1cb9923 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@commitlint/cli": "^8.0.0", "eslint": "^5.16.0", "eslint-plugin-import": "^2.17.3", - "git-list-updated": "^1.1.2", + "git-list-updated": "^1.2.0", "github-release-from-cc-changelog": "^2.2.0", "prettier": "^1.18.2", "standard-version": "^6.0.1" From 2a6f55a5068b2124d05bf36ceb7bab50abe0a459 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 18:41:33 +0200 Subject: [PATCH 46/57] chore: Restrict scopes to specified list --- commitlint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commitlint.config.js b/commitlint.config.js index 740816b..951ffae 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -8,6 +8,7 @@ module.exports = { 'footer-max-line-length': [2, 'always', 72], 'header-max-length': [2, 'always', 72], 'scope-case': [2, 'always', 'start-case'], + 'scope-enum': [2, 'always', ['']], 'subject-case': [2, 'always', 'sentence-case'], 'subject-empty': [2, 'never'], 'subject-full-stop': [2, 'never', '.'], From d6b93339bb8cd685880270c66665ea397fff80b6 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 20 Jun 2019 19:04:29 +0200 Subject: [PATCH 47/57] fix: Ensure prettier.config.js is covered as dev dependency --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c1318ac..4218a98 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,7 @@ module.exports = { 'import/no-duplicates': 'error', 'import/no-extraneous-dependencies': [ 'error', - { devDependencies: ['**/*.test.js', '**/scripts/**', '**/tests/**'] }, + { devDependencies: ['**/*.test.js', '**/scripts/**', '**/tests/**', 'prettier.config.js'] }, ], 'import/no-mutable-exports': 'error', 'import/no-named-as-default': 'error', From e2187b2e136a9655a7c4a8cc49536265b1afe6cb Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:10:20 +0200 Subject: [PATCH 48/57] ci: Configure GITHUB_TOKEN --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37e5035..f7838a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,8 @@ jobs: # master branch - name: 'Lint, Tag on version bump - Node.js v12' - env: #TODO: Expose Github token at GITHUB_TOKEN + env: + secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= if: branch = master AND type = push node_js: 12 script: @@ -64,7 +65,8 @@ jobs: # version tag - stage: Deploy - env: #TODO: Expose Github token at GITHUB_TOKEN + env: + secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= node_js: 12 script: skip deploy: From bbd62bd6b73f7f5ed74160128a57c0f8711a87e0 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:10:53 +0200 Subject: [PATCH 49/57] ci: Clear invalid token --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f7838a4..53542a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,5 @@ jobs: deploy: provider: npm email: services@serverless.com - api_key: - secure: EgoetjrRlGfvGnmVp8A0btr1CzB0hl7owVIpbfk4zXJzhGEbHoVu0CG0IdmyLN+JlaZa7EDJTjkDCd6g3fVAh9TT7ZCeaq8YwbZDrql7mAJj7xYQAyM4eSkc95BRzcFJBx7Mxr6H90IDLxKr6ZtB+HEdiHN+59XbepKYYJeb1jHfnKn5xzOqk4BdnZo6pKfudfeO+7/BwJJ0FwlFA40bY2HS/Lp+NG/2IedNR7k3m/5W83/XH5qlWP8jhBKlxrAzks27aNo+42xHkRCVyPViJKq0mfz1hl2bfswChWHgaCuajp+0amNL39pgIX9eXxFc3bNX9Iftox5t31elEhsw06vvuAaVkKEd+VEMaDySbQ9M+irKZeREg+NFYZLnc2WiEE3Sexo6hm9eM2q2KEZ7bleN9B0CQAut1XXLRQEts80rzss4Z2Q7AZb9cOYBQlj9Wf1X0Y74UqvnDn83a4Y38a+lhx7J2q691ZeM1UFSCdO0QfeJRkB55bSyHqUqrLAqUN7eNsKGdBH0kvYIGFREgGgReEpBRAuNqWuJ/5qexp63Kbf+09raG5IvfxSIM5fJ5KE5VxSduBdRnSH0GNKfjuq296/Rg4fmm/bygZ3Yk5L6Wd41SUU8uHzlZFBwtcvxAKDTQe6s+5JU24ilqxOx6J4Ut34X3dIbLLAmoB1ogdM= + api_key: # TODO, register an NPM_TOKEN for deploys after_deploy: npx github-release-from-cc-changelog $TRAVIS_TAG From 4437129b65b31b4883271c4ad46f1e432e8992e7 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:49:44 +0200 Subject: [PATCH 50/57] ci: Set npm auth token --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 53542a8..490e19f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,5 +72,6 @@ jobs: deploy: provider: npm email: services@serverless.com - api_key: # TODO, register an NPM_TOKEN for deploys + api_key: + secure: TR0iwraM6LkJFqKIjPbHP04yE4HYD0bY4jTGrf8TQTgeOUw3jF/5vLXU5XORYypWSgxmehKUaeeo8YC0QuC72NF37DkvzmwS7ENoIwcOxEtrIYjWhWVWBsPN8qfM5gFj0k4KY1clvamdTOTQ+yg5od7iYIDhg3L2CM3yMAsx/MifMYZbYvXIUGeXuoohd2XTwh89kSMMoae/E+zSvvZANxByDOAliSM10O6kAn9UclrE8lILskmchuNurzqMpUkIJQuAYXUojYMnou5uZhRPWrtbyrcrv+QFb7LQmqHD3gSJemLrgjKM0/7IkPSirRcca6bixxrJYwCDvr35KkWHUibEbmgBJL1pyAmftBG5cL6qMQzBihLCQDy/dI+leR48uTWDlWA+eSy05vkmYEm5JoxY49R7wbMG/aZb1lZlz+M9+HgUuJO9spK1wIiQrqOV8oLizjMAUFy94xp7/kXImj0KVR6yk2cxBBqDyVAbINitF+h98hl7BPQepoCcj4Y5Mz8y20RPZsk0+Y1z5sfaXhCCeNcPgLqv8uKyDwcXfM1TgoFk9L52m5DfHpBKfm5THWqbY4THB1dpQfPkjZEREwDoFo+fAWefHcB+erJ+kbGl2kxZw/7T/TRZmM34ExFLbUkl4kF/Xc4s3b4QdFkbNfbHljn/2rhg+sFHR3j83FY= after_deploy: npx github-release-from-cc-changelog $TRAVIS_TAG From 91c96b68b093be076c4957c22ddf0ff17415a627 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:50:00 +0200 Subject: [PATCH 51/57] ci: Fix env settings --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 490e19f..15a2a6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ jobs: # master branch - name: 'Lint, Tag on version bump - Node.js v12' env: - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= + - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= if: branch = master AND type = push node_js: 12 script: @@ -66,7 +66,7 @@ jobs: # version tag - stage: Deploy env: - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= + - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= node_js: 12 script: skip deploy: From fba13463e572f91f3f12703d21635174d6b3ebf4 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:50:35 +0200 Subject: [PATCH 52/57] chore: Bump date in generated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff4bbf4..346b8a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -## 1.0.0 (2019-06-20) +## 1.0.0 (2019-06-21) ### Features From dc7864510eeee927e9cec4836892bc8b58822864 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 09:53:59 +0200 Subject: [PATCH 53/57] ci: Document secrets --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 15a2a6c..92bed92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,7 @@ jobs: # master branch - name: 'Lint, Tag on version bump - Node.js v12' env: + # GITHUB_TOKEN - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= if: branch = master AND type = push node_js: 12 @@ -66,6 +67,7 @@ jobs: # version tag - stage: Deploy env: + # GITHUB_TOKEN - secure: D1+mm66C9ik6AGzkVO8KkRF3Z8DwquK2clfVhNqL0ZErT2FRxWtv+21bDDfymd2ZOOm3hv9wLQw4O+nreKGWhzNDAZYwx46ngPl6bl+GA+ZeIWXyHbli02dcIevEJU2US1MA1f0kefhDvr6vNTMdOXOk7CmSMYazJa3kcEoCotdc6Fb6et20bXHXh6mE0LDzSTsVXuM9s3JIESYyU40qK9fFPcKDpOgxqbZ8K57b7ufOeL9caZ2VN0ixq2G/AoEvZPCijFAVAltcc0W11t6Kri1Cs4cv+ox64dBAwhk9w4fD6F75vgRxC/5aHitafTtRTbZPLSOCJpfeP7hmiBAK/7qMLCo0k1XML9S42fj1yhk87Dfa2FJ1Q69bLFSZbxiM1Z8esenIDk34rZpIszkEwrBDuTVJRC00M7jfWnw4sSDs4ka/hkU/968Fe3ppYWITfdBZccTGSTZK6/Zkn/fKqLIonapqh43O18hujhdcjQFNtnXUDOcnJ5leK9LRziquGi2kO/1Uhc3oR7nnRF5VR/qwXfYabdpDul5Kdp8lo7cp2bozsP5oFiDDO+t/JGLf4ryHtBfKh2HvZbMgcGDfEuRHxfQWDhtHf2xh/hHkYy1L0/W8mGSjopfF0jSHiqYcje05LmNchsSrY1nIA0lTPjnfZimNbKMhEQ0FspBBzpU= node_js: 12 script: skip From 31387945771e332ee0e69d8b549dcef260a24612 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 10:39:40 +0200 Subject: [PATCH 54/57] feat: Do not enforce 'max-len' It's more dev friendly to allow exceptions that Prettier produces --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 4218a98..b5d5dfd 100644 --- a/index.js +++ b/index.js @@ -32,7 +32,6 @@ module.exports = { 'import/no-unresolved': ['error', { commonjs: true }], 'import/prefer-default-export': 'error', - 'max-len': ['error', 100, 2, { ignoreUrls: true }], 'new-cap': ['error', { newIsCap: true }], 'no-array-constructor': 'error', 'no-caller': 'error', From ae5aafe04c3c47f232e3756239ab0b3588d9a222 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 21 Jun 2019 11:54:34 +0200 Subject: [PATCH 55/57] docs: Fix spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a06b09..367c0e2 100755 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ _For Browser projects:_ #### 3. Configure Prettier -Add `.prettier.config.js` file with following content: +Add `prettier.config.js` file with following content: ```javascript 'use strict'; From 5b1e4c74d3105f45cebb36c4b6ff6ad129815c5d Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 24 Jun 2019 09:15:38 +0200 Subject: [PATCH 56/57] chore: Switch License to MIT --- LICENSE | 30 ++++++++++++++++++------------ package.json | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index 087bcbb..6d212b4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,15 +1,21 @@ -ISC License +MIT License Copyright (c) 2019 Serverless, Inc. http://www.serverless.com -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index 1cb9923..bc202f8 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,5 @@ "prettier-check-updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c", "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"" }, - "license": "ISC" + "license": "MIT" } From e0a1242057071829ec8787d95428bf84d916589c Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 24 Jun 2019 09:16:40 +0200 Subject: [PATCH 57/57] docs: Bump date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 346b8a9..052617c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -## 1.0.0 (2019-06-21) +## 1.0.0 (2019-06-24) ### Features