Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fork-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
install-code-deps: true

- name: prettier
run: cd code && yarn lint:prettier --check .
run: yarn lint:prettier

test:
strategy:
Expand Down
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if [ -z "$SKIP_STORYBOOK_GIT_HOOKS" ]; then
cd code
yarn lint-staged

cd ../scripts
yarn lint-staged
fi
201 changes: 201 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
"categories": {
"correctness": "warn"
},
"plugins": ["typescript", "react", "import", "jsx-a11y"],
"jsPlugins": [
"eslint-plugin-storybook",
"eslint-plugin-playwright",
{ "name": "local-rules", "specifier": "./scripts/eslint-plugin-local-rules" }
],
"settings": {
"react": { "version": "18" }
},
"rules": {
"no-unused-vars": "off",
"no-shadow-restricted-names": "off",
"no-control-regex": "off",
"no-sparse-arrays": "off",
"no-useless-escape": "off",
"no-nonoctal-decimal-escape": "off",

"typescript/no-implied-eval": "error",
"typescript/ban-ts-comment": "error",
"typescript/consistent-type-imports": ["error", { "disallowTypeAnnotations": false }],
"typescript/no-explicit-any": "warn",
"typescript/no-unused-vars": "warn",
"typescript/no-empty-object-type": "warn",
"typescript/no-empty-interface": "warn",
"typescript/no-unsafe-function-type": "warn",
"typescript/triple-slash-reference": "off",

"react/jsx-no-undef": "off",
"react/exhaustive-deps": "off",

"import/default": "off",
"import/namespace": "off",
"import/no-named-as-default": "warn",
"import/no-named-as-default-member": "warn",
"import/no-self-import": "warn",

"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/prefer-tag-over-role": "off",

"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "react-aria",
"message": "Don't import from react-aria directly, please use the specific submodule like @react-aria/overlays instead",
"allowTypeImports": false
},
{
"name": "react-stately",
"message": "Don't import from react-stately directly, please use the specific submodule like @react-stately/overlays instead",
"allowTypeImports": false
},
{
"name": "react-aria-components",
"message": "Don't import from react-aria-components root, but use the react-aria-components/patched-dist/ComponentX entrypoints which are optimised for tree-shaking.",
"allowTypeImports": true
},
{
"name": "es-toolkit",
"message": "Don't import from es-toolkit root, but use the sub-exports like es-toolkit/array entrypoints instead which are optimised for tree-shaking.",
"allowTypeImports": true
},
{
"name": "lodash",
"message": "lodash is banned. Use es-toolkit or native alternatives."
},
{
"name": "lodash-es",
"message": "lodash-es is banned. Use es-toolkit or native alternatives."
},
{ "name": "chalk", "message": "chalk is banned. Use picocolors instead." },
{ "name": "qs", "message": "qs is banned. Use URLSearchParams instead." },
{ "name": "handlebars", "message": "handlebars is banned." },
{ "name": "fs-extra", "message": "fs-extra is banned. Use node:fs/promises instead." }
]
}
]
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"rules": {
"local-rules/no-uncategorized-errors": "warn",
"local-rules/storybook-monorepo-imports": "error"
}
},
{
"files": ["**/*.test.*", "**/*.spec.*", "**/*.mockdata.*", "**/*.compat.*"],
"rules": {
"local-rules/no-uncategorized-errors": "off",
"local-rules/storybook-monorepo-imports": "off"
}
},
{
"files": ["code/core/src/preview-errors.ts"],
"rules": {
"local-rules/no-duplicated-error-codes": "error"
}
},
{
"files": [
"**/__tests__/**",
"**/__testfixtures__/**",
"**/*.test.*",
"**/*.stories.*",
"**/template/**/*"
],
"rules": {
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/iframe-has-title": "off",
"jsx-a11y/alt-text": "off"
}
},
{
"files": ["**/*.stories.{ts,tsx,js,jsx,mjs,cjs}", "**/*.story.{ts,tsx,js,jsx,mjs,cjs}"],
"rules": {
"storybook/await-interactions": "error",
"storybook/context-in-play-function": "error",
"storybook/default-exports": "error",
"storybook/hierarchy-separator": "warn",
"storybook/no-redundant-story-name": "warn",
"storybook/prefer-pascal-case": "warn",
"storybook/story-exports": "error",
"storybook/use-storybook-expect": "error",
"storybook/use-storybook-testing-library": "error"
}
},
{
"files": ["**/core/**/*.stories.*", "**/core/**/*.story.*"],
"rules": {
"storybook/use-storybook-expect": "off"
}
},
{
"files": ["**/renderers/**/*.stories.*", "**/core/template/**/*.stories.*"],
"rules": {
"storybook/no-renderer-packages": "off"
}
},
{
"files": ["**/*.vue", "**/*.svelte"],
"rules": {
"typescript/consistent-type-imports": "off"
}
},
{
"files": ["**/template/**/*"],
"rules": {
"no-restricted-imports": "off"
}
},
{
"files": ["**/e2e-tests/*.ts"],
"rules": {
"playwright/no-skipped-test": ["warn", { "allowConditional": true }],
"playwright/prefer-comparison-matcher": "error",
"playwright/prefer-equality-matcher": "error",
"playwright/prefer-hooks-on-top": "error",
"playwright/prefer-strict-equal": "error",
"playwright/prefer-to-be": "error",
"playwright/prefer-to-contain": "error",
"playwright/prefer-to-have-count": "error",
"playwright/prefer-to-have-length": "error",
"playwright/require-to-throw-message": "error",
"playwright/require-top-level-describe": "error"
}
}
],
"ignorePatterns": [
"**/node_modules",
"**/dist",
"**/build",
"**/coverage",
"docs",
"sandbox",
"repros",
"test-storybooks",
"storybook-static",
"built-storybooks",
"code/lib/codemod/src/transforms/__testfixtures__",
"code/core/assets",
"code/core/report",
"code/core/src/core-server/utils/__search-files-tests__",
"code/core/src/core-server/utils/__mockdata__/src/Empty.stories.ts",
"code/lib/cli-storybook/test",
"scripts/storage",
"scripts/repros-generator",
"*.bundle.js",
"*.js.map",
".yarn",
".cache",
".nx"
]
}
7 changes: 4 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ yarn nx compile <package-name>
### Lint and typecheck

