Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat add import rules for eslint #37

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
46 changes: 45 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals",
"plugins": ["import"],
"rules": {
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true
}
],
"import/order": [
"error",
{
"newlines-between": "always",
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"pathGroups": [
{
"pattern": "components/**",
"group": "internal"
},
{
"pattern": "data/**",
"group": "internal"
},
{
"pattern": "assets/**",
"group": "internal",
"position": "after"
}
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
]
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"eslint-plugin-import": "^2.29.1",
"postcss": "^8",
"postcss-nesting": "^12.0.2",
"prettier": "^3.1.1",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/app/layout.tsx
Copy link
Member

Choose a reason for hiding this comment

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

The commit message type can be refactor instead of fix.
It's not a bug-fix issue, it's refactoring the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

I' fix the eslint to fix lint issue on save.I think you got it wrong.import files are seperated base on their group not on every import line and also I think if our import files in some files are too much,that way,new-line between imports will be a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. Now I can say it's a good idea and we can apply this rule.
However, according to the current situation of the repository with multiple pull-request pending for merge, I think it's better to hold this PR for the future to prevent these rule's side effects on other PRs.
We can come back and apply these rules when we are good in the timing plan.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { Metadata } from 'next';
import Providers from './providers';
import LocalFont from 'next/font/local';

import Providers from './providers';

import type { Metadata } from 'next';

import '@/styles/globals.css';

const fontDana = LocalFont({
Expand Down