Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
feat: update typescript version (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley authored Jan 28, 2021
1 parent d08423b commit 399a0b0
Show file tree
Hide file tree
Showing 29 changed files with 216 additions and 87 deletions.
4 changes: 2 additions & 2 deletions packages/dev-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": ["es2017"],
"target": "es2019",
"lib": ["es2019"],
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"ts-node": "^8.10.2",
"typedoc": "~0.18.0",
"typedoc-plugin-external-module-name": "~4.0.0",
"typescript": "^3.9.3",
"typescript": "^4.1.3",
"xunit-file": "^1.0.0"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-salesforce-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"url": "https://github.com/forcedotcom/sfdx-dev-packages/issues"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-salesforce-license": "^0.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/kit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@

module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
rules: {
'@typescript-eslint/ban-types': 'off'
}
};
3 changes: 1 addition & 2 deletions packages/kit/.sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"$schema": "../dev-scripts/sfdevrc.schema.json",
"strict": true
"$schema": "../dev-scripts/sfdevrc.schema.json"
}
6 changes: 3 additions & 3 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.6.3",
"@salesforce/prettier-config": "^0.0.1",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -54,6 +54,6 @@
"pretty-quick": "^2.0.1",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/kit/src/creatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export abstract class AsyncCreatable<O = object> {
*
* @param options An options object providing initialization params to the async constructor.
*/
public static async create<P, T extends AsyncCreatable<P>>(this: new (options: P) => T, options: P): Promise<T> {
public static async create<P, T extends AsyncCreatable<P>>(this: new (opts: P) => T, options: P): Promise<T> {
const instance = new this(options);
await instance.init();
return instance;
Expand Down Expand Up @@ -58,7 +58,7 @@ export abstract class AsyncOptionalCreatable<O = object> {
* @param options An options object providing initialization params to the async constructor.
*/
public static async create<P, T extends AsyncOptionalCreatable<P>>(
this: new (options?: P) => T,
this: new (opts?: P) => T,
options?: P
): Promise<T> {
const instance = new this(options);
Expand Down
1 change: 1 addition & 0 deletions packages/kit/src/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export namespace Duration {
/**
* Units of duration.
*/
// eslint-disable-next-line no-shadow
export enum Unit {
MINUTES,
MILLISECONDS,
Expand Down
4 changes: 3 additions & 1 deletion packages/kit/src/nodash/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../../.eslintrc",
"rules": {
"@typescript-eslint/ban-types": "off"
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off"
}
}
2 changes: 1 addition & 1 deletion packages/kit/src/nodash/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// published in the lodash documentation for that fn.

import { AnyFunction, Dictionary, Many, Nullable, Optional } from '@salesforce/ts-types';
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore ignore the demand for typings for the locally built lodash
import * as _ from '../../vendor/lodash';
import { ListIteratee, NumericDictionary, ObjectIteratee, Omit, ValueIteratee, ValueIterateeCustom } from './support';
Expand Down
1 change: 1 addition & 0 deletions packages/kit/test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
// Easily return a promise in a mocked method.
'@typescript-eslint/require-await': 'off',
'no-shadow': 'off'
},
};
18 changes: 9 additions & 9 deletions packages/kit/test/duration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,33 +214,33 @@ describe('duration', () => {

describe('as strings', () => {
it('should print 0 regardless of unit', () => {
expect(new Duration(0, Duration.Unit.MILLISECONDS) + '').to.equal('0 milliseconds');
expect(new Duration(0, Duration.Unit.SECONDS) + '').to.equal('0 seconds');
expect(new Duration(0, Duration.Unit.MINUTES) + '').to.equal('0 minutes');
expect(new Duration(0, Duration.Unit.MILLISECONDS).toString()).to.equal('0 milliseconds');
expect(new Duration(0, Duration.Unit.SECONDS).toString()).to.equal('0 seconds');
expect(new Duration(0, Duration.Unit.MINUTES).toString()).to.equal('0 minutes');
});
it('should print minute', () => {
const duration = new Duration(1);
expect(duration + '').to.equal('1 minute');
expect(duration.toString()).to.equal('1 minute');
});
it('should print minutes', () => {
const duration = new Duration(2);
expect(duration + '').to.equal('2 minutes');
expect(duration.toString()).to.equal('2 minutes');
});
it('should print second', () => {
const duration = new Duration(1, Duration.Unit.SECONDS);
expect(duration + '').to.equal('1 second');
expect(duration.toString()).to.equal('1 second');
});
it('should print seconds', () => {
const duration = new Duration(2, Duration.Unit.SECONDS);
expect(duration + '').to.equal('2 seconds');
expect(duration.toString()).to.equal('2 seconds');
});
it('should print millisecond', () => {
const duration = new Duration(1, Duration.Unit.MILLISECONDS);
expect(duration + '').to.equal('1 millisecond');
expect(duration.toString()).to.equal('1 millisecond');
});
it('should print millisecond', () => {
const duration = new Duration(2, Duration.Unit.MILLISECONDS);
expect(duration + '').to.equal('2 milliseconds');
expect(duration.toString()).to.equal('2 milliseconds');
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/nodash/external.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('nodash', () => {
describe('mapKeys', () => {
it('should map the keys of an object', () => {
const obj = { a: 1, b: 2 };
const result = _.mapKeys(obj, (value, key) => key + value);
const result = _.mapKeys(obj, (value, key) => `${key}${value}`);
expect(result).to.deep.equal({ a1: 1, b2: 2 });
});
});
Expand Down
7 changes: 7 additions & 0 deletions packages/lazy-require/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@

module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
}
};
3 changes: 1 addition & 2 deletions packages/lazy-require/.sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"$schema": "../dev-scripts/sfdevrc.schema.json",
"strict": true
"$schema": "../dev-scripts/sfdevrc.schema.json"
}
6 changes: 3 additions & 3 deletions packages/lazy-require/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@salesforce/prettier-config": "^0.0.1",
"@salesforce/ts-sinon": "^1.2.4",
"@types/debug": "^0.0.31",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -40,7 +40,7 @@
"pretty-quick": "^2.0.1",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
},
"scripts": {
"build": "sf-build",
Expand Down
2 changes: 1 addition & 1 deletion packages/lazy-require/src/LazyLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// This file does a lot of trickery with low level javascript and proxies. So turn off some eslint features.
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-ts-ignore */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable no-underscore-dangle */

/**
Expand Down
11 changes: 11 additions & 0 deletions packages/require-analytics/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@

module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
rules: {
'no-underscore-dangle': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/ban-types': 'off'
}
};
4 changes: 1 addition & 3 deletions packages/require-analytics/.sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"strict": true
}
{}
6 changes: 3 additions & 3 deletions packages/require-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.6.3",
"@salesforce/prettier-config": "^0.0.1",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -46,7 +46,7 @@
"pretty-quick": "^2.0.1",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
},
"dependencies": {
"tslib": "^1.10.0"
Expand Down
4 changes: 0 additions & 4 deletions packages/require-analytics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

// A simple utility for gathering module loading statistics for diagnostic purposes.

/* eslint-disable no-underscore-dangle */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-explicit-any */

// -------------------------------------------------------------------------------
// No requires or imports so we can instrument as much module loading as possible.
// -------------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions packages/ts-sinon/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@

module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/ban-types': 'off'
}
};
3 changes: 1 addition & 2 deletions packages/ts-sinon/.sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"$schema": "../dev-scripts/sfdevrc.schema.json",
"strict": true
"$schema": "../dev-scripts/sfdevrc.schema.json"
}
6 changes: 3 additions & 3 deletions packages/ts-sinon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.6.3",
"@salesforce/prettier-config": "^0.0.1",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -39,7 +39,7 @@
"pretty-quick": "^2.0.1",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
},
"scripts": {
"build": "sf-build",
Expand Down
1 change: 1 addition & 0 deletions packages/ts-types/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module.exports = {
rules: {
// Define convenient alias types
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-types': 'off'
},
};
6 changes: 3 additions & 3 deletions packages/ts-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.6.3",
"@salesforce/prettier-config": "^0.0.1",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -49,6 +49,6 @@
"pretty-quick": "^2.0.1",
"sinon": "^9.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.3"
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion packages/ts-types/src/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function view<T, K extends string>(value: Nullable<T>, keys: Many<K>): Op
function viewOptional<T, K extends string, R extends T>(
value: Nullable<T>,
key: K,
hasType: (value: Nullable<T>, key: K) => value is R
hasType: (v: Nullable<T>, k: K) => v is R
): Optional<T & ViewOptional<K, R>> {
return hasType(value, key) ? value : hasNull(value, key) ? value : undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-types/src/narrowing/to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function toAnyJson<T>(value: Nullable<T>, defaultValue: AnyJson): AnyJson
// underlying function
export function toAnyJson<T>(value: Nullable<T>, defaultValue?: AnyJson): Optional<AnyJson> {
try {
return value !== undefined ? JSON.parse(JSON.stringify(value)) : defaultValue;
return (value !== undefined ? JSON.parse(JSON.stringify(value)) : defaultValue) as Optional<AnyJson>;
} catch (err) {
throw new JsonCloneError(err);
}
Expand Down
Loading

0 comments on commit 399a0b0

Please sign in to comment.