Skip to content

Commit 4e307ab

Browse files
Configure eslint plugins for imports (codse#77)
1 parent e75ccbd commit 4e307ab

File tree

84 files changed

+373
-395
lines changed

Some content is hidden

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

84 files changed

+373
-395
lines changed

.eslintrc.cjs

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module.exports = {
88
"plugin:@typescript-eslint/recommended",
99
"prettier",
1010
],
11-
plugins: ["react", "@typescript-eslint"],
11+
plugins: ["react", "@typescript-eslint", "simple-import-sort", "unused-imports"],
1212
parserOptions: {
13-
ecmaVersion: 2021,
13+
ecmaVersion: "latest",
1414
sourceType: "module",
1515
},
1616
rules: {
@@ -19,5 +19,46 @@ module.exports = {
1919
"@typescript-eslint/no-explicit-any": "warn",
2020
"react/no-unknown-property": ["error", { ignore: ["vaul-drawer-wrapper"] }],
2121
"@next/next/no-img-element": "off",
22+
"simple-import-sort/imports": "error",
23+
"simple-import-sort/exports": "error",
24+
"@typescript-eslint/no-unused-vars": "off",
25+
"unused-imports/no-unused-imports": "error",
26+
"unused-imports/no-unused-vars": [
27+
"warn",
28+
{
29+
vars: "all",
30+
varsIgnorePattern: "^_",
31+
args: "after-used",
32+
argsIgnorePattern: "^_",
33+
},
34+
],
2235
},
36+
overrides: [
37+
{
38+
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
39+
rules: {
40+
"simple-import-sort/imports": [
41+
"error",
42+
{
43+
groups: [
44+
// `react` first, `next` second, then packages starting with a character
45+
["^react$", "^next", "^[a-z]"],
46+
// Packages starting with `@`
47+
["^@"],
48+
// Packages starting with `~`
49+
["^~"],
50+
// Imports starting with `../`
51+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
52+
// Imports starting with `./`
53+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
54+
// Style imports
55+
["^.+\\.s?css$"],
56+
// Side effect imports
57+
["^\\u0000"],
58+
],
59+
},
60+
],
61+
},
62+
},
63+
],
2364
};

animata/background/blurry-blob.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Meta, StoryObj } from "@storybook/react";
2+
23
import BlurryBlob from "./blurry-blob";
34

45
const meta = {

animata/background/moving-gradient.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { BadgeAlert } from "lucide-react";
2+
13
import MovingGradient from "@/animata/background/moving-gradient";
24
import { Meta, StoryObj } from "@storybook/react";
3-
import { BadgeAlert } from "lucide-react";
45

56
const meta = {
67
title: "Background/Moving Gradient",

animata/background/moving-gradient.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { cn } from "@/lib/utils";
21
import { ComponentPropsWithoutRef } from "react";
32

3+
import { cn } from "@/lib/utils";
4+
45
interface MovingGradientProps extends ComponentPropsWithoutRef<"div"> {
56
animated?: boolean;
67
gradientClassName?: string;
@@ -15,10 +16,7 @@ export default function MovingGradient({
1516
}: MovingGradientProps) {
1617
const backgroundClassName = "pointer-events-none absolute h-full w-full";
1718
return (
18-
<div
19-
{...props}
20-
className={cn("relative overflow-hidden bg-white", className)}
21-
>
19+
<div {...props} className={cn("relative overflow-hidden bg-white", className)}>
2220
<div
2321
className={cn(
2422
"bg-size bg-gradient-to-r from-yellow-500 from-30% via-yellow-700 via-50% to-pink-500 to-80% opacity-15",

animata/bento-grid/gradient.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import MovingGradient from "@/animata/background/moving-gradient";
2-
import { cn } from "@/lib/utils";
1+
import { ReactNode } from "react";
32
import {
43
ArrowRight,
54
BarChart,
@@ -10,7 +9,9 @@ import {
109
Sun,
1110
TypeIcon,
1211
} from "lucide-react";
13-
import { ReactNode } from "react";
12+
13+
import MovingGradient from "@/animata/background/moving-gradient";
14+
import { cn } from "@/lib/utils";
1415

1516
function BentoCard({
1617
title,

animata/button/arrow-button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use client";
2-
import { cn } from "@/lib/utils";
3-
import { MoveRight } from "lucide-react";
42
import React from "react";
3+
import { MoveRight } from "lucide-react";
4+
5+
import { cn } from "@/lib/utils";
56

67
interface ArrowButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
78
text: string;

animata/button/get-started-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { cn } from "@/lib/utils";
21
import { ArrowRight } from "lucide-react";
32

3+
import { cn } from "@/lib/utils";
4+
45
interface IGetStartedButtonProps {
56
text: string;
67
}

animata/button/shining-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { cn } from "@/lib/utils";
21
import { ArrowRight } from "lucide-react";
32

3+
import { cn } from "@/lib/utils";
4+
45
export default function ShiningButton() {
56
const label = "See Calendar";
67
return (

animata/button/swipe-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use client";
2-
import { cn } from "@/lib/utils";
32
import React from "react";
43

4+
import { cn } from "@/lib/utils";
5+
56
interface SwipeButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
67
firstText: string;
78
secondText: string;

animata/card/animated-card.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
import { Meta, StoryObj } from "@storybook/react";
2+
33
import AnimatedCard3d from "./animated-card";
44

55
const meta = {

0 commit comments

Comments
 (0)