-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolved #29
- Loading branch information
Showing
25 changed files
with
758 additions
and
73 deletions.
There are no files selected for viewing
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 @@ | ||
dist |
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 |
---|---|---|
|
@@ -6,9 +6,10 @@ | |
"author": "Hyunmin Woo <[email protected]> (https://github.com/woohm402)", | ||
"scripts": { | ||
"test": "turbo run test", | ||
"build": "turbo run build", | ||
"prettier": "prettier . --check", | ||
"publish:base": "yarn workspace @woohm402/eslint-config-base publish", | ||
"publish:react": "yarn workspace @woohm402/eslint-config-react publish" | ||
"publish:base": "yarn build && yarn workspace @woohm402/eslint-config-base publish", | ||
"publish:react": "yarn build && yarn workspace @woohm402/eslint-config-react publish" | ||
}, | ||
"devDependencies": { | ||
"prettier": "3.2.5", | ||
|
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 @@ | ||
/dist |
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,2 @@ | ||
import config from '../dist/index.js'; | ||
export default config(); |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import ESLintPluginESLintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'; | ||
import simpleImportSort from 'eslint-plugin-simple-import-sort'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import eslint from '@eslint/js'; | ||
import tseslint, { ConfigWithExtends } from 'typescript-eslint'; | ||
|
||
const consoleLogRestrictSyntax = [ | ||
{ | ||
selector: "CallExpression[callee.object.name='console'][callee.property.name='log']", | ||
message: | ||
'console.log() 가 main 에 머지되는 것은 실수일 수 있습니다. 의도하지 않았다면 제거하고, 의도했다면 console.debug() 등 다른 메서드를 사용해주세요.', | ||
}, | ||
]; | ||
|
||
const envRestrictSyntax = [ | ||
{ | ||
selector: 'MemberExpression[object.name=process][property.name=env]', | ||
message: | ||
'환경변수를 여러 곳에서 접근하는 것은 위험할 수 있습니다. envAllowedFiles 에 소수의 파일들을 등록하고 그곳에서만 접근해주세요.', | ||
}, | ||
{ | ||
selector: 'MemberExpression[object.meta.name=import][object.property.name=meta][property.name=env]', | ||
message: | ||
'환경변수를 여러 곳에서 접근하는 것은 위험할 수 있습니다. envAllowedFiles 에 소수의 파일들을 등록하고 그곳에서만 접근해주세요.', | ||
}, | ||
]; | ||
|
||
const baseRules: ConfigWithExtends = { | ||
plugins: { | ||
'simple-import-sort': simpleImportSort, | ||
'@eslint-community/eslint-comments': | ||
ESLintPluginESLintCommentsConfigs.recommended.plugins['@eslint-community/eslint-comments'], | ||
}, | ||
rules: { | ||
'simple-import-sort/imports': 'error', | ||
'@eslint-community/eslint-comments/no-use': ['error', { allow: [] }], | ||
}, | ||
}; | ||
|
||
const noRestrictedSyntaxForEnvNotAllowedFiles = (options?: Options): ConfigWithExtends => ({ | ||
ignores: options?.envAllowedFiles ?? [], | ||
rules: { | ||
'no-restricted-syntax': ['error', ...consoleLogRestrictSyntax, ...envRestrictSyntax], | ||
}, | ||
}); | ||
|
||
const noRestrictedSyntaxForEnvAllowedFiles = (options?: Options): ConfigWithExtends => ({ | ||
files: options?.envAllowedFiles ?? [], | ||
rules: { | ||
'no-restricted-syntax': ['error', ...consoleLogRestrictSyntax], | ||
}, | ||
}); | ||
|
||
type Options = { envAllowedFiles?: string[] }; | ||
|
||
export default (options?: Options) => | ||
tseslint.config( | ||
eslint.configs.recommended, | ||
eslintPluginPrettierRecommended, | ||
...tseslint.configs.recommended, | ||
baseRules, | ||
noRestrictedSyntaxForEnvNotAllowedFiles(options), | ||
...(options?.envAllowedFiles && options.envAllowedFiles.length > 0 ? [noRestrictedSyntaxForEnvAllowedFiles(options)] : []), | ||
); |
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,7 @@ | ||
declare module '@eslint-community/eslint-plugin-eslint-comments/configs' { | ||
export const recommended: any; | ||
} | ||
|
||
declare module '@eslint/js' { | ||
export const configs: any; | ||
} |
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,7 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
format: ['esm', 'cjs'], | ||
dts: true, | ||
}); |
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 @@ | ||
/dist |
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,2 @@ | ||
import config from '../dist/index.js'; | ||
export default config(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare module 'eslint-plugin-react-hooks' { | ||
export const configs: any; | ||
} | ||
|
||
declare module '@eslint/compat' { | ||
export const fixupPluginRules: any; | ||
} |
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,7 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
format: ['esm', 'cjs'], | ||
dts: true, | ||
}); |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"test": {}, | ||
"build": { "outputs": ["dist"] }, | ||
"test": { "dependsOn": ["build"] }, | ||
"prettier": {} | ||
} | ||
} |
Oops, something went wrong.