Skip to content

Commit

Permalink
fix: remove duplicated defaults from schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkenj1 committed Apr 9, 2024
1 parent 68c69e3 commit 25b63e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/config/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { object, string, boolean, date, InferType } from 'yup';

export const tagSchema = object({
tags: object({
dev: boolean().default(false),
notice: boolean().default(true),
param: boolean().default(true),
dev: boolean().required().strict(),
notice: boolean().required().strict(),
param: boolean().required().strict(),
}),
});

export const functionSchema = object({
tags: object({
dev: boolean().default(false),
notice: boolean().default(true),
param: boolean().default(true),
return: boolean().default(true),
dev: boolean().required().strict(),
notice: boolean().required().strict(),
param: boolean().required().strict(),
return: boolean().required().strict(),
}),
});

Expand All @@ -25,14 +25,14 @@ export const functionConfigSchema = object({
});

export const configSchema = object({
include: string().strict().required(),
exclude: string().strict().default(''),
root: string().strict().default('./'),
include: string().required().strict(),
exclude: string().strict().optional(),
root: string().required().strict(),
functions: functionConfigSchema,
events: tagSchema,
errors: tagSchema,
modifiers: tagSchema,
structs: tagSchema,
inheritdoc: boolean().default(true),
constructorNatspec: boolean().default(false),
inheritdoc: boolean().required().strict(),
constructorNatspec: boolean().required().strict(),
});
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Config } from './types';

export const defaultConfig: Readonly<Config> = {
include: './**/*.sol',
exclude: '',
exclude: undefined,
root: './',
functions: {
internal: { tags: { dev: false, notice: true, return: true, param: true } },
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getConfig } from './config';
const config: Config = getConfig(configPath);

// TODO: Add configuration logic to the linter
const excludedPaths = config.exclude === '' ? [] : await glob(config.exclude, { cwd: config.root });
const excludedPaths = !config.exclude ? [] : await glob(config.exclude, { cwd: config.root });
const includedPaths = await glob(config.include, { cwd: config.root, ignore: excludedPaths });

const sourceUnits = await getProjectCompiledSources(config.root, includedPaths);
Expand Down

0 comments on commit 25b63e9

Please sign in to comment.