Skip to content

Commit

Permalink
chore: strict nullchecks for parser bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 25, 2023
1 parent 7a0f8d7 commit 6bd8a3e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 70 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@swc/core": "^1.3.24",
"@types/inquirer": "^8.2.0",
"@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.47.1",
"chai": "^4.3.7",
"eslint": "^8.32.0",
Expand Down
5 changes: 3 additions & 2 deletions src/commands/schema/generate/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ export default class FieldGenerate extends SfCommand<FieldGenerateResult> {
{
type: 'number',
message: messages.getMessage('prompts.precision'),
validate: (n: number, answers: Response) => integerValidation(n, 1, 18 - answers.scale),
validate: (n: number, answers: Response) =>
answers.scale ? integerValidation(n, 1, 18 - answers.scale) : undefined,
name: 'precision',
when: (answers: Response) => ['Number', 'Currency'].includes(answers.type),
default: (answers: Response) => 18 - answers.scale,
default: (answers: Response) => (answers.scale ? 18 - answers.scale : undefined),
},
// non-fieldtype-specific questions
descriptionPrompt,
Expand Down
1 change: 1 addition & 0 deletions src/shared/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const writeObjectFile = async (
objectDirectory: string,
object: SaveablePlatformEvent | SaveableCustomObject
): Promise<string> => {
if (!object.fullName) throw new Error('object.fullName is required to write an object file');
await fs.promises.mkdir(path.join(objectDirectory, object.fullName), { recursive: true });
const targetFile = path.join(objectDirectory, object.fullName, `${object.fullName}.object-meta.xml`);
await fs.promises.writeFile(targetFile, convertJsonToXml({ json: object, type: 'CustomObject' }));
Expand Down
2 changes: 1 addition & 1 deletion src/shared/prompts/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const namePrompts = (label: string): Array<Question | ListQuestion> => [
},
{
type: 'input',
when: (answers: { nameFieldType: 'AutoNumber' | 'Text' }) => answers.nameFieldType === 'AutoNumber',
when: (answers) => answers.nameFieldType === 'AutoNumber',
message: messages.getMessage('nameFieldPrompts.autoNumberFormat'),
name: 'autoNumberFormat',
default: `${label}-{0}`,
Expand Down
5 changes: 3 additions & 2 deletions src/shared/prompts/relationshipField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export const relationshipFieldPrompts = async ({
type: 'input',
name: 'relationshipName',
message: 'Relationship name',
default: (answers: RelationshipFieldProperties) => makeNameApiCompatible(answers.relationshipLabel),
default: (answers: RelationshipFieldProperties) =>
answers.relationshipLabel ? makeNameApiCompatible(answers.relationshipLabel) : undefined,
},
// lookup-only
{
Expand Down Expand Up @@ -100,6 +101,6 @@ export const relationshipFieldPrompts = async ({

return {
...response,
referenceTo: response.referenceTo.split(path.sep).pop(),
referenceTo: response.referenceTo?.split(path.sep).pop(),
};
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@salesforce/dev-config/tsconfig",
"extends": "@salesforce/dev-config/tsconfig-strict",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
Expand Down
78 changes: 15 additions & 63 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1420,14 +1420,14 @@
"@types/expect" "^1.20.4"
"@types/node" "*"

"@typescript-eslint/eslint-plugin@^5.44.0":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.44.0.tgz#105788f299050c917eb85c4d9fd04b089e3740de"
integrity sha512-j5ULd7FmmekcyWeArx+i8x7sdRHzAtXTkmDPthE4amxZOWKFK7bomoJ4r7PJ8K7PoMzD16U8MmuZFAonr1ERvw==
dependencies:
"@typescript-eslint/scope-manager" "5.44.0"
"@typescript-eslint/type-utils" "5.44.0"
"@typescript-eslint/utils" "5.44.0"
"@typescript-eslint/eslint-plugin@^5.49.0":
version "5.49.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.49.0.tgz#d0b4556f0792194bf0c2fb297897efa321492389"
integrity sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==
dependencies:
"@typescript-eslint/scope-manager" "5.49.0"
"@typescript-eslint/type-utils" "5.49.0"
"@typescript-eslint/utils" "5.49.0"
debug "^4.3.4"
ignore "^5.2.0"
natural-compare-lite "^1.4.0"
Expand All @@ -1445,14 +1445,6 @@
"@typescript-eslint/typescript-estree" "5.47.1"
debug "^4.3.4"

"@typescript-eslint/[email protected]":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.44.0.tgz#988c3f34b45b3474eb9ff0674c18309dedfc3e04"
integrity sha512-2pKml57KusI0LAhgLKae9kwWeITZ7IsZs77YxyNyIVOwQ1kToyXRaJLl+uDEXzMN5hnobKUOo2gKntK9H1YL8g==
dependencies:
"@typescript-eslint/types" "5.44.0"
"@typescript-eslint/visitor-keys" "5.44.0"

"@typescript-eslint/[email protected]":
version "5.47.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz#0d302b3c2f20ab24e4787bf3f5a0d8c449b823bd"
Expand All @@ -1469,21 +1461,16 @@
"@typescript-eslint/types" "5.49.0"
"@typescript-eslint/visitor-keys" "5.49.0"

"@typescript-eslint/type-utils@5.44.0":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.44.0.tgz#bc5a6e8a0269850714a870c9268c038150dfb3c7"
integrity sha512-A1u0Yo5wZxkXPQ7/noGkRhV4J9opcymcr31XQtOzcc5nO/IHN2E2TPMECKWYpM3e6olWEM63fq/BaL1wEYnt/w==
"@typescript-eslint/type-utils@5.49.0":
version "5.49.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.49.0.tgz#8d5dcc8d422881e2ccf4ebdc6b1d4cc61aa64125"
integrity sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==
dependencies:
"@typescript-eslint/typescript-estree" "5.44.0"
"@typescript-eslint/utils" "5.44.0"
"@typescript-eslint/typescript-estree" "5.49.0"
"@typescript-eslint/utils" "5.49.0"
debug "^4.3.4"
tsutils "^3.21.0"

"@typescript-eslint/[email protected]":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.44.0.tgz#f3f0b89aaff78f097a2927fe5688c07e786a0241"
integrity sha512-Tp+zDnHmGk4qKR1l+Y1rBvpjpm5tGXX339eAlRBDg+kgZkz9Bw+pqi4dyseOZMsGuSH69fYfPJCBKBrbPCxYFQ==

"@typescript-eslint/[email protected]":
version "5.47.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.47.1.tgz#459f07428aec5a8c4113706293c2ae876741ac8e"
Expand All @@ -1494,19 +1481,6 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.49.0.tgz#ad66766cb36ca1c89fcb6ac8b87ec2e6dac435c3"
integrity sha512-7If46kusG+sSnEpu0yOz2xFv5nRz158nzEXnJFCGVEHWnuzolXKwrH5Bsf9zsNlOQkyZuk0BZKKoJQI+1JPBBg==

"@typescript-eslint/[email protected]":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.44.0.tgz#0461b386203e8d383bb1268b1ed1da9bc905b045"
integrity sha512-M6Jr+RM7M5zeRj2maSfsZK2660HKAJawv4Ud0xT+yauyvgrsHu276VtXlKDFnEmhG+nVEd0fYZNXGoAgxwDWJw==
dependencies:
"@typescript-eslint/types" "5.44.0"
"@typescript-eslint/visitor-keys" "5.44.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/[email protected]":
version "5.47.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz#b9d8441308aca53df7f69b2c67a887b82c9ed418"
Expand All @@ -1533,21 +1507,7 @@
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/[email protected]":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.44.0.tgz#d733da4d79d6c30f1a68b531cdda1e0c1f00d52d"
integrity sha512-fMzA8LLQ189gaBjS0MZszw5HBdZgVwxVFShCO3QN+ws3GlPkcy9YuS3U4wkT6su0w+Byjq3mS3uamy9HE4Yfjw==
dependencies:
"@types/json-schema" "^7.0.9"
"@types/semver" "^7.3.12"
"@typescript-eslint/scope-manager" "5.44.0"
"@typescript-eslint/types" "5.44.0"
"@typescript-eslint/typescript-estree" "5.44.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
semver "^7.3.7"

"@typescript-eslint/utils@^5.48.1":
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^5.48.1":
version "5.49.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.49.0.tgz#1c07923bc55ff7834dfcde487fff8d8624a87b32"
integrity sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==
Expand All @@ -1561,14 +1521,6 @@
eslint-utils "^3.0.0"
semver "^7.3.7"

"@typescript-eslint/[email protected]":
version "5.44.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.44.0.tgz#10740dc28902bb903d12ee3a005cc3a70207d433"
integrity sha512-a48tLG8/4m62gPFbJ27FxwCOqPKxsb8KC3HkmYoq2As/4YyjQl1jDbRr1s63+g4FS/iIehjmN3L5UjmKva1HzQ==
dependencies:
"@typescript-eslint/types" "5.44.0"
eslint-visitor-keys "^3.3.0"

"@typescript-eslint/[email protected]":
version "5.47.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz#d35c2da544dbb685db9c5b5b85adac0a1d74d1f2"
Expand Down

0 comments on commit 6bd8a3e

Please sign in to comment.