diff --git a/.github/codeowners b/.github/codeowners index 98ba3f3..b5914d4 100644 --- a/.github/codeowners +++ b/.github/codeowners @@ -1,3 +1,4 @@ * @timedia/styleguide +/ecmascript @timedia/styleguide-ecmascript /ruby @timedia/styleguide-ruby diff --git a/.github/labeler.yml b/.github/labeler.yml index 798a15d..4d761e6 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,5 +1,9 @@ +ecmascript: + - ecmascript/** + ruby: - ruby/** others: + - '!ecmascript/**' - '!ruby/**' diff --git a/.gitignore b/.gitignore index 9343d2a..691fb72 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ +ecmascript/**/node_modules +ecmascript/package-lock.json +ecmascript/yarn.lock ruby/Gemfile.lock diff --git a/README.md b/README.md index f5ebf17..0bbc4de 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@ ## 対応言語と Linter/Formatter の一覧 - [Ruby](ruby/README.md) - RuboCop +- [ECMAScript/TypeScript](ecmascript/README.md) + - ESLint diff --git a/ecmascript/.eslintrc.yaml b/ecmascript/.eslintrc.yaml new file mode 100644 index 0000000..fb28857 --- /dev/null +++ b/ecmascript/.eslintrc.yaml @@ -0,0 +1,4 @@ +env: + node: true +extends: + - "@timedia" diff --git a/ecmascript/README.md b/ecmascript/README.md new file mode 100644 index 0000000..8278bc4 --- /dev/null +++ b/ecmascript/README.md @@ -0,0 +1,12 @@ +# ECMAScript/TypeScript 用 Linter/Formatter 設定 + +## Linter/Formatter +- ESLint + +### 設定ファイルのバリエーション +#### ESLint +- [ECMAScript Base](./packages/eslint-config/index.js) +- [TypeScript Base](./packages/eslint-config/typescript.js) + +## 使い方 +TODO diff --git a/ecmascript/package.json b/ecmascript/package.json new file mode 100644 index 0000000..2748df1 --- /dev/null +++ b/ecmascript/package.json @@ -0,0 +1,10 @@ +{ + "private": true, + "workspaces": [ + "packages/*" + ], + "devDependencies": { + "@timedia/eslint-config": "*", + "eslint": "^8.17.0" + } +} diff --git a/ecmascript/packages/eslint-config/configs/eslint-comments.js b/ecmascript/packages/eslint-config/configs/eslint-comments.js new file mode 100644 index 0000000..bae6f51 --- /dev/null +++ b/ecmascript/packages/eslint-config/configs/eslint-comments.js @@ -0,0 +1,8 @@ +/* + * eslint-plugin-eslint-comments パッケージで定義されたルールを有効化/無効化する + */ +module.exports = { + extends: [ + "plugin:eslint-comments/recommended", + ], +}; diff --git a/ecmascript/packages/eslint-config/configs/eslint.js b/ecmascript/packages/eslint-config/configs/eslint.js new file mode 100644 index 0000000..a18e9d1 --- /dev/null +++ b/ecmascript/packages/eslint-config/configs/eslint.js @@ -0,0 +1,8 @@ +/* + * ESLint 本体に定義されたルールを有効化/無効化する + */ +module.exports = { + extends: [ + "eslint:recommended", + ], +}; diff --git a/ecmascript/packages/eslint-config/configs/typescript-eslint.js b/ecmascript/packages/eslint-config/configs/typescript-eslint.js new file mode 100644 index 0000000..740f55a --- /dev/null +++ b/ecmascript/packages/eslint-config/configs/typescript-eslint.js @@ -0,0 +1,14 @@ +/* + * @typescript-eslint/eslint-plugin パッケージで定義されたルールを有効化/無効化する + */ +module.exports = { + extends: [ + "plugin:@typescript-eslint/recommended", + ], + parser: "@typescript-eslint/parser", + parserOptions: { + "ecmaVersion": "latest", + "sourceType": "module", + }, +}; + diff --git a/ecmascript/packages/eslint-config/index.js b/ecmascript/packages/eslint-config/index.js new file mode 100644 index 0000000..aed942f --- /dev/null +++ b/ecmascript/packages/eslint-config/index.js @@ -0,0 +1,9 @@ +/* + * TypeScript を使わない/使えないプロジェクト向けのルールセット + */ +module.exports = { + extends: [ + "./configs/eslint.js", + "./configs/eslint-comments.js", + ], +}; diff --git a/ecmascript/packages/eslint-config/package.json b/ecmascript/packages/eslint-config/package.json new file mode 100644 index 0000000..9f1dc5f --- /dev/null +++ b/ecmascript/packages/eslint-config/package.json @@ -0,0 +1,29 @@ +{ + "name": "@timedia/eslint-config", + "version": "0.1.0", + "description": "The default ESLint configuration for TIMEINTERMEDIA, Inc.", + "main": "index.js", + "repository": "https://github.com/timedia/styleguide.git", + "author": "Ryo MAEDA", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "eslint": "^8.17.0", + "eslint-plugin-eslint-comments": "^3.2.0", + "typescript": "^4.7.3" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "eslint": "^8.17.0", + "eslint-plugin-eslint-comments": "^3.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + }, + "@typescript-eslint/parser": { + "optional": true + } + } +} diff --git a/ecmascript/packages/eslint-config/typescript.js b/ecmascript/packages/eslint-config/typescript.js new file mode 100644 index 0000000..e657514 --- /dev/null +++ b/ecmascript/packages/eslint-config/typescript.js @@ -0,0 +1,10 @@ +/* + * TypeScript を使うプロジェクト向けのルールセット + */ +module.exports = { + extends: [ + "./configs/eslint.js", + "./configs/eslint-comments.js", + "./configs/typescript-eslint.js", + ], +}; diff --git a/ruby/README.md b/ruby/README.md index f36c0c5..31a1d42 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -4,6 +4,7 @@ - RuboCop ### 設定ファイルのバリエーション +#### RuboCop - [Base](./rubocop/config/base.yml) - [Rails](./rubocop/config/rails.yml) - [RSpec](./rubocop/config/rspec.yml)