-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: ESLint v9 #5197
chore: ESLint v9 #5197
Changes from 11 commits
b32b5b3
4a03448
8178b27
6a1eda3
bb87161
db247fc
b9fbd5f
2f91847
cbe2d37
dd69f61
516dc91
9de08d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import smarthr from 'eslint-config-smarthr' | ||
import storybook from 'eslint-plugin-storybook' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config[]} | ||
*/ | ||
export default [ | ||
...smarthr, | ||
...storybook.configs['flat/recommended'], | ||
{ | ||
rules: { | ||
'jsx-a11y/anchor-is-valid': 'warn', | ||
'jsx-a11y/click-events-have-key-events': 'warn', | ||
'jsx-a11y/no-static-element-interactions': 'warn', | ||
'jsx-a11y/label-has-associated-control': [ | ||
'error', | ||
{ | ||
controlComponents: ['Input', 'InputWithTooltip'], | ||
}, | ||
], | ||
'@typescript-eslint/consistent-type-definitions': [ | ||
'error', | ||
'type', | ||
], | ||
'smarthr/require-barrel-import': 'off', | ||
'smarthr/a11y-anchor-has-href-attribute': [ | ||
'error', | ||
{ | ||
checkType: 'allow-spread-attributes', | ||
} | ||
], | ||
'smarthr/a11y-input-has-name-attribute': [ | ||
'error', | ||
{ | ||
checkType: 'allow-spread-attributes', | ||
} | ||
], | ||
}, | ||
}, | ||
{ | ||
ignores: [ | ||
'**/*.{mjs,js}', | ||
'sandbox/', | ||
'storybook-static/', | ||
'packages/smarthr-ui/esm/', | ||
'packages/smarthr-ui/lib/', | ||
'packages/smarthr-ui/.storybook', | ||
] | ||
}, | ||
] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ export function ButtonWrapper({ | |
if (props.isAnchor) { | ||
const { anchorRef, elementAs, isAnchor: _, ...others } = props | ||
const Component = elementAs || 'a' | ||
// eslint-disable-next-line jsx-a11y/anchor-has-content | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint v9 では、このように無効な無効化コメントを検知できるようになりました。 |
||
return <Component {...others} className={anchorStyle} ref={anchorRef} /> | ||
} else { | ||
const { buttonRef, disabled, onClick, ...others } = props | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ type Props<T extends React.ElementType> = PropsWithChildren< | |
> & | ||
ComponentPropsWithoutRef<T> | ||
|
||
const _Cluster = <T extends React.ElementType = 'div'>( | ||
const ActualCluster = <T extends React.ElementType = 'div'>( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここリネームしてます。 ESLint のバージョンアップによって、「Hooks を使えるのは React コンポーネントだけだぞ」ってルールに引っかかりました。 これはちゃんと React コンポーネントなんですが、どうやらコンポーネントならキャメルメースの命名のはずだと疑われてしまったので、ちゃんとキャメルメースを満たす名前に変えました。 |
||
{ as, gap = 0.5, inline = false, align, justify, className, ...rest }: Props<T>, | ||
ref: ForwardedRef<HTMLDivElement>, | ||
) => { | ||
|
@@ -119,4 +119,4 @@ const _Cluster = <T extends React.ElementType = 'div'>( | |
) | ||
} | ||
|
||
export const Cluster = genericsForwardRef(_Cluster) | ||
export const Cluster = genericsForwardRef(ActualCluster) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlatConfig では、
ignores
のみを持つオブジェクトを定義することで、全体の ignore リストが設定できるらしいです。