Skip to content

Commit

Permalink
Few more lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
guyca committed Jan 6, 2025
1 parent 429b03d commit 578aa7e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin-obsidian/src/dto/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class File {
}

findClass(byName: string) {
const clazz = this.classes.find(($clazz) => $clazz.name === byName);
const clazz = this.classes.find($clazz => $clazz.name === byName);
return clazz && new ClassFile(clazz, this.imports, this.path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class ClassResolver {
constructor(private fileReader: FileReader) { }

public resolve(clazz: string, from: ClassFile) {
const classPath = from.imports.find(($import) => $import.includes(clazz));
const classPath = from.imports.find($import => $import.includes(clazz));
return classPath && this.fileReader.read(from.path, classPath.path).findClass(clazz);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ export class DependencyResolver {
private getDependenciesFromSubgraphs(clazz: ClassFile): string[] {
return this.subgraphResolver
.resolve(clazz)
.flatMap(this.getGraphDependencies);
.flatMap((clazz) => this.getGraphDependencies(clazz));

Check failure on line 26 in packages/eslint-plugin-obsidian/src/rules/unresolvedProviderDependencies/dependencyResolver.ts

View workflow job for this annotation

GitHub Actions / build (18)

Unexpected parentheses around single function argument having a body with no curly braces

Check failure on line 26 in packages/eslint-plugin-obsidian/src/rules/unresolvedProviderDependencies/dependencyResolver.ts

View workflow job for this annotation

GitHub Actions / build (18)

'clazz' is already declared in the upper scope on line 23 column 40
}

private getGraphDependencies({ clazz }: ClassFile) {
return clazz.mapDecoratedMethods('Provides', (method) => method.name) ?? [];
return clazz.mapDecoratedMethods('Provides', method => method.name) ?? [];
}

private getDependenciesFromSuperClass(clazz: ClassFile) {
if (!clazz.superClass || clazz.superClass === 'ObjectGraph') return [];
return this.classResolver
.resolve(clazz.superClass, clazz)
?.clazz
?.mapDecoratedMethods('Provides', (method) => method.name) ?? [];
?.mapDecoratedMethods('Provides', method => method.name) ?? [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class SubgraphResolver {
...this.getLocalGraphs(clazz),
...this.getExtendedGraphs(clazz),
]
.filter(nonNull)
.flatMap((g) => [g, ...this.resolve(g)]);
.filter(nonNull)
.flatMap(g => [g, ...this.resolve(g)]);
}

private getImportedGraphs(clazz: ClassFile) {
Expand Down Expand Up @@ -49,7 +49,7 @@ export class SubgraphResolver {
return [this.classResolver.resolve(clazz.superClass, clazz)];
}

private getSubgraphsPropertyFromGraphDecorator({clazz}: ClassFile) {
private getSubgraphsPropertyFromGraphDecorator({ clazz }: ClassFile) {
if (clazz.isAbstract) return undefined;
const graphDecorator = clazz.requireDecoratorIgnoreCase('Graph');
return graphDecorator.getProperty('subgraphs');
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-obsidian/src/utils/filter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function nonNull<T>(value: T): value is NonNullable<typeof value> {
return value !== undefined;
}
return value !== undefined;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ObjectGraph, Provides } from "react-obsidian";
import { ObjectGraph, Provides } from 'react-obsidian';

export abstract class AbstractGraph extends ObjectGraph {
@Provides()
bar(): string {
return "bar";
return 'bar';
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Graph, Provides } from "react-obsidian";
import { AbstractGraph } from "./abstractGraph";
import { Graph, Provides } from 'react-obsidian';
import { AbstractGraph } from './abstractGraph';

@Graph()
export abstract class GraphThatExtendsAnotherGraph extends AbstractGraph {
@Provides()
baz(): string {
return "baz";
return 'baz';
}
}

0 comments on commit 578aa7e

Please sign in to comment.