Skip to content
Merged
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
19 changes: 9 additions & 10 deletions apps/website/content/docs/getting-started/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,28 @@ npm install --save-dev eslint @eslint/js @eslint-react/eslint-plugin
```js title="eslint.config.js"
import eslintJs from "@eslint/js";
import eslintReact from "@eslint-react/eslint-plugin";
import { defineConfig } from "eslint/config";

export default [
export default defineConfig([
{
files: ["**/*.js", "**/*.jsx"],
...eslintJs.configs.recommended,
extends: [
eslintJs.configs.recommended,
eslintReact.configs.recommended,
],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
},
{
files: ["**/*.js", "**/*.jsx"],
...eslintReact.configs.recommended,
},
{
files: ["**/*.js", "**/*.jsx"],
rules: {
// Add `globals` if you need this rule
"no-undef": "off",
// Put rules you want to override here
"@eslint-react/prefer-shorthand-boolean": "warn",
},
},
];
]);
```
4 changes: 2 additions & 2 deletions apps/website/content/docs/getting-started/meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"title": "Getting Started",
"pages": [
"typescript",
"javascript"
"javascript",
"typescript"
],
"defaultOpen": true
}
5 changes: 2 additions & 3 deletions apps/website/lib/source.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { loader } from "fumadocs-core/source";
import { createMDXSource } from "fumadocs-mdx";

import { docs, meta } from "#/.source";
import { docs } from "#/.source";

export const source = loader({
baseUrl: "/docs",
source: createMDXSource(docs, meta),
source: docs.toFumadocsSource(),
});
2 changes: 1 addition & 1 deletion apps/website/source.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { remarkDocGen, remarkInstall } from "fumadocs-docgen";
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
import { transformerTwoslash } from "fumadocs-twoslash";

