Skip to content

Commit 400c0b2

Browse files
authored
Merge pull request #959 from emberjs/update-linting
2 parents c0c12c2 + b44516a commit 400c0b2

File tree

9 files changed

+316
-137
lines changed

9 files changed

+316
-137
lines changed

.eslintrc.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ module.exports = {
2727
es6: true,
2828
},
2929
plugins: ['node'],
30-
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
31-
// add your custom rules and overrides for node files here
32-
}),
30+
extends: ['plugin:node/recommended'],
3331
},
3432
{
3533
files: ['tests/**/*.[jt]s'],
@@ -39,11 +37,10 @@ module.exports = {
3937
},
4038
{
4139
files: ['**/*.ts'],
40+
extends: ['plugin:@typescript-eslint/eslint-recommended'],
4241
rules: {
43-
// the TypeScript compiler already takes care of this and
44-
// leaving it enabled results in false positives for interface imports
45-
'no-unused-vars': 0,
46-
'no-undef': 0,
42+
'no-unused-vars': 'off',
43+
'prefer-const': 'off',
4744
},
4845
},
4946
{

addon-test-support/@ember/test-helpers/-internal/build-registry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function exposeRegistryMethodsWithoutDeprecations(container: any) {
3232
let method = methods[i];
3333

3434
if (method in container) {
35-
container[method] = function () {
36-
return container._registry[method].apply(container._registry, arguments);
35+
container[method] = function (...args: unknown[]) {
36+
return container._registry[method](...args);
3737
};
3838
}
3939
}

addon-test-support/@ember/test-helpers/application.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Application from '@ember/application';
22

33
import { getResolver, setResolver } from './resolver';
44

5-
var __application__: Application | undefined;
5+
let __application__: Application | undefined;
66

77
/**
88
Stores the provided application instance so that tests being ran will be aware of the application under test.

addon-test-support/@ember/test-helpers/build-owner.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export default function buildOwner(
4040
resolver: Resolver | undefined | null
4141
): Promise<Owner> {
4242
if (application) {
43-
return (application.boot().then(app => app.buildInstance().boot()) as unknown) as Promise<
44-
Owner
45-
>;
43+
return (application
44+
.boot()
45+
.then(app => app.buildInstance().boot()) as unknown) as Promise<Owner>;
4646
}
4747

4848
if (!resolver) {

addon-test-support/@ember/test-helpers/has-ember-version.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import Ember from 'ember';
1010
@returns {boolean} true if the Ember version is >= MAJOR.MINOR specified, false otherwise
1111
*/
1212
export default function hasEmberVersion(major: number, minor: number): boolean {
13-
var numbers = Ember.VERSION.split('-')[0].split('.');
14-
var actualMajor = parseInt(numbers[0], 10);
15-
var actualMinor = parseInt(numbers[1], 10);
13+
let numbers = Ember.VERSION.split('-')[0].split('.');
14+
let actualMajor = parseInt(numbers[0], 10);
15+
let actualMinor = parseInt(numbers[1], 10);
1616
return actualMajor > major || (actualMajor === major && actualMinor >= minor);
1717
}

addon-test-support/@ember/test-helpers/resolver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Resolver from '@ember/application/resolver';
22

3-
var __resolver__: Resolver | undefined;
3+
let __resolver__: Resolver | undefined;
44

55
/**
66
Stores the provided resolver instance so that tests being ran can resolve

addon-test-support/@ember/test-helpers/setup-application-context.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function setupRouterSettlednessTracking() {
9797
router.willDestroy = function () {
9898
routerTransitionsPending = null;
9999

100-
return ORIGINAL_WILL_DESTROY.apply(this, arguments);
100+
return ORIGINAL_WILL_DESTROY.call(this);
101101
};
102102
}
103103

package.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"scripts": {
2626
"build": "ember build",
2727
"docs": "scripts/precompile.sh && documentation build --document-exported \"addon-test-support/@ember/test-helpers/index.js\" --config documentation.yml --markdown-toc-max-depth 3 -f md -o API.md && ember ts:clean",
28-
"lint": "eslint --ext=js,ts --cache . && tsc -p tsconfig.json --noEmit",
28+
"lint": "npm-run-all lint:*",
29+
"lint:eslint": "eslint --cache .",
30+
"lint:types": "tsc -p tsconfig.json --noEmit",
2931
"prepublishOnly": "scripts/precompile.sh",
3032
"postpublish": "ember ts:clean",
3133
"release": "release-it",
@@ -47,8 +49,8 @@
4749
"@types/ember-data": "^3.16.6",
4850
"@types/ember-testing-helpers": "^0.0.4",
4951
"@types/rsvp": "^4.0.3",
50-
"@typescript-eslint/eslint-plugin": "^2.34.0",
51-
"@typescript-eslint/parser": "^2.34.0",
52+
"@typescript-eslint/eslint-plugin": "^4.9.0",
53+
"@typescript-eslint/parser": "^4.9.0",
5254
"broccoli-merge-trees": "^4.2.0",
5355
"documentation": "^13.0.2",
5456
"ember-cli": "~3.20.0",
@@ -67,14 +69,15 @@
6769
"ember-source": "~3.20.4",
6870
"ember-source-channel-url": "^2.0.1",
6971
"ember-try": "^1.4.0",
70-
"eslint": "^6.8.0",
72+
"eslint": "^7.14.0",
7173
"eslint-config-prettier": "^6.15.0",
7274
"eslint-plugin-disable-features": "^0.1.3",
7375
"eslint-plugin-node": "^11.1.0",
74-
"eslint-plugin-prettier": "^3.1.4",
76+
"eslint-plugin-prettier": "^3.2.0",
7577
"fs-extra": "^9.0.1",
7678
"loader.js": "^4.7.0",
77-
"prettier": "^2.1.2",
79+
"npm-run-all": "^4.1.5",
80+
"prettier": "^2.2.1",
7881
"qunit": "^2.13.0",
7982
"release-it": "^14.2.1",
8083
"release-it-lerna-changelog": "^3.1.0",

0 commit comments

Comments
 (0)