-
Notifications
You must be signed in to change notification settings - Fork 9
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
chore: eslint migration #2265
Draft
eunnbi
wants to merge
5
commits into
main
Choose a base branch
from
t490-eslint-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
chore: eslint migration #2265
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
import { fixupConfigRules } from '@eslint/compat' | ||
import { FlatCompat } from '@eslint/eslintrc' | ||
import eslintJS from '@eslint/js' | ||
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended' | ||
import globals from 'globals' | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import eslintTS from 'typescript-eslint' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
const flatCompat = new FlatCompat({ | ||
baseDirectory: __dirname | ||
}) | ||
|
||
const patchedNextLintConfig = fixupConfigRules( | ||
flatCompat.extends('next/core-web-vitals') | ||
) | ||
|
||
export default eslintTS.config( | ||
{ | ||
ignores: [ | ||
'**/dist', | ||
'**/node_modules', | ||
'**/.pnpm-store', | ||
'**/__generated__', | ||
'**/@generated', | ||
'**/collection', | ||
'**/.next', | ||
'**/codegen.ts', | ||
'**/*.config.{js,mjs,ts}' | ||
] | ||
}, | ||
|
||
/* Common configuration */ | ||
eslintPluginPrettier, | ||
eslintJS.configs.recommended, | ||
...eslintTS.configs.recommended, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
project: true, | ||
emitDecoratorMetadata: true, | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
globals: { | ||
...globals.node | ||
} | ||
}, | ||
rules: { | ||
'object-shorthand': ['warn', 'always'], | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'@typescript-eslint/no-inferrable-types': 'warn', | ||
'@typescript-eslint/consistent-type-imports': 'warn', | ||
'@typescript-eslint/no-import-type-side-effects': 'error' | ||
} | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
rules: { | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'default', | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allow', | ||
trailingUnderscore: 'allow' | ||
}, | ||
{ | ||
selector: 'import', | ||
format: ['camelCase', 'PascalCase'] | ||
}, | ||
{ | ||
selector: 'typeLike', | ||
format: ['PascalCase'] | ||
}, | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
leadingUnderscore: 'allow', | ||
trailingUnderscore: 'allow' | ||
}, | ||
{ | ||
selector: ['objectLiteralProperty', 'classProperty'], | ||
format: ['camelCase', 'PascalCase'] | ||
} | ||
] | ||
} | ||
}, | ||
|
||
/* Backend configuration */ | ||
{ | ||
files: ['apps/backend/**/*'], | ||
rules: { | ||
'func-style': ['error', 'expression'], | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
patterns: [ | ||
{ | ||
group: ['apps/*', 'libs/*'], | ||
message: | ||
'Please import with path alias like `@apps/*` or `@libs/*`' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
files: ['apps/backend/**/*.spec.ts'], | ||
languageOptions: { | ||
globals: { | ||
...globals.mocha | ||
} | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-unused-expressions': 'off' | ||
} | ||
}, | ||
Comment on lines
+111
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
/* Frontend configuration */ | ||
...patchedNextLintConfig.map((config) => ({ | ||
...config, | ||
files: ['apps/frontend/**/*'] | ||
})), | ||
{ | ||
files: ['apps/frontend/**/*'], | ||
languageOptions: { | ||
globals: { | ||
...globals.browser | ||
} | ||
}, | ||
rules: { | ||
'@next/next/no-html-link-for-pages': [ | ||
'error', | ||
path.join(__dirname, 'apps/frontend/app') | ||
], | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
name: '@apollo/client', | ||
importNames: ['gql'], | ||
message: 'Please use @generated instead.' | ||
}, | ||
{ | ||
name: '@/__generated__', | ||
message: 'Please use @generated instead.' | ||
}, | ||
{ | ||
name: '@/__generated__/graphql', | ||
message: 'Please use @generated/graphql instead.' | ||
} | ||
], | ||
'@typescript-eslint/no-empty-object-type': [ | ||
'error', | ||
{ allowInterfaces: 'with-single-extends' } | ||
], | ||
'@typescript-eslint/no-unused-expressions': [ | ||
'error', | ||
{ allowShortCircuit: true, allowTernary: true } | ||
] | ||
} | ||
}, | ||
{ | ||
files: ['apps/frontend/**/*.tsx'], | ||
ignores: ['apps/frontend/components/shadcn/*.tsx'], | ||
rules: { | ||
'react/function-component-definition': [ | ||
'error', | ||
{ | ||
namedComponents: 'function-declaration' | ||
} | ||
] | ||
} | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AS-IS: Dev 의존성만 설치 ->
eslint-config-next/parser.js
에서next/dist/compiled/babel/eslint-parser
의존성을 찾지 못함TO-BE: 모든 의존성 설치
(더 나은 해결 방법 있으면 알려주세요..)