From 08caf3292c2aa90c0c34dcddfe22d2bfa4f27bc8 Mon Sep 17 00:00:00 2001 From: Amphiluke Date: Sun, 1 Apr 2018 23:20:45 +0700 Subject: [PATCH 1/3] Rewrite the plugin sources in ES6. Configure rollup --- .eslintignore | 1 + .eslintrc.json | 34 + .npmignore | 4 +- CHANGELOG.md | 4 + CONTRIBUTING.md | 2 +- README.md | 2 +- bower.json | 4 +- dist/jquery.floatingscroll.css | 1 + dist/jquery.floatingscroll.es6.min.js | 14 + dist/jquery.floatingscroll.min.js | 14 + package-lock.json | 2593 ++++++++++++++++++++++--- package.json | 15 +- rollup.config.js | 47 + src/jquery.floatingscroll.js | 261 ++- src/jquery.floatingscroll.min.js | 6 - 15 files changed, 2570 insertions(+), 432 deletions(-) create mode 100644 .eslintignore create mode 100644 CHANGELOG.md create mode 100644 dist/jquery.floatingscroll.css create mode 100644 dist/jquery.floatingscroll.es6.min.js create mode 100644 dist/jquery.floatingscroll.min.js create mode 100644 rollup.config.js delete mode 100644 src/jquery.floatingscroll.min.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..4be6e16 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist/* \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index ab7cdea..f17779d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,13 +3,24 @@ "browser": true, "amd": true, "commonjs": true, + "es6": true, "node": true }, "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, "rules": { "array-bracket-spacing": [ "error" ], + "arrow-body-style": [ + "warn" + ], + "arrow-spacing": [ + "error" + ], "block-spacing": [ "error", "never" @@ -24,6 +35,9 @@ "comma-style": [ "error" ], + "computed-property-spacing": [ + "error" + ], "curly": [ "error" ], @@ -60,6 +74,10 @@ "new-parens": [ "error" ], + "no-console": [ + "error", + {"allow": ["info", "warn", "error"]} + ], "no-multi-spaces": [ "error" ], @@ -72,12 +90,21 @@ "no-useless-call": [ "error" ], + "no-useless-computed-key": [ + "error" + ], + "no-var": [ + "error" + ], "no-whitespace-before-property": [ "warn" ], "object-curly-spacing": [ "error" ], + "object-shorthand": [ + "warn" + ], "operator-assignment": [ "warn" ], @@ -85,6 +112,13 @@ "error", "after" ], + "prefer-arrow-callback": [ + "error", + {"allowNamedFunctions": true} + ], + "prefer-rest-params": [ + "error" + ], "quotes": [ "error", "double" diff --git a/.npmignore b/.npmignore index abed34b..1de16a8 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,5 @@ .idea bower_components -.eslint* \ No newline at end of file +bower.json +.eslint* +rollup.config.js \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..238f548 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +## v3.0.0 + +* Support of “ancient” browsers (IE 8 and older) is dropped. +* Old deprecated plugin’s alias `attachScroll` and the event `adjustScroll` have been completely removed (use `floatingScroll` and `update.fscroll` instead). \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d33eb68..765b2b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ Before submitting a new pull request be sure to do the following things. * Test your changes in different browsers: Chrome, Firefox, Safari, Opera, Internet Explorer, and Edge. * Note that the plugin is currently compatible with ancient versions of jQuery (1.4.3+). If your changes break this compatibility please think if you can rewrite your code to keep compatibility unaffected. However if your changes are so important and cool that they outweigh all benefits of supporting ancient versions of jQuery then it is possible to soften this requirement within reasonable limits. * Before committing your changes please make sure that the plugin sources pass ESLint checks. Just use the command `npm run lint` in the project directory (of course, you need to install the project first by executing `npm install`). Fix any problems reported by ESLint before submitting a pull request. -* Do not forget to update the minified version of the plugin sources. Use the command `npm run minify` for that. If you changed the file of plugin styles (`jquery.floatingscroll.less`) run `npm run make-css` to update the minified CSS file as well. +* Do not forget to update the minified version of the plugin sources. Use the command `npm run build` for that. Thanks for contribution! :tea: diff --git a/README.md b/README.md index 1192d41..66840bd 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ You may also trigger events `update.fscroll` and `destroy.fscroll` for container ### Inclusion of plugin files -The plugin requires the CSS file [jquery.floatingscroll.css](src/jquery.floatingscroll.css) to be included on the page (you may also import it in your CSS/LESS files). The plugin's script file [jquery.floatingscroll.min.js](src/jquery.floatingscroll.min.js) may be added on the web page either via a separate `