Skip to content

Commit ed5c271

Browse files
authored
refactor: reorder imports and clean up website eslint config (#1013)
1 parent 52f8ff3 commit ed5c271

File tree

148 files changed

+382
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+382
-472
lines changed

.pkgs/configs/eslint.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import pluginDeMorgan from "eslint-plugin-de-morgan";
44
import pluginJsdoc from "eslint-plugin-jsdoc";
55
import pluginPerfectionist from "eslint-plugin-perfectionist";
66
import pluginRegexp from "eslint-plugin-regexp";
7-
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
87
import pluginUnicorn from "eslint-plugin-unicorn";
98
import tseslint from "typescript-eslint";
109
const GLOB_JS = ["*.{js,jsx,cjs,mjs}", "**/*.{js,jsx,cjs,mjs}"];
@@ -101,26 +100,38 @@ export const typescript = tseslint.config({
101100
files: GLOB_TS,
102101
plugins: {
103102
["@stylistic"]: stylistic,
104-
["simple-import-sort"]: pluginSimpleImportSort,
105103
["unicorn"]: pluginUnicorn,
106104
},
107105
rules: {
108106
"@stylistic/arrow-parens": ["warn", "always"],
109107
"@stylistic/no-multi-spaces": ["warn"],
110108
"@stylistic/operator-linebreak": ["warn", "before"],
111109
"@stylistic/quote-props": ["error", "as-needed"],
112-
"simple-import-sort/exports": "warn",
113-
"simple-import-sort/imports": "warn",
114-
"perfectionist/sort-exports": "off",
115-
"perfectionist/sort-imports": "off",
110+
"perfectionist/sort-exports": ["warn", { type: "natural", order: "asc" }],
111+
"perfectionist/sort-imports": ["warn", {
112+
type: "natural",
113+
groups: [
114+
"type",
115+
["parent-type", "sibling-type", "index-type", "internal-type"],
116+
"builtin",
117+
"external",
118+
"internal",
119+
["parent", "sibling", "index"],
120+
"side-effect",
121+
"object",
122+
"unknown",
123+
],
124+
newlinesBetween: "ignore",
125+
order: "asc",
126+
}],
116127
"perfectionist/sort-interfaces": [
117128
"warn",
118129
{ ...p11tOptions, ...p11tGroups },
119130
],
120131
"perfectionist/sort-intersection-types": "off",
121132
"perfectionist/sort-modules": "off",
122-
"perfectionist/sort-named-exports": "off",
123-
"perfectionist/sort-named-imports": "off",
133+
"perfectionist/sort-named-exports": ["warn", { type: "natural", order: "asc" }],
134+
"perfectionist/sort-named-imports": ["warn", { type: "natural", order: "asc" }],
124135
"perfectionist/sort-object-types": [
125136
"warn",
126137
{ ...p11tOptions, ...p11tGroups },

.pkgs/configs/eslint.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import pluginDeMorgan from "eslint-plugin-de-morgan";
44
import pluginJsdoc from "eslint-plugin-jsdoc";
55
import pluginPerfectionist from "eslint-plugin-perfectionist";
66
import pluginRegexp from "eslint-plugin-regexp";
7-
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
87
import pluginUnicorn from "eslint-plugin-unicorn";
98
import tseslint from "typescript-eslint";
109

@@ -113,7 +112,6 @@ export const typescript: ConfigArray = tseslint.config(
113112
files: GLOB_TS,
114113
plugins: {
115114
["@stylistic"]: stylistic,
116-
["simple-import-sort"]: pluginSimpleImportSort,
117115
["unicorn"]: pluginUnicorn,
118116
},
119117
rules: {
@@ -122,19 +120,31 @@ export const typescript: ConfigArray = tseslint.config(
122120
"@stylistic/operator-linebreak": ["warn", "before"],
123121
"@stylistic/quote-props": ["error", "as-needed"],
124122

125-
"simple-import-sort/exports": "warn",
126-
"simple-import-sort/imports": "warn",
127-
128-
"perfectionist/sort-exports": "off",
129-
"perfectionist/sort-imports": "off",
123+
"perfectionist/sort-exports": ["warn", { type: "natural", order: "asc" }],
124+
"perfectionist/sort-imports": ["warn", {
125+
type: "natural",
126+
groups: [
127+
"type",
128+
["parent-type", "sibling-type", "index-type", "internal-type"],
129+
"builtin",
130+
"external",
131+
"internal",
132+
["parent", "sibling", "index"],
133+
"side-effect",
134+
"object",
135+
"unknown",
136+
],
137+
newlinesBetween: "ignore",
138+
order: "asc",
139+
}],
130140
"perfectionist/sort-interfaces": [
131141
"warn",
132142
{ ...p11tOptions, ...p11tGroups },
133143
],
134144
"perfectionist/sort-intersection-types": "off",
135145
"perfectionist/sort-modules": "off",
136-
"perfectionist/sort-named-exports": "off",
137-
"perfectionist/sort-named-imports": "off",
146+
"perfectionist/sort-named-exports": ["warn", { type: "natural", order: "asc" }],
147+
"perfectionist/sort-named-imports": ["warn", { type: "natural", order: "asc" }],
138148
"perfectionist/sort-object-types": [
139149
"warn",
140150
{ ...p11tOptions, ...p11tGroups },

.pkgs/configs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"eslint-plugin-jsdoc": "^50.6.8",
2626
"eslint-plugin-perfectionist": "^4.10.1",
2727
"eslint-plugin-regexp": "^2.7.0",
28-
"eslint-plugin-simple-import-sort": "^12.1.1",
2928
"eslint-plugin-unicorn": "^57.0.0",
3029
"typescript-eslint": "^8.27.0"
3130
}

.pkgs/eslint-plugin-local/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"eslint-plugin-jsdoc": "^50.6.8",
3737
"eslint-plugin-perfectionist": "^4.10.1",
3838
"eslint-plugin-regexp": "^2.7.0",
39-
"eslint-plugin-simple-import-sort": "^12.1.1",
4039
"eslint-plugin-unicorn": "^57.0.0",
4140
"string-ts": "^2.2.1",
4241
"ts-pattern": "^5.6.2"

.pkgs/eslint-plugin-local/src/rules/avoid-multiline-template-expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as AST from "@eslint-react/ast";
21
import type { RuleContext, RuleFeature } from "@eslint-react/kit";
32
import type { RuleListener } from "@typescript-eslint/utils/ts-eslint";
43
import type { CamelCase } from "string-ts";
4+
import * as AST from "@eslint-react/ast";
55

66
import { createRule } from "../utils";
77

.pkgs/eslint-plugin-local/src/utils/is-initialized-from-source.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { Scope } from "@typescript-eslint/scope-manager";
2+
import type { TSESTree } from "@typescript-eslint/types";
13
import * as AST from "@eslint-react/ast";
24
import { _ } from "@eslint-react/eff";
35
import { findVariable } from "@eslint-react/var";
4-
import type { Scope } from "@typescript-eslint/scope-manager";
5-
import type { TSESTree } from "@typescript-eslint/types";
66
import { AST_NODE_TYPES as T } from "@typescript-eslint/types";
77

88
/**

apps/website/app/(home)/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { HomeLayout } from "fumadocs-ui/layouts/home";
21
import type { ReactNode } from "react";
3-
42
import { baseOptions } from "#/app/layout.config";
53

4+
import { HomeLayout } from "fumadocs-ui/layouts/home";
5+
66
export default function Layout({ children }: { children: ReactNode }) {
77
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
88
}

apps/website/app/(home)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { ESLintReact } from "#/components/eslint-react";
12
import { Card, Cards } from "fumadocs-ui/components/card";
2-
import { Link } from "next-view-transitions";
33

4-
import { ESLintReact } from "#/components/eslint-react";
4+
import { Link } from "next-view-transitions";
55

66
const features = [
77
["Modern", "First-class support for TypeScript, React 19, and more."],
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createFromSource } from "fumadocs-core/search/server";
2-
31
import { source } from "#/lib/source";
42

3+
import { createFromSource } from "fumadocs-core/search/server";
4+
55
export const { GET } = createFromSource(source);

apps/website/app/docs/[[...slug]]/page.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { source } from "#/lib/source";
12
import { Popup, PopupContent, PopupTrigger } from "fumadocs-twoslash/ui";
23
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
34
import defaultMdxComponents from "fumadocs-ui/mdx";
45
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page";
5-
import { notFound } from "next/navigation";
66

7-
import { source } from "#/lib/source";
7+
import { notFound } from "next/navigation";
88

99
const mdxComponents = {
1010
...defaultMdxComponents,
@@ -20,14 +20,19 @@ export default async function Page(props: {
2020
}) {
2121
const params = await props.params;
2222
const page = source.getPage(params.slug);
23-
if (!page) notFound();
24-
25-
const MDX = page.data.body;
23+
if (page == null) notFound();
24+
const {
25+
description,
26+
title,
27+
body: MDX,
28+
full = false,
29+
toc,
30+
} = page.data;
2631

2732
return (
28-
<DocsPage full={!!page.data.full} toc={page.data.toc}>
29-
<DocsTitle>{page.data.title}</DocsTitle>
30-
<DocsDescription>{page.data.description}</DocsDescription>
33+
<DocsPage full={full} toc={toc}>
34+
<DocsTitle>{title}</DocsTitle>
35+
<DocsDescription>{description}</DocsDescription>
3136
<DocsBody>
3237
<MDX components={mdxComponents} />
3338
</DocsBody>
@@ -44,10 +49,11 @@ export async function generateMetadata(props: {
4449
}) {
4550
const params = await props.params;
4651
const page = source.getPage(params.slug);
47-
if (!page) notFound();
52+
if (page == null) notFound();
53+
const { description, title } = page.data;
4854

4955
return {
50-
description: page.data.description,
51-
title: page.data.title,
56+
description,
57+
title,
5258
};
5359
}

0 commit comments

Comments
 (0)