Files
coze-studio/frontend/config/eslint-config/eslint.config.web.js
fanlv 890153324f feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
2025-07-20 17:36:12 +08:00

67 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const globals = require('globals');
/** @type {(import('eslint').Linter.Config[])} */
module.exports = [
...require('./eslint.config.base.js'),
{
plugins: {
// TODO: 需要根据不同类型配置plugin需要阅读源码确认是否影响性能
'react-hooks': require('eslint-plugin-react-hooks'),
react: require('eslint-plugin-react'),
risxss: require('eslint-plugin-risxss'),
},
languageOptions: {
globals: {
...globals.node,
...globals.browser,
JSX: true,
React: true,
},
},
settings: {
// for eslint-plugin-react
react: {
pragma: 'React',
version: '18.2',
},
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'risxss/catch-potential-xss-react': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@douyinfe/semi-ui', '@douyinfe/semi-ui/*'],
message:
'请勿直接使用@douyinfe/semi-ui, 请使用 @coze-arch/bot-semi',
},
{
group: ['@douyinfe/semi-ui/lib/es/*'],
message:
'如果你的代码为 import { foo } from "@douyinfe/semi-ui/lib/es/bar", 可以尝试替换为 import { foo } from "@coze-arch/bot-semi/Bar"',
},
{
group: ['@edenx/runtime/intl'],
message:
'请勿直接使用@edenx/runtime/intl, 请使用 @coze-arch/i18n',
},
{
group: ['@edenx/runtime/router'],
message:
'请勿直接使用@edenx/runtime/router, 请使用 react-router-dom',
},
{
group: ['@edenx/runtime/styled'],
message:
'请勿直接使用@edenx/runtime/styled, 请使用 styled-components',
},
],
},
],
},
},
];