Skip to content

Commit

Permalink
style: linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gas1cent committed Jan 12, 2024
1 parent dae8260 commit 3ecbe86
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion example-natspec-smells.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
/** @type {import('@defi-wonderland/natspec-smells').UserConfig} */
module.exports = {
contracts: 'solidity',
ignore: ['tests', 'scripts']
ignore: ['tests', 'scripts'],
};
24 changes: 12 additions & 12 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { InternalConfig, UserConfig } from "./types/config";
import { InternalConfig, UserConfig } from './types/config';

export async function getConfig(configPath: string): Promise<InternalConfig> {
const configModule = await import(configPath);
const userConfig: UserConfig = 'default' in configModule ? configModule.default : configModule;
if (!userConfig.contracts) throw new Error('Config must specify a root directory');
const configModule = await import(configPath);
const userConfig: UserConfig = 'default' in configModule ? configModule.default : configModule;
if (!userConfig.contracts) throw new Error('Config must specify a root directory');

return {
contracts: userConfig.contracts,
root: userConfig.root || './',
enforceInheritdoc: userConfig.enforceInheritdoc ?? true,
constructorNatspec: userConfig.constructorNatspec ?? false,
ignore: userConfig.ignore || []
}
}
return {
contracts: userConfig.contracts,
root: userConfig.root || './',
enforceInheritdoc: userConfig.enforceInheritdoc ?? true,
constructorNatspec: userConfig.constructorNatspec ?? false,
ignore: userConfig.ignore || [],
};
}
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { UserConfig } from './types/config';
export { UserConfig } from './types/config';
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ function getArguments() {
},
})
.parseSync();
}
}
20 changes: 10 additions & 10 deletions src/types/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export interface UserConfig {
include: string; // Required: Glob pattern of files to process.
exclude?: string[]; // Optional: Glob patterns of files to exclude.
root?: string; // Optional: The target root directory.
enforceInheritdoc?: boolean; // Optional: If set to true, all external and public functions must have @inheritdoc.
constructorNatspec?: boolean; // Optional: True if constructor natspec is mandatory.
include: string; // Required: Glob pattern of files to process.
exclude?: string[]; // Optional: Glob patterns of files to exclude.
root?: string; // Optional: The target root directory.
enforceInheritdoc?: boolean; // Optional: If set to true, all external and public functions must have @inheritdoc.
constructorNatspec?: boolean; // Optional: True if constructor natspec is mandatory.
}

// Config type after all the default values are applied
export interface InternalConfig {
include: string;
exclude: string[];
root: string;
enforceInheritdoc: boolean;
constructorNatspec: boolean;
include: string;
exclude: string[];
root: string;
enforceInheritdoc: boolean;
constructorNatspec: boolean;
}

0 comments on commit 3ecbe86

Please sign in to comment.