Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

ESM #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
["@babel/preset-env"]
]
}
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

[*.{json}]
[*.json]
; indent_size = 2
indent_style = space
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
jquery.easing.min.js
/jquery.easing.min.js
/jquery.easing.js
/addJQueryEasing.js
30 changes: 27 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ module.exports = {
env: {
es6: true
},
parserOptions: {
sourceType: 'module'
},
overrides: [
{
files: '.eslintrc.js',
files: ['.eslintrc.js', 'example/node.js'],
env: {
node: true
},
parserOptions: {
sourceType: 'script'
},
rules: {
strict: ['error']
}
Expand All @@ -20,18 +26,36 @@ module.exports = {
files: 'example/**',
env: {
browser: true
}
},
parserOptions: {
sourceType: 'script'
},
},
{
files: '*.md',
globals: {
require: 'readonly',
define: 'readonly'
},
rules: {
'no-unused-vars': ['error', {
varsIgnorePattern: '$'
}]
}
}
],
rules: {
indent: ['error', 'tab'],
semi: ['error']
semi: ['error'],

'prefer-const': ['error'],
'no-var': ['error'],
'prefer-destructuring': ['error'],
'object-shorthand': ['error'],
'object-curly-spacing': ['error', 'always'],
quotes: ['error', 'single'],
'quote-props': ['error', 'as-needed'],
'brace-style': ['error', '1tbs'],
'prefer-template': ['error']
}
};
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,52 @@ What is it? A jQuery plugin from GSGD to give advanced easing options. More info

For CDN please use CloudFlare [`https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js`](https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js) to help my host. Thank you.

# AMD or CommonJS usage
## ESM usage (bundlers)

```js
import $ from 'jquery.easing';
```

## ESM usage (browser)

```js
import $ from './node_modules/jquery.easing/src/jquery.easing.mjs';
```

OR, to pass your own non-global `jQuery` instance:

```js
/* globals someJQueryInstance */
import addJQueryEasing from './node_modules/jquery.easing/src/addJQueryEasing.mjs';

const $ = addJQueryEasing(someJQueryInstance);
```

## UMD usage

```html
<script src="node_modules/jquery.easing/jquery.easing.min.js"></script>
```

## CommonJS or AMD usage

```js
// CommonJS
const jQuery = require('jquery');
require('jquery.easing')(jQuery);
const { JSDOM } = require('jsdom');
const JQuery = require('jquery');
const addJQueryEasing = require('jquery.easing');

const { window } = new JSDOM('');
const jQuery = JQuery(window);
const $ = addJQueryEasing(jQuery);

// AMD
define(['jquery', 'jquery.easing'], function (jQuery, easing) {
easing(jQuery);
return easing(jQuery);
});
```

# Building and testing
## Building and testing

- Clone the repo
- `npm install`
Expand Down
144 changes: 144 additions & 0 deletions addJQueryEasing.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions addJQueryEasing.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 0 additions & 28 deletions bower.json

This file was deleted.

Loading