Skip to content

Commit

Permalink
Eslint
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby committed Mar 3, 2024
1 parent 9d6f374 commit 6be45ec
Show file tree
Hide file tree
Showing 12 changed files with 379 additions and 886 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.0",
"prettier": "^2.8.8",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"typescript": "~5.3.3",
"vite": "^4.5.2"
"vite": "^5.1.4"
}
}
18 changes: 17 additions & 1 deletion packages/comment-widget/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -13,5 +14,20 @@
"plugins": ["@typescript-eslint"],
"env": {
"browser": true
},
"rules": {
"no-prototype-builtins": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
]
}
}
4 changes: 2 additions & 2 deletions packages/comment-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
},
"dependencies": {
"@emoji-mart/data": "^1.1.2",
"@halo-dev/api-client": "^2.12.0",
"@halo-dev/api-client": "^2.13.0",
"@lit/context": "^1.1.0",
"dayjs": "^1.11.10",
"emoji-mart": "^5.5.2",
"javascript-time-ago": "^2.5.9",
"lit": "^3.1.2"
},
"devDependencies": {
"lit-analyzer": "^1.2.1"
"lit-analyzer": "^2.0.3"
}
}
4 changes: 2 additions & 2 deletions packages/comment-widget/src/base-comment-item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, html, css } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import './user-avatar';
import { LitElement, css, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { formatDate, timeAgo } from './utils/date';
import baseStyles from './styles/base';
import varStyles from './styles/var';
Expand Down
16 changes: 10 additions & 6 deletions packages/comment-widget/src/base-form.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { LitElement, css, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import baseStyles from './styles/base';
import './emoji-button';
import { LitElement, css, html } from 'lit';
import { Ref, createRef, ref } from 'lit/directives/ref.js';
import {
allowAnonymousCommentsContext,
baseUrlContext,
Expand All @@ -10,9 +9,10 @@ import {
kindContext,
nameContext,
} from './context';
import { consume } from '@lit/context';
import { Ref, createRef, ref } from 'lit/directives/ref.js';
import { customElement, state } from 'lit/decorators.js';
import type { User } from '@halo-dev/api-client';
import baseStyles from './styles/base';
import { consume } from '@lit/context';
import varStyles from './styles/var';

@customElement('base-form')
Expand Down Expand Up @@ -253,7 +253,11 @@ export class BaseForm extends LitElement {
outline: 0;
padding: 0.4rem 0.75rem;
width: 100%;
transition: background 0.2s, border 0.2s, box-shadow 0.2s, color 0.2s;
transition:
background 0.2s,
border 0.2s,
box-shadow 0.2s,
color 0.2s;
}
input:focus,
Expand Down
9 changes: 4 additions & 5 deletions packages/comment-widget/src/emoji-button.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { LitElement, css, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import './icons/icon-loading';
import './icons/icon-emoji';
import { LitElement, css, html } from 'lit';
import { Ref, createRef, ref } from 'lit/directives/ref.js';
import { customElement, state } from 'lit/decorators.js';
import { Picker } from 'emoji-mart';
import baseStyles from './styles/base';
import { consume } from '@lit/context';
import { emojiDataUrlContext } from './context';
import './icons/icon-emoji';
import './icons/icon-loading';
import varStyles from './styles/var';
import baseStyles from './styles/base';

@customElement('emoji-button')
export class EmojiButton extends LitElement {
Expand Down
2 changes: 1 addition & 1 deletion packages/comment-widget/src/icons/icon-emoji.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html, css } from 'lit';
import { LitElement, css, html } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('icon-emoji')
Expand Down
2 changes: 1 addition & 1 deletion packages/comment-widget/src/icons/icon-loading.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, html, css } from 'lit';
import { LitElement, css, html } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('icon-loading')
Expand Down
8 changes: 4 additions & 4 deletions packages/comment-widget/src/reply-form.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { LitElement, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { CommentVo, ReplyRequest, ReplyVo, User } from '@halo-dev/api-client';
import './base-form';
import { CommentVo, ReplyRequest, ReplyVo, User } from '@halo-dev/api-client';
import { LitElement, html } from 'lit';
import { Ref, createRef, ref } from 'lit/directives/ref.js';
import { allowAnonymousCommentsContext, baseUrlContext, currentUserContext } from './context';
import { customElement, property, state } from 'lit/decorators.js';
import { BaseForm } from './base-form';
import { consume } from '@lit/context';
import { allowAnonymousCommentsContext, baseUrlContext, currentUserContext } from './context';

@customElement('reply-form')
export class ReplyForm extends LitElement {
Expand Down
4 changes: 2 additions & 2 deletions packages/comment-widget/src/styles/var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ const varStyles = css`
);
--component-emoji-picker-color-border: var(
--halo-comment-widget-component-emoji-picker-color-border,
rgba(0, 0, 0, .05)
rgba(0, 0, 0, 0.05)
);
--component-emoji-picker-color-border-over: var(
--halo-comment-widget-component-emoji-picker-color-border-over,
rgba(0, 0, 0, .1)
rgba(0, 0, 0, 0.1)
);
}
`;
Expand Down
6 changes: 3 additions & 3 deletions packages/comment-widget/src/user-avatar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { html, css, LitElement } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import './icons/icon-loading';
import varStyles from './styles/var';
import { LitElement, css, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import baseStyles from './styles/base';
import varStyles from './styles/var';

@customElement('user-avatar')
export class UserAvatar extends LitElement {
Expand Down
Loading

0 comments on commit 6be45ec

Please sign in to comment.