项目文件夹

文件
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

36 行
1.0 KiB
JavaScript

import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
const DATE_NOW_BAN = {
selector: 'CallExpression[callee.object.name="Date"][callee.property.name="now"]',
message: 'Use TimeService.now() for simulated time or realNow() for real wall-clock time. See os/TimeService.ts.',
};
const NEW_DATE_BAN = {
selector: 'NewExpression[callee.name="Date"]',
message: 'Use TimeService.getDate() / fromTimestamp(ts) / fromLocalParts(y,m,d) instead of new Date(...). See os/TimeService.ts.',
};
export default [
{
files: ['os/**/*.{ts,tsx}', 'apps/**/*.{ts,tsx}', 'system/**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
},
plugins: {
'react-hooks': reactHooks,
},
rules: {
'no-restricted-syntax': ['error', DATE_NOW_BAN, NEW_DATE_BAN],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
},
{
files: ['os/TimeService.ts'],
rules: {
'no-restricted-syntax': 'off',
},
},
];