Skip to content
Open
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'eslint-config-salesforce-typescript';
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@
"devDependencies": {
"@jsforce/jsforce-node": "^3.10.19",
"@salesforce/cli-plugins-testkit": "^5.3.58",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/dev-scripts": "^13.0.2",
"@types/chai": "^4.3.17",
"@types/deep-equal-in-any-order": "^1.0.1",
"@types/fast-levenshtein": "^0.0.4",
"@types/graceful-fs": "^4.1.9",
"@types/mime": "2.0.3",
"@types/minimatch": "^5.1.2",
"@types/mocha": "^10.0.10",
"@types/node": "^18",
"@types/sinon": "^10.0.20",
"deep-equal-in-any-order": "^1.1.19",
"esbuild": "^0.28.0",
"eslint": "^10.4.0",
"eslint-config-salesforce-typescript": "^6.0.0",
"eslint-plugin-sf-plugin": "^1.20.33",
"mocha": "^11.7.5",
"mocha-junit-reporter": "^1.23.3",
Expand Down Expand Up @@ -135,6 +141,7 @@
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/eslint.config.*",
"**/.eslint*",
"**/tsconfig.json"
],
Expand Down
2 changes: 1 addition & 1 deletion src/client/retrieveExtract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export async function filterAgentComponents(
if (comp.pathContentMap && comp.xml) {
comp.pathContentMap.set(comp.xml, xmlContent);
// Store normalized structure in WeakMap for this component
normalizedBotXmlMap.set(comp, normalizedBotXml as JsonMap);
normalizedBotXmlMap.set(comp, normalizedBotXml);

// Intercept parseXml to return normalized structure for Bot components
const originalParseXml = comp.parseXml.bind(comp);
Expand Down
2 changes: 1 addition & 1 deletion src/collections/componentSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
});
const toParse = await this.getObject(destructiveType);
toParse.Package[XML_NS_KEY] = XML_NS_URL;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return XML_DECL.concat(builder.build(toParse));
}