```bash
yarn lint
yarn --cwd code lint:js:cmd <file-relative-to-code-folder> --fix
yarn lint # oxlint on code/ and scripts/
yarn lint:fix # oxlint with auto-fix
yarn lint:prettier # prettier check
yarn task check
yarn nx run-many -t check
```
Expand Down Expand Up @@ -235,7 +236,7 @@ When writing tests:
After changing files:

1. Format with `yarn prettier --write <file>`
2. Lint with `yarn --cwd code lint:js:cmd <file-relative-to-code-folder> --fix` or `cd code && yarn lint:js:cmd <file-relative-to-code-folder>`
2. Lint with `yarn lint:fix` (runs oxlint with auto-fix on code/ and scripts/)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep AGENTS lint guidance aligned with the required per-file JS/TS lint workflow.

Line 239 now documents only yarn lint:fix, which diverges from the required per-file command and can make single-file linting guidance inconsistent.

As per coding guidelines: "Lint JavaScript/TypeScript files with yarn --cwd code lint:js:cmd <file-relative-to-code-folder> --fix before submitting changes".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 239, Update AGENTS.md to restore and align the per-file
linting guidance with the project's required command: replace or augment the
current single-line instruction referencing `yarn lint:fix` by adding the
per-file JS/TS lint command `yarn --cwd code lint:js:cmd
<file-relative-to-code-folder> --fix` (you may keep `yarn lint:fix` as a global
option) so the document explicitly instructs developers to run `yarn --cwd code
lint:js:cmd <file-relative-to-code-folder> --fix` before submitting changes;
ensure the file mentions both commands and clearly labels the per-file command
as the required workflow.

3. Run relevant tests before submitting a PR

Use Storybook loggers instead of raw `console.*` in normal code paths:
Expand Down
23 changes: 0 additions & 23 deletions code/.eslintignore

This file was deleted.

Loading
Loading