diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..72df373 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,20 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.eslintrc.js b/.eslintrc.js index 7a8a44b..c4b7c41 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,16 +1,56 @@ module.exports = { root: true, + parser: 'babel-eslint', parserOptions: { - ecmaVersion: 2017, - sourceType: 'module' + ecmaVersion: 2018, + sourceType: 'module', + ecmaFeatures: { + legacyDecorators: true + } }, + plugins: [ + 'ember' + ], extends: [ 'eslint:recommended', - 'plugin:ember-suave/recommended' + 'plugin:ember/recommended' ], env: { browser: true }, rules: { - } + 'ember/no-jquery': 'error' + }, + overrides: [ + // node files + { + files: [ + '.eslintrc.js', + '.template-lintrc.js', + 'ember-cli-build.js', + 'index.js', + 'testem.js', + 'blueprints/*/index.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'addon/**', + 'addon-test-support/**', + 'app/**', + 'tests/dummy/app/**' + ], + parserOptions: { + sourceType: 'script' + }, + env: { + browser: false, + node: true + }, + plugins: ['node'], + rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { + // add your custom rules and overrides for node files here + }) + } + ] }; diff --git a/.gitignore b/.gitignore index 8fa39a6..c40a1b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,25 @@ # See https://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist -/tmp +/dist/ +/tmp/ # dependencies -/node_modules -/bower_components +/bower_components/ +/node_modules/ # misc +/.env* +/.pnp* /.sass-cache /connect.lock -/coverage/* +/coverage/ /libpeerconnection.log -npm-debug.log* -yarn-error.log -testem.log +/npm-debug.log* +/testem.log +/yarn-error.log # ember-try -.node_modules.ember-try/ -bower.json.ember-try -package.json.ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.npmignore b/.npmignore index 889b2bf..bd09adf 100644 --- a/.npmignore +++ b/.npmignore @@ -1,16 +1,32 @@ -/bower_components +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ + +# misc +/.bowerrc +/.editorconfig +/.ember-cli +/.env* +/.eslintignore +/.eslintrc.js +/.git/ +/.gitignore +/.template-lintrc.js +/.travis.yml +/.watchmanconfig +/bower.json /config/ember-try.js -/dist -/tests -/tmp -**/.gitkeep -.bowerrc -.editorconfig -.ember-cli -.gitignore -.eslintrc.js -.watchmanconfig -.travis.yml -bower.json -ember-cli-build.js -testem.js +/CONTRIBUTING.md +/ember-cli-build.js +/testem.js +/tests/ +/yarn.lock +.gitkeep + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.template-lintrc.js b/.template-lintrc.js new file mode 100644 index 0000000..87054d1 --- /dev/null +++ b/.template-lintrc.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + extends: 'octane', + rules: { + 'no-curly-component-invocation': false, + 'no-inline-styles': false, + 'no-positive-tabindex': false + } +}; diff --git a/.travis.yml b/.travis.yml index ec0965d..e9eaf40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ --- language: node_js node_js: - - "6" + # we recommend testing addons with the same minimum supported node version as Ember CLI + # so that your addon works for all apps + - "8" sudo: false dist: trusty @@ -17,29 +19,43 @@ env: global: # See https://git.io/vdao3 for details. - JOBS=1 - matrix: - - EMBER_TRY_SCENARIO=ember-lts-2.8 - - EMBER_TRY_SCENARIO=ember-lts-2.12 - - EMBER_TRY_SCENARIO=ember-lts-2.16 - - EMBER_TRY_SCENARIO=ember-lts-2.18 - - EMBER_TRY_SCENARIO=ember-lts-3.4 - - EMBER_TRY_SCENARIO=ember-release - - EMBER_TRY_SCENARIO=ember-beta - - EMBER_TRY_SCENARIO=ember-canary - - EMBER_TRY_SCENARIO=ember-default - - EMBER_TRY_SCENARIO=ember-default-with-jquery - -matrix: - fast_finish: true + +branches: + only: + - master + # npm version tags + - /^v\d+\.\d+\.\d+/ + +jobs: + fail_fast: true allow_failures: - env: EMBER_TRY_SCENARIO=ember-canary -before_install: - - npm config set spin false - - npm install -g npm@4 - - npm --version + include: + # runs linting and tests with current locked deps + - stage: "Tests" + name: "Tests" + script: + - npm run lint:hbs + - npm run lint:js + - npm test + + - stage: "Additional Tests" + name: "Floating Dependencies" + install: + - npm install --no-package-lock + script: + - npm test + + # we recommend new addons test the current and previous LTS + # as well as latest stable release (bonus points to beta/canary) + - env: EMBER_TRY_SCENARIO=ember-lts-3.8 + - env: EMBER_TRY_SCENARIO=ember-lts-3.12 + - env: EMBER_TRY_SCENARIO=ember-release + - env: EMBER_TRY_SCENARIO=ember-beta + - env: EMBER_TRY_SCENARIO=ember-canary + - env: EMBER_TRY_SCENARIO=ember-default-with-jquery + - env: EMBER_TRY_SCENARIO=ember-classic script: - # Usually, it's ok to finish the test scenario without reverting - # to the addon's original dependency state, skipping "cleanup". - - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4d14b95 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# How To Contribute + +## Installation + +* `git clone ` +* `cd my-addon` +* `npm install` + +## Linting + +* `npm run lint:hbs` +* `npm run lint:js` +* `npm run lint:js -- --fix` + +## Running tests + +* `ember test` – Runs the test suite on the current Ember version +* `ember test --server` – Runs the test suite in "watch mode" +* `ember try:each` – Runs the test suite against multiple Ember versions + +## Running the dummy application + +* `ember serve` +* Visit the dummy application at [http://localhost:4200](http://localhost:4200). + +For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 0d5e3ef..7b6573f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 +Copyright (c) 2020 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: diff --git a/addon/components/radio-button-input.js b/addon/components/radio-button-input.js index f6fe2bc..168fbba 100644 --- a/addon/components/radio-button-input.js +++ b/addon/components/radio-button-input.js @@ -54,11 +54,6 @@ export default Component.extend({ let value = this.get('value'); let changedAction = this.get('changed'); - if (typeof changedAction === 'string') { - this.sendAction('changed', value); - return; - } - if (changedAction) { changedAction(value); } diff --git a/addon/components/radio-button.js b/addon/components/radio-button.js index 3461b29..620ba3e 100644 --- a/addon/components/radio-button.js +++ b/addon/components/radio-button.js @@ -32,6 +32,10 @@ export default Component.extend({ checkedClass: 'checked', + checkedClassWithFallback: computed('checkedClass', function() { + return this.get('checkedClass') || 'checked'; + }), + checked: computed('groupValue', 'value', function() { return isEqual(this.get('groupValue'), this.get('value')); }).readOnly(), @@ -40,12 +44,6 @@ export default Component.extend({ changed(newValue) { let changedAction = this.get('changed'); - // support legacy actions - if (typeof changedAction === 'string') { - this.sendAction('changed', newValue); - return; - } - // providing a closure action is optional if (changedAction) { changedAction(newValue); diff --git a/addon/templates/components/radio-button.hbs b/addon/templates/components/radio-button.hbs index a50d346..74cb453 100644 --- a/addon/templates/components/radio-button.hbs +++ b/addon/templates/components/radio-button.hbs @@ -1,33 +1,34 @@ {{#if hasBlock}} -