Skip to content

Commit

Permalink
chore: Add ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
raon0211 committed Apr 11, 2024
1 parent 72bee5b commit a7e9b9c
Show file tree
Hide file tree
Showing 4 changed files with 513 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
- checkout
- setup
- run:
name: Prepack
command: yarn prepack
name: Build
command: yarn build

check-peer:
docker:
Expand Down
72 changes: 72 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
module.exports = {
root: true,

env: {
es6: true,
node: true,
browser: true,
jest: true,
'shared-node-browser': true,
},

parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
},

extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
plugins: ['@typescript-eslint'],
rules: {
'no-implicit-coercion': 'error',
'no-warning-comments': [
'warn',
{
terms: ['TODO', 'FIXME', 'XXX', 'BUG'],
location: 'anywhere',
},
],
curly: ['error', 'all'],
eqeqeq: ['error', 'always', { null: 'ignore' }],

// Hoisting을 전략적으로 사용한 경우가 많아서
'@typescript-eslint/no-use-before-define': 'off',
// 모델 정의 부분에서 class와 interface를 합치기 위해 사용하는 용법도 잡고 있어서
'@typescript-eslint/no-empty-interface': 'off',
// 모델 정의 부분에서 파라미터 프로퍼티를 잘 쓰고 있어서
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/naming-convention': [
'error',
{ format: ['camelCase', 'UPPER_CASE', 'PascalCase'], selector: 'variable', leadingUnderscore: 'allow' },
{ format: ['camelCase', 'PascalCase'], selector: 'function' },
{ format: ['PascalCase'], selector: 'interface' },
{ format: ['PascalCase'], selector: 'typeAlias' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'public-static-field',
'private-static-field',
'public-instance-field',
'private-instance-field',
'public-constructor',
'private-constructor',
'public-instance-method',
'private-instance-method',
],
},
],
},
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"@changesets/cli": "^2.27.1",
"@netlify/plugin-nextjs": "^5.0.0",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"eslint": "^7",
"eslint-config-prettier": "^8.5.0",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"typescript": "^5.4.3",
Expand Down
Loading

0 comments on commit a7e9b9c

Please sign in to comment.