diff --git a/eslint.config.js b/eslint.config.js index 5e6b472..332a882 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -3,21 +3,31 @@ import globals from 'globals' import reactHooks from 'eslint-plugin-react-hooks' import reactRefresh from 'eslint-plugin-react-refresh' import tseslint from 'typescript-eslint' -import { defineConfig, globalIgnores } from 'eslint/config' -export default defineConfig([ - globalIgnores(['dist']), +export default tseslint.config( + { + ignores: ['dist'], + }, { - files: ['**/*.{ts,tsx}'], extends: [ js.configs.recommended, tseslint.configs.recommended, - reactHooks.configs.flat.recommended, - reactRefresh.configs.vite, ], + files: ['**/*.{ts,tsx}'], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, }, -]) +) diff --git a/src/builders/EnvBuilder.ts b/src/builders/EnvBuilder.ts index 3bb1efe..98068be 100644 --- a/src/builders/EnvBuilder.ts +++ b/src/builders/EnvBuilder.ts @@ -34,7 +34,7 @@ export class EnvBuilder implements IBuilder { private params(): this { const tag = ``; - for (let p of this.src.params) { + for (const p of this.src.params) { this.stack.push(this.ident); this.stack.push(tag .replace("{name}", p.name ?? "!ERR!") diff --git a/src/builders/index.ts b/src/builders/index.ts index 166618d..351090e 100644 --- a/src/builders/index.ts +++ b/src/builders/index.ts @@ -11,7 +11,7 @@ export interface IBuilder { export class Builder { public static getEnv(env: Env): IBuilder { - let b = new EnvBuilder(); + const b = new EnvBuilder(); b.src = env; return b; }; diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index c968482..0f2b4d1 100644 --- a/src/components/ui/Button.tsx +++ b/src/components/ui/Button.tsx @@ -8,7 +8,6 @@ interface ButtonProps extends ButtonHTMLAttributes { variant?: ButtonVariant; size?: ButtonSize; icon?: LucideIcon; - iconPosition?: 'left' | 'right'; isLoading?: boolean; } @@ -33,7 +32,6 @@ export const Button = forwardRef( variant = 'primary', size = 'md', icon: Icon, - iconPosition = 'left', isLoading = false, disabled, children, diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx index 9d4b9a3..911f413 100644 --- a/src/components/ui/Card.tsx +++ b/src/components/ui/Card.tsx @@ -34,7 +34,7 @@ export const Card = forwardRef( Card.displayName = 'Card'; -interface CardHeaderProps extends HTMLAttributes {} +type CardHeaderProps = HTMLAttributes; export const CardHeader = forwardRef( ({ className = '', children, ...props }, ref) => { @@ -52,7 +52,7 @@ export const CardHeader = forwardRef( CardHeader.displayName = 'CardHeader'; -interface CardBodyProps extends HTMLAttributes {} +type CardBodyProps = HTMLAttributes; export const CardBody = forwardRef( ({ className = '', children, ...props }, ref) => { @@ -66,7 +66,7 @@ export const CardBody = forwardRef( CardBody.displayName = 'CardBody'; -interface CardFooterProps extends HTMLAttributes {} +type CardFooterProps = HTMLAttributes; export const CardFooter = forwardRef( ({ className = '', children, ...props }, ref) => { diff --git a/src/models/Config.tsx b/src/models/Config.tsx index e17991d..407c824 100644 --- a/src/models/Config.tsx +++ b/src/models/Config.tsx @@ -97,7 +97,7 @@ export class Config { * Updates template by adding placeholders for environment params */ public updateTemplateFromEnv(env: Env): void { - let templateObj: Record = {}; + let templateObj: Record = {}; // Try to parse existing template try { diff --git a/src/test/ConfigReader.test.ts b/src/test/ConfigReader.test.ts index ec782db..c1774c9 100644 --- a/src/test/ConfigReader.test.ts +++ b/src/test/ConfigReader.test.ts @@ -36,8 +36,8 @@ const cfgTemplate = ` test("read from a file", async ({expect})=>{ - let sut = new ConfigReader(); - let file = new File([cfgTemplate],'cfg.json.xml',{type:'application/xml'}); + const sut = new ConfigReader(); + const file = new File([cfgTemplate],'cfg.json.xml',{type:'application/xml'}); // define a missing jsdom text() function, // that presents in the real DOM @@ -46,15 +46,15 @@ test("read from a file", async ({expect})=>{ writable: true }); - let cfg = await sut.parseFromFile(file); + const cfg = await sut.parseFromFile(file); expect(cfg).not.toBeUndefined(); }); test("load environments and params", ({expect})=>{ - let sut = new ConfigReader(); + const sut = new ConfigReader(); - let cfg = sut.parseFromString(cfgTemplate); + const cfg = sut.parseFromString(cfgTemplate); expect(cfg?.envs).toHaveLength(3); expect(cfg?.envs.map(x=>x.name)) @@ -64,9 +64,9 @@ test("load environments and params", ({expect})=>{ }); test("load template", ({expect})=>{ - let sut = new ConfigReader(); + const sut = new ConfigReader(); - let cfg = sut.parseFromString(cfgTemplate); + const cfg = sut.parseFromString(cfgTemplate); expect(cfg?.template).toBeDefined(); expect(cfg?.template.content.length).toBeGreaterThan(20);