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

v3.25.0...v3.28.4 #74

Merged
merged 1 commit into from
Nov 17, 2021
Merged
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
Expand Down
50 changes: 30 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,34 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
parser: '@typescript-eslint/parser',
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
],
env: {
browser: true,
},
rules: {},
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.prettierrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
'./.eslintrc.js',
'./.prettierrc.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',
},
Expand All @@ -40,6 +39,17 @@ module.exports = {
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
],
};
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
fail-fast: true
matrix:
ember-try-scenario:
- ember-lts-3.16
- ember-lts-3.20
- ember-lts-3.24
- ember-release
#- ember-beta
#- ember-canary
- ember-beta
- ember-canary
- ember-classic
steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
/.eslintrc.js
/.git/
/.gitignore
/.github
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
Expand All @@ -24,10 +27,14 @@
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

# readme imgs
/imgs
2 changes: 0 additions & 2 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

module.exports = {
singleQuote: true,
printWidth: 120,
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'octane',
extends: 'recommended',
};
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

## Linting

- `npm run lint:hbs`
- `npm run lint:js`
- `npm run lint:js -- --fix`
- `npm run lint`
- `npm run lint:fix`

## Running tests

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class CharacterComponent extends Component {
<Character @name={{123}} />
```

![Error Example](error-example.png)
![Error Example](imgs/error-example.png)

### Example Extra Argument Error

Expand All @@ -102,7 +102,7 @@ export default class CharacterComponent extends Component {
<ExtendedCharacter @name='character' @numHeart={{3}} />
```

![Error Example](error-extra-arg-example.png)
![Error Example](imgs/error-extra-arg-example.png)

### Prop Type Docs

Expand Down Expand Up @@ -206,9 +206,9 @@ export default class CharacterComponent extends Component {

## Compatibility

- Ember.js v3.8 or above
- Ember CLI v2.13 or above
- Node.js v8 or above
- Ember.js v3.20 or above
- Ember CLI v3.20 or above
- Node.js v12 or above

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion addon/-private/closest-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (macroCondition(isDevelopingApp())) {
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();

const costs = new Array();
const costs = [];
for (let i = 0; i <= s1.length; i++) {
let lastValue = i;
for (let j = 0; j <= s2.length; j++) {
Expand Down
5 changes: 3 additions & 2 deletions addon/-private/is-element-descriptor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//https://github.com/emberjs/ember.js/blob/d1ad76a2b22ce470639df3dfc6efb6864a70f588/packages/%40ember/-internals/metal/lib/decorator.ts
export default function isElementDescriptor(...args: any[]) {
let [maybeTarget, maybeKey, maybeDesc] = args;

export default function isElementDescriptor(...args: unknown[]) {
const [maybeTarget, maybeKey, maybeDesc] = args;

return (
// Ensure we have the right number of args
Expand Down
5 changes: 3 additions & 2 deletions addon/-private/throw-console-error.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { macroCondition, isDevelopingApp } from '@embroider/macros';

type ThrowConsoleError = (fn: Function, enabled: boolean) => void;
type ThrowConsoleError = (fn: () => void, enabled: boolean) => void;

let throwConsoleError: ThrowConsoleError;
if (macroCondition(isDevelopingApp())) {
throwConsoleError = (fn: Function, enabled: boolean = true) => {
throwConsoleError = (fn: () => void, enabled = true) => {
const original = console.error;
console.error = enabled
? (msg: string) => {
Expand All @@ -14,6 +14,7 @@ if (macroCondition(isDevelopingApp())) {
: original;
try {
fn();
// eslint-disable-next-line no-useless-catch
} catch (e) {
throw e;
} finally {
Expand Down
10 changes: 6 additions & 4 deletions addon/decorator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import isElementDescriptor from './-private/is-element-descriptor';
import throwConsoleError from './-private/throw-console-error';
import Component from '@glimmer/component';
Expand Down Expand Up @@ -25,7 +26,7 @@ function createGetter<T extends Component>(
target: any,
key: string,
descriptor: any,
validator?: Validator<any>
validator?: Validator<unknown>
): PropertyDescriptor {
if (macroCondition(isDevelopingApp())) {
const registeredArgs = target[REGISTERED_ARGS] ?? new Set<string>();
Expand Down Expand Up @@ -62,21 +63,22 @@ export default function arg<T extends Component>(...args: any[]): any {

const [validator] = args;
return function argument<T extends Component>(...args: any[]): any {
return createGetter(...(([...args, validator] as unknown) as [T, string, any, Validator<any>?]));
return createGetter(...([...args, validator] as unknown as [T, string, any, Validator<any>?]));
};
}

export function forbidExtraArgs(target: any) {
let returnClass = target;

// only sublcass in debug mode
// only subclass in debug mode
if (macroCondition(isDevelopingApp())) {
returnClass = class ForbidExtraArgsIntercept extends target {
declare [REGISTERED_ARGS]?: Set<string>;

constructor(_owner: unknown, args: Record<string, unknown>) {
// eslint-disable-next-line prefer-rest-params
super(...arguments);
let component = getClassName(this);
const component = getClassName(this);

const registeredArgs = this[REGISTERED_ARGS];
if (!registeredArgs) {
Expand Down
26 changes: 22 additions & 4 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,60 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
scenarios: [
{
name: 'ember-lts-3.16',
name: 'ember-lts-3.20',
npm: {
devDependencies: {
'ember-source': '~3.16.0',
'ember-source': '~3.20.5',
},
},
},
{
name: 'ember-lts-3.20',
name: 'ember-lts-3.24',
npm: {
devDependencies: {
'ember-source': '~3.20.5',
'ember-source': '~3.24.3',
},
},
},
{
name: 'ember-release',
npm: {
dependencies: {
'ember-auto-import': '^2.0.0',
},
devDependencies: {
'ember-source': await getChannelURL('release'),
webpack: '^5.0.0',
},
},
},
{
name: 'ember-beta',
npm: {
dependencies: {
'ember-auto-import': '^2.0.0',
},
devDependencies: {
'ember-source': await getChannelURL('beta'),
webpack: '^5.0.0',
},
},
},
{
name: 'ember-canary',
npm: {
dependencies: {
'ember-auto-import': '^2.0.0',
},
devDependencies: {
'ember-source': await getChannelURL('canary'),
webpack: '^5.0.0',
},
},
},
Expand All @@ -68,11 +81,16 @@ module.exports = async function () {
}),
},
npm: {
devDependencies: {
'ember-source': '~3.28.0',
},
ember: {
edition: 'classic',
},
},
},
embroiderSafe(),
embroiderOptimized(),
],
};
};
4 changes: 2 additions & 2 deletions config/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export default config;
* since different ember addons can materialize new entries.
*/
declare const config: {
environment: any;
environment: unknown;
modulePrefix: string;
podModulePrefix: string;
locationType: string;
rootURL: string;
APP: any;
APP: unknown;
};
9 changes: 8 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@ module.exports = function (defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
skipBabel: [
{
package: 'qunit',
},
],
});
};
Binary file removed error-extra-arg-example.png
Binary file not shown.
File renamed without changes
Binary file added imgs/error-extra-arg-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading