-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: eslint migration * chore: fix lint * chore: fix action fail * chore: update ci workflow * chore: update version and config * chore(fe): ci test * chore(fe): update ci workflow * chore(fe): update ci workflow * chore(fe): add note comment
- Loading branch information
Showing
16 changed files
with
3,103 additions
and
3,092 deletions.
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,182 @@ | ||
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 | ||
}) | ||
|
||
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, | ||
{ | ||
plugins: { | ||
'@typescript-eslint': eslintTS.plugin | ||
}, | ||
languageOptions: { | ||
parser: eslintTS.parser, | ||
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' | ||
} | ||
}, | ||
|
||
/* Frontend configuration */ | ||
...flatCompat | ||
.config({ | ||
extends: ['next/core-web-vitals'] | ||
}) | ||
.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' | ||
} | ||
] | ||
} | ||
} | ||
) |
Oops, something went wrong.