diff --git a/docs/lint/html/index.md b/docs/lint/html/index.md index 15d693843c0..a0d3ce72dbf 100644 --- a/docs/lint/html/index.md +++ b/docs/lint/html/index.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../lint/README.md) > HTML rules _______ diff --git a/docs/lint/html/rules/themed-component-usages.md b/docs/lint/html/rules/themed-component-usages.md index a04fe1c770a..c6f73e19030 100644 --- a/docs/lint/html/rules/themed-component-usages.md +++ b/docs/lint/html/rules/themed-component-usages.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../../lint/README.md) > [HTML rules](../index.md) > `dspace-angular-html/themed-component-usages` _______ diff --git a/docs/lint/ts/index.md b/docs/lint/ts/index.md index ed060c946e8..c5a27754d24 100644 --- a/docs/lint/ts/index.md +++ b/docs/lint/ts/index.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../lint/README.md) > TypeScript rules _______ diff --git a/docs/lint/ts/rules/themed-component-classes.md b/docs/lint/ts/rules/themed-component-classes.md index 1f4ec72801c..362c6efa76e 100644 --- a/docs/lint/ts/rules/themed-component-classes.md +++ b/docs/lint/ts/rules/themed-component-classes.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../../lint/README.md) > [TypeScript rules](../index.md) > `dspace-angular-ts/themed-component-classes` _______ diff --git a/docs/lint/ts/rules/themed-component-selectors.md b/docs/lint/ts/rules/themed-component-selectors.md index f4d0ea177c9..f6b2c3ec52a 100644 --- a/docs/lint/ts/rules/themed-component-selectors.md +++ b/docs/lint/ts/rules/themed-component-selectors.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../../lint/README.md) > [TypeScript rules](../index.md) > `dspace-angular-ts/themed-component-selectors` _______ diff --git a/docs/lint/ts/rules/themed-component-usages.md b/docs/lint/ts/rules/themed-component-usages.md index 16ccb701c20..d9e570c95b9 100644 --- a/docs/lint/ts/rules/themed-component-usages.md +++ b/docs/lint/ts/rules/themed-component-usages.md @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../../lint/README.md) > [TypeScript rules](../index.md) > `dspace-angular-ts/themed-component-usages` _______ diff --git a/lint/src/rules/html/themed-component-usages.ts b/lint/src/rules/html/themed-component-usages.ts index e907285dbca..b75a259fdda 100644 --- a/lint/src/rules/html/themed-component-usages.ts +++ b/lint/src/rules/html/themed-component-usages.ts @@ -7,11 +7,11 @@ */ import { TmplAstElement } from '@angular-eslint/bundled-angular-compiler'; import { TemplateParserServices } from '@angular-eslint/utils'; -import { ESLintUtils } from '@typescript-eslint/utils'; import { RuleContext } from '@typescript-eslint/utils/ts-eslint'; import { fixture } from '../../../test/fixture'; import { + createHtmlRule, DSpaceESLintRuleInfo, NamedTests, } from '../../util/structure'; @@ -48,7 +48,7 @@ The only exception to this rule are unit tests, where we may want to use the bas defaultOptions: [], } as DSpaceESLintRuleInfo; -export const rule = ESLintUtils.RuleCreator.withoutDocs({ +export const rule = createHtmlRule({ ...info, create(context: RuleContext) { if (getFilename(context).includes('.spec.ts')) { diff --git a/lint/src/rules/ts/themed-component-classes.ts b/lint/src/rules/ts/themed-component-classes.ts index 527655adfa4..7fa84562fd1 100644 --- a/lint/src/rules/ts/themed-component-classes.ts +++ b/lint/src/rules/ts/themed-component-classes.ts @@ -5,10 +5,7 @@ * * http://www.dspace.org/license/ */ -import { - ESLintUtils, - TSESTree, -} from '@typescript-eslint/utils'; +import { TSESTree } from '@typescript-eslint/utils'; import { RuleContext } from '@typescript-eslint/utils/ts-eslint'; import { fixture } from '../../../test/fixture'; @@ -18,7 +15,10 @@ import { getComponentStandaloneNode, } from '../../util/angular'; import { appendObjectProperties } from '../../util/fix'; -import { DSpaceESLintRuleInfo } from '../../util/structure'; +import { + createTsRule, + DSpaceESLintRuleInfo, +} from '../../util/structure'; import { getBaseComponentClassName, inThemedComponentOverrideFile, @@ -55,7 +55,7 @@ export const info = { defaultOptions: [], } as DSpaceESLintRuleInfo; -export const rule = ESLintUtils.RuleCreator.withoutDocs({ +export const rule = createTsRule({ ...info, create(context: RuleContext) { const filename = getFilename(context); diff --git a/lint/src/rules/ts/themed-component-selectors.ts b/lint/src/rules/ts/themed-component-selectors.ts index c27fd66d662..124df803b98 100644 --- a/lint/src/rules/ts/themed-component-selectors.ts +++ b/lint/src/rules/ts/themed-component-selectors.ts @@ -5,16 +5,16 @@ * * http://www.dspace.org/license/ */ -import { - ESLintUtils, - TSESTree, -} from '@typescript-eslint/utils'; +import { TSESTree } from '@typescript-eslint/utils'; import { RuleContext } from '@typescript-eslint/utils/ts-eslint'; import { fixture } from '../../../test/fixture'; import { getComponentSelectorNode } from '../../util/angular'; import { stringLiteral } from '../../util/misc'; -import { DSpaceESLintRuleInfo } from '../../util/structure'; +import { + createTsRule, + DSpaceESLintRuleInfo, +} from '../../util/structure'; import { inThemedComponentOverrideFile, isThemeableComponent, @@ -56,7 +56,7 @@ Unit tests are exempt from this rule, because they may redefine components using defaultOptions: [], } as DSpaceESLintRuleInfo; -export const rule = ESLintUtils.RuleCreator.withoutDocs({ +export const rule = createTsRule({ ...info, create(context: RuleContext) { const filename = getFilename(context); diff --git a/lint/src/rules/ts/themed-component-usages.ts b/lint/src/rules/ts/themed-component-usages.ts index 83fe6f8ea89..3c52f7cc141 100644 --- a/lint/src/rules/ts/themed-component-usages.ts +++ b/lint/src/rules/ts/themed-component-usages.ts @@ -5,10 +5,7 @@ * * http://www.dspace.org/license/ */ -import { - ESLintUtils, - TSESTree, -} from '@typescript-eslint/utils'; +import { TSESTree } from '@typescript-eslint/utils'; import { RuleContext } from '@typescript-eslint/utils/ts-eslint'; import { fixture } from '../../../test/fixture'; @@ -16,7 +13,10 @@ import { removeWithCommas, replaceOrRemoveArrayIdentifier, } from '../../util/fix'; -import { DSpaceESLintRuleInfo } from '../../util/structure'; +import { + createTsRule, + DSpaceESLintRuleInfo, +} from '../../util/structure'; import { allThemeableComponents, DISALLOWED_THEME_SELECTORS, @@ -66,7 +66,7 @@ There are a few exceptions where the base class can still be used: defaultOptions: [], } as DSpaceESLintRuleInfo; -export const rule = ESLintUtils.RuleCreator.withoutDocs({ +export const rule = createTsRule({ ...info, create(context: RuleContext) { const filename = getFilename(context); diff --git a/lint/src/util/structure.ts b/lint/src/util/structure.ts index 2e3aebd9ab4..56e4958c619 100644 --- a/lint/src/util/structure.ts +++ b/lint/src/util/structure.ts @@ -5,15 +5,16 @@ * * http://www.dspace.org/license/ */ +import { ESLintUtils } from '@typescript-eslint/utils'; +import { NamedCreateRuleMeta } from '@typescript-eslint/utils/eslint-utils'; import { InvalidTestCase, - RuleMetaData, RuleModule, ValidTestCase, } from '@typescript-eslint/utils/ts-eslint'; import { EnumType } from 'typescript'; -export type Meta = RuleMetaData; +export type Meta = NamedCreateRuleMeta; export type Valid = ValidTestCase; export type Invalid = InvalidTestCase; @@ -44,6 +45,16 @@ export interface PluginExports { index: RuleExports[], } +const DOCUMENTATION = `file://${process.cwd()}/docs/lint`; + +export const createTsRule = ESLintUtils.RuleCreator( + name => `${DOCUMENTATION}/ts/rules/${name}.md`, +); + +export const createHtmlRule = ESLintUtils.RuleCreator( + name => `${DOCUMENTATION}/html/rules/${name}.md`, +); + export function bundle( name: string, language: string, @@ -58,4 +69,4 @@ export function bundle( rules: {}, index, }); -} +} \ No newline at end of file diff --git a/lint/src/util/templates/index.ejs b/lint/src/util/templates/index.ejs index d959f292910..1de652fb4d7 100644 --- a/lint/src/util/templates/index.ejs +++ b/lint/src/util/templates/index.ejs @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../lint/README.md) > <%= plugin.language %> rules _______ <% rules.forEach(rule => { %> diff --git a/lint/src/util/templates/rule.ejs b/lint/src/util/templates/rule.ejs index b39d193cc18..5e25c80ed0f 100644 --- a/lint/src/util/templates/rule.ejs +++ b/lint/src/util/templates/rule.ejs @@ -1,3 +1,4 @@ + [DSpace ESLint plugins](../../../../lint/README.md) > [<%= plugin.language %> rules](../index.md) > `<%= plugin.name %>/<%= rule.name %>` _______ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b87073c034f..f6798293c94 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -46,13 +46,14 @@ import { NativeWindowService, } from './core/services/window.service'; import { distinctNext } from './core/shared/distinct-next'; -import { ThemedRootComponent } from './root/themed-root.component'; +import { RootComponent } from './root/root.component'; import { HostWindowResizeAction } from './shared/host-window.actions'; import { IdleModalComponent } from './shared/idle-modal/idle-modal.component'; import { CSSVariableService } from './shared/sass-helper/css-variable.service'; import { HostWindowState } from './shared/search/host-window.reducer'; import { ThemeService } from './shared/theme-support/theme.service'; + @Component({ selector: 'ds-app', templateUrl: './app.component.html', @@ -60,7 +61,7 @@ import { ThemeService } from './shared/theme-support/theme.service'; changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [ - ThemedRootComponent, + RootComponent, AsyncPipe, ], })