Skip to content

Commit 3822a6f

Browse files
fix(ESLint): Import orders
1 parent c465e6b commit 3822a6f

21 files changed

+184
-77
lines changed

.eslintrc.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2-
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
3-
"plugins": ["@typescript-eslint"]
2+
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended", "plugin:import/errors", "plugin:import/warnings", "plugin:import/typescript"],
3+
"plugins": ["@typescript-eslint", "import"],
4+
"rules": {
5+
"import/order": ["error", {
6+
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
7+
"newlines-between": "always",
8+
"alphabetize": {
9+
"order": "asc",
10+
"caseInsensitive": true
11+
}
12+
}]
13+
}
414
}

package-lock.json

+117-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
"@types/react": "^18.2.7",
3333
"@typescript-eslint/eslint-plugin": "^5.42.0",
3434
"@typescript-eslint/parser": "^5.42.0",
35+
"@typescript-eslint/typescript-estree": "^6.1.0",
3536
"eslint": "8.41.0",
36-
"eslint-config-next": "^13.4.4"
37+
"eslint-config-next": "^13.4.4",
38+
"eslint-plugin-import": "^2.27.5"
3739
},
3840
"volta": {
3941
"node": "18.16.0",

src/components/Scanner/scanner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
/* eslint-disable @typescript-eslint/no-unused-vars */
3-
import React, { Component } from "react";
43
import Quagga from "@ericblade/quagga2";
4+
import React, { Component } from "react";
55
interface ScannerProps {
66
onDetected: (result: any) => void;
77
setScanning: (scanning: boolean) => void;

src/components/check.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import React, { useState, useEffect, useRef } from "react";
1+
22
import VeganCheck from "@frontendnetwork/vegancheck";
3-
import Scan from "./Scanner/scanner";
43
import Image from "next/image";
4+
import { useTranslations } from "next-intl";
5+
import React, { useState, useEffect, useRef } from "react";
6+
57
import ModalWrapper from "@/components/elements/modalwrapper";
68
import ShareButton from "@/components/elements/share";
7-
import { useTranslations } from "next-intl";
9+
10+
import Scan from "./Scanner/scanner";
811

912
interface ProductResult {
1013
productname?: string;

src/components/elements/container.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Link from "next/link";
21
import Image from "next/image";
2+
import Link from "next/link";
3+
34
import BackButton from '@/components/button_back'
45

56
interface ContainerProps {

src/components/elements/contents/donate.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { useState } from "react";
2-
import { useTranslations } from "next-intl";
31
import Image from "next/image";
2+
import { useTranslations } from "next-intl";
3+
import { useState } from "react";
44

55
const SupportOption: React.FC = () => {
66
const t = useTranslations("More");

src/components/elements/contents/oledmode.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { useState, useEffect } from 'react';
21
import { useTranslations } from 'next-intl';
2+
import React, { useState, useEffect } from 'react';
33

44
const OLEDMode: React.FC = () => {
55
const t = useTranslations('More');

src/components/elements/pwainstall.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable @next/next/no-img-element */
22
/* eslint-disable @typescript-eslint/no-explicit-any */
3-
import { useState, useEffect } from "react";
4-
import ModalWrapper from "@/components/elements/modalwrapper";
53
import Image from "next/image";
64
import { useTranslations } from "next-intl";
5+
import { useState, useEffect } from "react";
6+
7+
import ModalWrapper from "@/components/elements/modalwrapper";
78

89
const InstallPrompt = () => {
910
const t = useTranslations("InstallPrompt");

src/components/elements/share.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useState, useEffect } from "react";
1+
import Image from "next/image";
22
import { useTranslations } from "next-intl";
3+
import React, { useState, useEffect } from "react";
4+
35
import ModalWrapper from "@/components/elements/modalwrapper";
4-
import Image from "next/image";
56

67
interface ShareButtonProps {
78
productName: string | undefined;

src/components/elements/shortcutinstall.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { useState, useEffect, FC } from "react";
32
import Image from "next/image";
43
import { useTranslations } from "next-intl";
4+
import { useState, useEffect, FC } from "react";
55

66
interface ExtendedWindow extends Window {
77
MSStream?: any;

src/components/ingredientscheck.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useState, FormEvent } from "react";
21
import VeganCheck from "@frontendnetwork/vegancheck";
3-
import { useTranslations } from "next-intl";
42
import Image from "next/image";
3+
import { useTranslations } from "next-intl";
4+
import React, { useState, FormEvent } from "react";
5+
56
import ModalWrapper from "@/components/elements/modalwrapper";
67

78
export interface FlaggedItem {

src/components/nav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { GetStaticPropsContext } from "next";
12
import Head from "next/head";
23
import Link from "next/link";
34
import { useRouter } from "next/router";
4-
import { useEffect } from "react";
5-
import { GetStaticPropsContext } from "next";
65
import { useTranslations } from "next-intl";
6+
import { useEffect } from "react";
77

88
export default function Nav() {
99
const t = useTranslations("Nav");

src/pages/404.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import Nav from "@/components/nav";
2-
import Container from "@/components/elements/container";
31
import { GetStaticPropsContext } from 'next'
42
import { useTranslations } from 'next-intl';
53

4+
import Container from "@/components/elements/container";
5+
import Nav from "@/components/nav";
6+
67
export default function NotFound() {
78
const t = useTranslations('404');
89
return (

src/pages/_app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "@/styles/style.scss";
2+
import { init } from "@socialgouv/matomo-next";
23
import type { AppProps } from "next/app";
34
import { NextIntlProvider } from "next-intl";
4-
import { init } from "@socialgouv/matomo-next";
55
import { useEffect } from "react";
66

77
export default function App({ Component, pageProps }: AppProps) {

src/pages/impressum.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import Container from "@/components/elements/container";
2-
import Nav from "@/components/nav";
3-
import React, { useState, useEffect } from 'react';
41
import { GetStaticPropsContext } from 'next'
52
import { useTranslations } from 'next-intl';
3+
import React, { useState, useEffect } from 'react';
4+
5+
import Container from "@/components/elements/container";
6+
import Nav from "@/components/nav";
67

78
const Impressum = () => {
89
const t = useTranslations();

src/pages/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import Nav from "@/components/nav";
2-
import Footer from "@/components/footer";
1+
import { GetStaticPropsContext } from "next";
2+
33
import ProductSearch from "@/components/check";
44
import InstallPrompt from "@/components/elements/pwainstall";
55
import Shortcut from "@/components/elements/shortcutinstall";
6-
import { GetStaticPropsContext } from "next";
6+
import Footer from "@/components/footer";
7+
import Nav from "@/components/nav";
78

89
export default function Home() {
910
return (

0 commit comments

Comments
 (0)