Expand Down
2 changes: 1 addition & 1 deletion src/convert/convertContext/convertContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ConvertContext {
public readonly decomposedPermissionSet = new DecomposedPermissionSetFinalizer();
public readonly decomposedExternalServiceRegistration = new DecomposedExternalServiceRegistrationFinalizer();

// eslint-disable-next-line @typescript-eslint/require-await
public async *executeFinalizers(defaultDirectory?: string): AsyncIterable<WriterFormat[]> {
for (const member of Object.values(this)) {
if (member instanceof ConvertTransactionFinalizer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class DecomposedExternalServiceRegistrationFinalizer extends ConvertTrans
public transactionState: ExternalServiceRegistrationState = {
esrRecords: new Map<string, ExternalServiceRegistration>(),
};
// eslint-disable-next-line class-methods-use-this
public defaultDir: string | undefined;

public finalize(defaultDirectory: string | undefined): Promise<WriterFormat[]> {
Expand Down
2 changes: 1 addition & 1 deletion src/convert/isBinaryFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function isBinaryProto(fileBuffer: Buffer, totalBytes: number): boolean {
const reader = new Reader(fileBuffer, totalBytes);
let numMessages = 0;

// eslint-disable-next-line no-constant-condition
while (true) {
// Definitely not a valid protobuf
if (!readProtoMessage(reader) && !reader.hasError()) {
Expand Down
2 changes: 1 addition & 1 deletion src/convert/replacements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const replacementIterations = async (
await lifecycleInstance.emit('replacement', {
filename: replacement.matchedFilename,
replaced: replacement.toReplace.toString(),
} as ReplacementEvent);
});
}
// No warning here; warnings are handled in ReplacementStream._flush
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class DecomposeExternalServiceRegistrationTransformer extends BaseMetadat
processEntities: true,
indentBy: ' ',
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const source = xmlBuilder.build({ ExternalServiceRegistration: xmlContent });
writeInfos.push({
source: Readable.from(Buffer.from(xmlDeclaration + source)),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/decomposed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const unwrapAndOmitNS =

/** Remove the namespace key from the json object. Only the parent needs one */
const omitNsKey = (obj: JsonMap): JsonMap =>
Object.fromEntries(Object.entries(obj).filter(([key]) => key !== XML_NS_KEY)) as JsonMap;
Object.fromEntries(Object.entries(obj).filter(([key]) => key !== XML_NS_KEY));

const unwrapXml =
(outerType: string) =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/filePathGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const registryAccess = new RegistryAccess();
* @param packageDir optional package directory to apply to the file paths
* @returns array of file paths
*/
// eslint-disable-next-line complexity
export const filePathsFromMetadataComponent = (
{ fullName, type }: MetadataComponent,
packageDir?: string
Expand Down
2 changes: 1 addition & 1 deletion src/utils/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function parseNestedFullName(fsPath: string, directoryName: string): stri
}
const pathPrefix = pathSplits.slice(pathSplits.lastIndexOf(directoryName) + 1);
// the eslint comment should remain until strictMode is fully implemented
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const fileName = (pathSplits.pop() as string).replace('-meta.xml', '').split('.')[0];
pathPrefix[pathPrefix.length - 1] = fileName;
return pathPrefix.join('/');
Expand Down
26 changes: 0 additions & 26 deletions test/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion test/client/metadataApiDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('MetadataApiDeploy', () => {
const poll = (): Promise<StatusResult> =>
Promise.resolve({
completed: true,
payload: {} as AnyJson,
payload: {},
});

await operation.start();
Expand Down
12 changes: 6 additions & 6 deletions test/client/metadataTransfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ describe('MetadataTransfer', () => {
post: $$.SANDBOX.stub().returns({ id: '1' }),
cancel: $$.SANDBOX.stub().returns(true),
};
// eslint-disable-next-line @typescript-eslint/require-await
public async checkStatus(): Promise<MetadataRequestStatus> {
return this.lifecycle.checkStatus();
}

// eslint-disable-next-line @typescript-eslint/require-await
public async cancel(): Promise<void> {
this.canceled = this.lifecycle.cancel();
}

// eslint-disable-next-line @typescript-eslint/require-await
protected async pre(): Promise<{ id: string }> {
return this.lifecycle.pre();
}

// eslint-disable-next-line @typescript-eslint/require-await
protected async post(): Promise<MetadataTransferResult> {
return this.lifecycle.post();
}
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('MetadataTransfer', () => {
callOrder.push('firstCall2');
return { done: false };
});
// eslint-disable-next-line @typescript-eslint/require-await
checkStatus.onSecondCall().callsFake(async () => {
callOrder.push('secondCall1');
return { done: true };
Expand All @@ -243,7 +243,7 @@ describe('MetadataTransfer', () => {
// until the timeout is exceeded.
const { checkStatus } = operation.lifecycle;
let callCount = 0;
// eslint-disable-next-line @typescript-eslint/require-await
checkStatus.callsFake(async () => {
callCount += 1;
if (callCount > 22) {
Expand Down
10 changes: 5 additions & 5 deletions test/convert/convertContext/recomposition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('Recomposition', () => {
children: [
{
name: labelsFileName,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(labelsXmls[0]).read().toString()),
},
],
Expand All @@ -235,7 +235,7 @@ describe('Recomposition', () => {
children: [
{
name: labelsFileName,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(labelsXmls[1]).read().toString()),
},
],
Expand Down Expand Up @@ -324,7 +324,7 @@ describe('Recomposition', () => {
children: [
{
name: labelsFileName,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(labelsXml).read().toString()),
},
],
Expand All @@ -334,7 +334,7 @@ describe('Recomposition', () => {
children: [
{
name: labelsFileName,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(labelsXml).read().toString()),
},
],
Expand All @@ -344,7 +344,7 @@ describe('Recomposition', () => {
children: [
{
name: labelsFileName,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(labelsXml).read().toString()),
},
],
Expand Down
6 changes: 3 additions & 3 deletions test/convert/streams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const registryAccess = new RegistryAccess();

class TestTransformer extends BaseMetadataTransformer {
// partial implementation only for tests
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this, @typescript-eslint/require-await
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
public async toMetadataFormat(component: SourceComponent): Promise<WriteInfo[]> {
return [{ output: '/type/file.m', source: new Readable() }];
}
// partial implementation only for tests
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/require-await
// eslint-disable-next-line class-methods-use-this
public async toSourceFormat({ mergeWith }: ToSourceFormatInput): Promise<WriteInfo[]> {
const output = mergeWith ? mergeWith.content ?? mergeWith.xml : '/type/file.s';
assert(output);
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('Streams', () => {
myComp.setMarkedForDelete();
const converter = new streams.ComponentConverter('source', registryAccess);

// eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/require-await
// eslint-disable-next-line @typescript-eslint/no-misused-promises
converter._transform(myComp, '', async (err: Error | undefined, data: WriterFormat) => {
try {
expect(err).to.be.undefined;
Expand Down
2 changes: 1 addition & 1 deletion test/mock/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import JSZip from 'jszip';

// eslint-disable-next-line @typescript-eslint/require-await
export async function createMockZip(entries: string[]): Promise<Buffer> {
const zip = JSZip();
for (const entry of entries) {
Expand Down
6 changes: 3 additions & 3 deletions test/mock/type-constants/customlabelsConstant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,20 @@ export const VIRTUAL_DIR: VirtualDirectory[] = [
{ dirPath: NON_DEFAULT_DIR, children: [join(NON_DEFAULT_DIR, COMPONENT_2_TYPE_DIR)] },
{
dirPath: COMPONENT_1_TYPE_DIR,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
children: [{ name: XML_NAME, data: Buffer.from(new JsToXml(COMPONENT_1_XML).read().toString()) }],
},
{
dirPath: COMPONENT_2_TYPE_DIR,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
children: [{ name: XML_NAME, data: Buffer.from(new JsToXml(COMPONENT_2_XML).read().toString()) }],
},
{
dirPath: MATCHING_RULES_COMPONENT_DIR,
children: [
{
name: MATCHING_RULES_XML_NAME,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
data: Buffer.from(new JsToXml(MATCHING_RULES_COMPONENT_XML).read().toString()),
},
],
Expand Down
2 changes: 1 addition & 1 deletion test/resolve/adapters/decomposedSourceAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('DecomposedSourceAdapter', () => {
seed: path,
deny: [path],
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const adapter = new DecomposedSourceAdapter(type, registryAccess, forceIgnore, tree);
const result = adapter.getComponent(path);
expect(result).to.not.be.undefined;
Expand Down
18 changes: 9 additions & 9 deletions test/resolve/adapters/uiBundlesSourceAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,23 @@ describe('UiBundlesSourceAdapter', () => {

describe('Types & Formats', () => {
it('apiVersion is unknown property - skipped', () => {
expectValidationSkipped({ apiVersion: '66.0' } as unknown as object);
expectValidationSkipped({ apiVersion: '66.0' });
});

it('outputDir empty string - skipped', () => {
expectValidationSkipped({ outputDir: '' });
});

it('outputDir wrong type - skipped', () => {
expectValidationSkipped({ outputDir: 123 } as unknown as object);
expectValidationSkipped({ outputDir: 123 });
});

it('routing wrong type - skipped', () => {
expectValidationSkipped({ routing: 'invalid' } as unknown as object);
expectValidationSkipped({ routing: 'invalid' });
});

it('headers wrong type - skipped', () => {
expectValidationSkipped({ headers: 'invalid' } as unknown as object);
expectValidationSkipped({ headers: 'invalid' });
});

it('trailingSlash invalid - skipped', () => {
Expand All @@ -258,7 +258,7 @@ describe('UiBundlesSourceAdapter', () => {
expectValidationSkipped({
outputDir: 'dist',
routing: { redirects: [{ route: '/a', redirect: '/b', statusCode: 200 }] },
} as unknown as object);
});
});
});

Expand Down Expand Up @@ -567,7 +567,7 @@ describe('UiBundlesSourceAdapter', () => {
});

it('additional property at root - skipped', () => {
expectValidationSkipped({ outputDir: 'src', customField: 'x' } as unknown as object);
expectValidationSkipped({ outputDir: 'src', customField: 'x' });
});

it('non-empty strings for route/rewrite - pass', () => {
Expand All @@ -581,16 +581,16 @@ describe('UiBundlesSourceAdapter', () => {
describe('error message quality (VirtualTreeContainer — validation skipped)', () => {
it('no validation errors are produced for any invalid input', () => {
const cases: Array<{ input: object | string; options?: Parameters<typeof buildTree>[1] }> = [
{ input: { outputDir: 123 } as unknown as object },
{ input: { outputDir: 123 } },
{ input: { routing: { trailingSlash: 'sometimes' } } },
{
input: { routing: { redirects: [{ route: '/a', redirect: '/b', statusCode: 200 }] } } as unknown as object,
input: { routing: { redirects: [{ route: '/a', redirect: '/b', statusCode: 200 }] } },
},
{
input: { outputDir: 'dist', routing: { rewrites: [{ rewrite: 'missing.html' }] } },
options: { outputDir: 'dist', outputDirFiles: ['other.html'] },
},
{ input: { outputDir: 'src', foo: 1, bar: 2 } as unknown as object },
{ input: { outputDir: 'src', foo: 1, bar: 2 } },
{ input: '[1,2,3]' },
{ input: {} },
{ input: { outputDir: 'dist' }, options: { outputDir: 'dist', includeOutputDir: false } },
Expand Down
Loading
Loading