-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply shared eslint/typescript config & upgrade to typescript v5 (#2096)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> - Fixes #1748 - Fixes #1432 ## Summary <!-- Please brief explanation of the changes made --> - https://github.com/channel-io/shared-configs 팀 공용 설정 파일을 바탕으로 configs/ 하위에 레포지토리 공용 eslint, typescript config를 설정합니다. - supports/ 하위보다 더 명확한 디렉토리명이라고 판단하여 이름 변경 - 전반적으로 중복되는 설정들을 공용 설정으로 이동하고 제거했습니다. ## Details <!-- Please elaborate description of the changes --> - eslint의 import/order 규칙을 단순하게 통일하게 되면서 일부 order 변경이 있습니다 - 브라우저용/노드용 패키지를 구분하여 typescript config를 만들었습니다. - tsconfig의 include 패턴에 와일드카드를 사용하여 단순화했습니다. 와일드 카드를 사용할 필요가 없는 케이스도 마찬가지로 단순화했습니다. (`src/**/*` -> `src`) - tsconfig의 exclude 패턴에 불필요한 패턴을 정리했습니다 (예: node_modules) - typescript 버전을 v5.4로 업데이트합니다. - `ttypescript` : 패키지가 v5와 호환되지 않아서 ts-patch 라이브러리로 대체합니다 - cevek/ttypescript#147 ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> No ## References <!-- Please list any other resources or points the reviewer should be aware of --> - https://github.com/channel-io/shared-configs
- Loading branch information
1 parent
67d6f4b
commit 075a0a5
Showing
39 changed files
with
517 additions
and
920 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,3 @@ | ||
*.cjs | ||
*.json | ||
*.txt |
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,41 @@ | ||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
module.exports = { | ||
extends: ['@channel.io/eslint-config/web'], | ||
plugins: [ | ||
'@channel.io/eslint-plugin', | ||
'import-newlines', | ||
'jest', | ||
], | ||
parser: "@typescript-eslint/parser", | ||
env: { | ||
node: true, | ||
}, | ||
rules: { | ||
'import/order': [ | ||
'error', | ||
{ | ||
'newlines-between': 'always', | ||
alphabetize: { order: 'asc' }, | ||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], | ||
pathGroupsExcludedImportTypes: ['react', 'react-dom'], | ||
pathGroups: [{ | ||
pattern: '{react,react-dom}', | ||
group: 'external', | ||
position: 'before', | ||
}], | ||
}, | ||
], | ||
'import-newlines/enforce': ['error', { items: 1 }], | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreDeclarationSort: true, | ||
}, | ||
], | ||
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }], | ||
'@typescript-eslint/consistent-type-exports': ['error', { fixMixedExportsWithInlineTypeSpecifier: true }], | ||
'@typescript-eslint/naming-convention': 'off', | ||
} | ||
} |
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,13 @@ | ||
{ | ||
"name": "eslint-config-bezier", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "Common ESLint configuration.", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@channel.io/eslint-config": "^2.0.4", | ||
"@channel.io/eslint-plugin": "^1.2.3", | ||
"eslint-plugin-import-newlines": "^1.3.4", | ||
"eslint-plugin-jest": "^22.21.0" | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
supports/tsconfig/eslint.json → configs/tsconfig/browser.json
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,8 +1,7 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "@channel.io/typescript-config/web.json", | ||
"compilerOptions": { | ||
"types": ["@types/node"], | ||
"noEmit": true, | ||
"allowJs": true | ||
"allowJs": 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,9 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "@channel.io/typescript-config/node.json", | ||
"compilerOptions": { | ||
"module": "nodenext", | ||
"moduleResolution": "nodenext", | ||
"allowJs": 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,9 @@ | ||
{ | ||
"name": "tsconfig", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "Common Typescript configuration.", | ||
"dependencies": { | ||
"@channel.io/typescript-config": "^0.0.1" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
{ | ||
"extends": "tsconfig/eslint.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
".eslintrc.cjs", | ||
"jest.config.cjs", | ||
"src", | ||
".*.cjs", | ||
"*.cjs", | ||
], | ||
"exclude": ["src/**/fixtures/*"] | ||
} |
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,23 +1,15 @@ | ||
{ | ||
"extends": "tsconfig/script.json", | ||
"extends": "tsconfig/node.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"module": "node16", | ||
"moduleResolution": "node16", | ||
"moduleDetection": "force", | ||
"target": "es2020", | ||
"lib": ["DOM", "DOM.Iterable", "es2020"], | ||
"esModuleInterop": true, | ||
"jsx": "react", | ||
"declaration": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
}, | ||
"include": [ | ||
"src", | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"src/**/fixtures/*" | ||
"src/**/fixtures/*", | ||
"src/**/*.test.ts", | ||
], | ||
} |
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
9 changes: 4 additions & 5 deletions
9
packages/bezier-figma-plugin/src/ui/components/ExtractSuccess.tsx
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
{ | ||
"extends": "tsconfig/eslint.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
}, | ||
"include": [ | ||
"src", | ||
".*.js", | ||
"src/**/*", | ||
"*.js", | ||
"*.ts" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
{ | ||
"extends": "tsconfig/browser.json", | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"moduleResolution": "node", | ||
"lib": ["es2017", "dom"], | ||
"jsx": "react", | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"typeRoots": [ | ||
"../../node_modules/@types", | ||
"../../node_modules/@figma" | ||
] | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.tsx"] | ||
"include": ["src"], | ||
} |
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,35 +1,11 @@ | ||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
module.exports = { | ||
root: true, | ||
extends: ['bezier'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.eslint.json', | ||
}, | ||
rules: { | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreDeclarationSort: true, | ||
}, | ||
], | ||
'import/order': [ | ||
'error', | ||
{ | ||
'newlines-between': 'always', | ||
alphabetize: { order: 'asc' }, | ||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], | ||
pathGroupsExcludedImportTypes: ['react'], | ||
pathGroups: [ | ||
{ | ||
pattern: 'react', | ||
group: 'external', | ||
position: 'before', | ||
}, | ||
], | ||
}, | ||
], | ||
'react/react-in-jsx-scope': 'off', | ||
'react/jsx-props-no-spreading': 'off', | ||
'@typescript-eslint/naming-convention': 'off', | ||
}, | ||
} |
Oops, something went wrong.