Skip to content

Commit

Permalink
Fix ts / lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp committed Jan 23, 2025
1 parent 6565966 commit 09912ac
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'docs/config/environment';
// @ts-expect-error no types shipped from prismjs
import Prism from 'prismjs';
import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace';
import 'prismjs/components/prism-css';
Expand All @@ -15,6 +14,7 @@ import { setup } from 'prismjs-glimmer';

import 'prismjs/themes/prism.css';

// eslint-disable-next-line @typescript-eslint/no-unsafe-call
setup(Prism);

export default class App extends Application {
Expand Down
9 changes: 4 additions & 5 deletions docs/app/components/code-inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { modifier } from 'ember-modifier';
import { htmlSafe, type SafeString } from '@ember/template';
import { tracked } from '@glimmer/tracking';
import { assert } from '@ember/debug';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare const Prism: any;
import Prism from 'prismjs';

interface CodeInlineSignature {
Element: HTMLElement;
Expand All @@ -25,8 +23,9 @@ export default class CodeInline extends Component<CodeInlineSignature> {
"ember-prism's <CodeBlock/> and <CodeInline/> components require a `code` parameter to be passed in.",
code !== undefined,
);
if (Prism?.plugins?.NormalizeWhitespace) {
return Prism.plugins.NormalizeWhitespace.normalize(code);
if (Prism?.plugins['NormalizeWhitespace']) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
return Prism.plugins['NormalizeWhitespace'].normalize(code) as string;
}

return code;
Expand Down
8 changes: 7 additions & 1 deletion docs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ export default ts.config(
* https://eslint.org/docs/latest/use/configure/ignore
*/
{
ignores: ['dist/', 'node_modules/', 'coverage/', 'app/templates/snippets/', '!**/.*'],
ignores: [
'dist/',
'node_modules/',
'coverage/',
'app/templates/snippets/',
'!**/.*',
],
},
/**
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@glint/template": "^1.5.1",
"@tsconfig/ember": "^3.0.8",
"@types/eslint__js": "^8.42.3",
"@types/prismjs": "^1.26.5",
"@types/qunit": "^2.19.12",
"@types/rsvp": "^4.0.9",
"@typescript-eslint/eslint-plugin": "^8.21.0",
Expand Down
1 change: 1 addition & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"types": [
"./node_modules/ember-source/types/stable",
"./node_modules/@types/prismjs",
]
}
}
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test-app/app/components/shadow-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class ShadowRootComponent extends Component<{

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const config = getOwner(this).resolveRegistration('config:environment') as {
APP: {
shadowDom: boolean;
Expand Down

0 comments on commit 09912ac

Please sign in to comment.