export const { meta, docs } = defineDocs({
export const docs = defineDocs({
dir: "content/docs",
});

Expand Down
3 changes: 2 additions & 1 deletion apps/website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"erasableSyntaxOnly": true,
"paths": {
"#": ["."],
"#/*": ["./*"]
"#/*": ["./*"],
"#/.source": ["./.source/index.ts"]
},
"plugins": [
{
Expand Down
28 changes: 10 additions & 18 deletions examples/dual-react-dom-lib/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,31 @@ export default tseslint.config(
{
files: TSCONFIG_NODE.include,
ignores: TSCONFIG_NODE.exclude,
extends: [tseslint.configs.disableTypeChecked],
languageOptions: {
parserOptions: {
project: "./tsconfig.node.json",
projectService: false,
},
},
rules: {
...tseslint.configs.disableTypeChecked.rules,
"no-console": "off",
},
},
// react specific configurations
{
files: TSCONFIG.include,
...eslintPluginReactx.configs["recommended-type-checked"],
},
{
files: TSCONFIG.include,
...eslintPluginReactDom.configs.recommended,
},
{
files: TSCONFIG.include,
...eslintPluginReactWebApi.configs.recommended,
},
{
files: TSCONFIG.include,
...eslintPluginReactHooksExtra.configs.recommended,
},
{
files: TSCONFIG.include,
extends: [
eslintPluginReactx.configs["recommended-type-checked"],
eslintPluginReactDom.configs.recommended,
eslintPluginReactWebApi.configs.recommended,
eslintPluginReactHooksExtra.configs.recommended,
],
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
},
},
);
24 changes: 7 additions & 17 deletions examples/next-app/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const GLOB_APP = ["app/**/*.{js,ts,jsx,tsx}"];
const GLOB_CONFIG = ["**/*.config.{js,mjs,ts,tsx}"];

export default tseslint.config(
gitignore(),
{
files: GLOB_TS,
extends: [
Expand All @@ -40,26 +41,16 @@ export default tseslint.config(
},
{
files: TSCONFIG.include,
extends: [
eslintReact.configs["recommended-type-checked"],
eslintPluginReactRefresh.configs.recommended,
],
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
},
{
files: TSCONFIG.include,
plugins: {
"react-refresh": eslintPluginReactRefresh,
},
rules: {
"react-refresh/only-export-components": "warn",
},
},
{
files: TSCONFIG.include,
plugins: {
"@next/next": eslintPluginNext,
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
...eslintPluginNext.configs.recommended.rules,
...eslintPluginNext.configs["core-web-vitals"].rules,
},
Expand All @@ -72,11 +63,10 @@ export default tseslint.config(
},
{
files: [...GLOB_JS, ...GLOB_CONFIG],
extends: [tseslint.configs.disableTypeChecked],
rules: {
...tseslint.configs.disableTypeChecked.rules,
"no-undef": "off",
"no-console": "off",
},
},
gitignore(),
);
23 changes: 7 additions & 16 deletions examples/vite-react-dom-app/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,29 @@ export default tseslint.config(
{
files: TSCONFIG_NODE.include,
ignores: TSCONFIG_NODE.exclude,
extends: [tseslint.configs.disableTypeChecked],
languageOptions: {
parserOptions: {
project: "./tsconfig.node.json",
projectService: false,
},
},
rules: {
...tseslint.configs.disableTypeChecked.rules,
"no-console": "off",
},
},
// React configuration
{
files: TSCONFIG.include,
...eslintReact.configs["recommended-type-checked"],
},
// React Hooks configuration
// react specific configurations
{
files: TSCONFIG.include,
extends: [
eslintReact.configs["recommended-type-checked"],
eslintPluginReactRefresh.configs.recommended,
],
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
},
// React Refresh configuration
{
files: TSCONFIG.include,
plugins: {
"react-refresh": eslintPluginReactRefresh,
},
rules: {
"react-refresh/only-export-components": "warn",
...eslintPluginReactHooks.configs.recommended.rules,
},
},
);
32 changes: 11 additions & 21 deletions examples/vite-react-dom-js-app/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import eslintReact from "@eslint-react/eslint-plugin";
import eslintPluginReactHooks from "eslint-plugin-react-hooks";
import eslintPluginReactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import { defineConfig } from "eslint/config";

import JSCONFIG from "./jsconfig.json" with { type: "json" };
import JSCONFIG_NODE from "./jsconfig.node.json" with { type: "json" };

export default [
export default defineConfig([
// base configuration for browser environment source files
{
files: JSCONFIG.include,
extends: [eslintJs.configs.recommended],
languageOptions: {
globals: {
...globals.browser,
Expand All @@ -21,45 +23,33 @@ export default [
},
},
},
rules: {
...eslintJs.configs.recommended.rules,
},
},
// base configuration for node environment source files (*.config.js, etc.)
{
files: JSCONFIG_NODE.include,
ignores: JSCONFIG_NODE.exclude,
extends: [eslintJs.configs.recommended],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
...eslintJs.configs.recommended.rules,
"no-console": "off",
},
},
// React configuration
{
files: JSCONFIG.include,
...eslintReact.configs.recommended,
},
// React Hooks configuration
// react specific configurations
{
files: JSCONFIG.include,
extends: [
eslintReact.configs.recommended,
eslintPluginReactRefresh.configs.recommended,
],
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
},
// React Refresh configuration
{
files: JSCONFIG.include,
plugins: {
"react-refresh": eslintPluginReactRefresh,
},
rules: {
"react-refresh/only-export-components": "warn",
...eslintPluginReactHooks.configs.recommended.rules,
},
},
];
]);
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import eslintPluginReactHooks from "eslint-plugin-react-hooks";
import eslintPluginReactRefresh from "eslint-plugin-react-refresh";
import babelEslintParser from "@babel/eslint-parser";
import globals from "globals";
import { defineConfig } from "eslint/config";

import JSCONFIG from "./jsconfig.json" with { type: "json" };
import JSCONFIG_NODE from "./jsconfig.node.json" with { type: "json" };

export default [
export default defineConfig([
// base configuration for browser environment source files
{
files: JSCONFIG.include,
extends: [eslintJs.configs.recommended],
languageOptions: {
globals: {
...globals.browser,
Expand All @@ -26,14 +28,12 @@ export default [
},
},
},
rules: {
...eslintJs.configs.recommended.rules,
},
},
// base configuration for node environment source files (*.config.js, etc.)
{
files: JSCONFIG_NODE.include,
ignores: JSCONFIG_NODE.exclude,
extends: [eslintJs.configs.recommended],
languageOptions: {
globals: {
...globals.node,
Expand All @@ -49,31 +49,21 @@ export default [
},
},
rules: {
...eslintJs.configs.recommended.rules,
"no-console": "off",
},
},
// React configuration
{
files: JSCONFIG.include,
...eslintReact.configs.recommended,
},
// React Hooks configuration
// react specific configurations
{
files: JSCONFIG.include,
extends: [
eslintReact.configs.recommended,
eslintPluginReactRefresh.configs.recommended,
],
plugins: {
"react-hooks": eslintPluginReactHooks,
},
rules: eslintPluginReactHooks.configs.recommended.rules,
},
// React Refresh configuration
{
files: JSCONFIG.include,
plugins: {
"react-refresh": eslintPluginReactRefresh,
},
rules: {
"react-refresh/only-export-components": "warn",
...eslintPluginReactHooks.configs.recommended.rules,
},
},
];
]);
Loading